contain_exactly
Example:
expect([1,2]).to contain_exactly(2,1)
Credit: match_array matcher now available as contain_exactly
Showing posts with label RSpec. Show all posts
Showing posts with label RSpec. Show all posts
Monday, July 21, 2014
Sunday, May 19, 2013
RubyMine can't find test_helper
I have been an RSpec user since I started working on Ruby and Rails. I usually run a spec file, which reflect the production code file that I'm currently working on, inside RubyMine. So far it has been working fine out of the box.
As a lot more people start talking about Minitest, I want to give it a try. I was starting a new project today. It was a perfect chance to try out Minitest. I expected it to work perfectly out of the box with RubyMine, but apparently it is not.
I got this error when I tried running my test as usual.
I did googling around by no luck. There's only a page show how to config Minitest report.
I did try to switch back to RSpec just to see whether it's still working fine, and it is. I looked at the runner command that's generated by RubyMine when we execute the spec. There's nothing special from what it generates for Minitest. It seems like RSpec does some work figuring out the path for us. That's why it works out of the box.
So I aim toward finding a way to manually config properly the test running path. Finally, I figured it out with the clue from this comment.
As a lot more people start talking about Minitest, I want to give it a try. I was starting a new project today. It was a perfect chance to try out Minitest. I expected it to work perfectly out of the box with RubyMine, but apparently it is not.
I got this error when I tried running my test as usual.
`require': cannot load such file -- test_helper (LoadError)Basically, it says that Ruby can't find test_helper file that is required in the top of my Minitest test file. I knew that it's LOAD_PATH issue but I didn't actually know how to config it properly since I was spoiled by out of the box RSpec integration.
I did googling around by no luck. There's only a page show how to config Minitest report.
I did try to switch back to RSpec just to see whether it's still working fine, and it is. I looked at the runner command that's generated by RubyMine when we execute the spec. There's nothing special from what it generates for Minitest. It seems like RSpec does some work figuring out the path for us. That's why it works out of the box.
So I aim toward finding a way to manually config properly the test running path. Finally, I figured it out with the clue from this comment.
- First go to Run > Edit Configurations.
- On the left panel, select Defaults and Ruby
- Put the absolute path to your Rails project into Working directory: field
- Append field Ruby arguments with -Itest (tell Ruby to look into test directory)
- If you had run the test before, you need to remove all the configurations under Ruby section (outside Defaults) to force them to load the new configuration
- And enjoy the Minitest experiences! (Should work with TestUnit too)
Thursday, April 18, 2013
[RSpec] Refer to let value that has the same name in outer scope
There is a situation in RSpec when you want to redefine let value in the inner scope base on value from the outer scope. In RSpec 2.13, you can do that by referring outer scope value with super() (parens are required)
Credit: RSpec 2.13 is released!
Credit: RSpec 2.13 is released!
Subscribe to:
Posts (Atom)
Collectd PostgreSQL Plugin
I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...
-
sudo su postgres supply your Mac password modify /Library/PostgreSQL/9.x/data/pg_hba.conf from local all all md5 to local all all ...
-
Put your cursor on the text box of the post/comment you want to indent Go to the menubar at the top of the screen Edit > Emoji & ...
-
I ran to this error the other day when I tried to export a dump file from a slave Postgres database. cpg_dump: Dumping the contents of ta...