Do you do any testing with shoulda? after banging my head over rspec for the past few days i decided to give it a try but there is not much instruction out there. I bet this cast would have gotten me stick with rspec for a few more days if id seen it earlier. :-p
It should probably be noted that it's not ideal to just get every passed in action in the last macro. Instead, one might use something like the following:
Does your it_should_require_admin_for_actions test what you want it to?
In articles_controller_spec.rb, you wrote out 5 it blocks that test the actions using get, post, put, and delete, but it_should_require_admin_for_actions only runs get on each of the actions. Doesn't it need to run the correct verb on each action, or does it work the way it is?
@Clemens, @erik, good eye, and thank you for pointing this out. I have not found any downside to using "get" at all times for testing this authentication before filter. However the solution Clements gave seems like a great way to handle this issue.
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
As usual another great screencast, thanks Ryan.
I am especially enjoying all your recent screencasts dedicated to testing as I felt I needed some extra help on this often underestimated aspect of programming.
At 3:07 on line 5 in the block 'action' changes to 'actual' - don't really see this as a problem, was just weird - thought I was seeing things till I wound it back.
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
Thanks! Recently I've been reading the RSpec beta book from Pragmatic Programmers, and it was not too much clear for me. Now I think I've finally understood how this works.
Do you do any testing with shoulda? after banging my head over rspec for the past few days i decided to give it a try but there is not much instruction out there. I bet this cast would have gotten me stick with rspec for a few more days if id seen it earlier. :-p
It should probably be noted that it's not ideal to just get every passed in action in the last macro. Instead, one might use something like the following:
http://gist.github.com/94405
Good stuff. :) The RSpec RDoc on matchers is very confusing but your screencast is very easy to understand.
Awesome, custom rspec matchers for Moonshine are in my backlog. You just saved me a lot of time :).
Thank you very much.
Does your it_should_require_admin_for_actions test what you want it to?
In articles_controller_spec.rb, you wrote out 5 it blocks that test the actions using get, post, put, and delete, but it_should_require_admin_for_actions only runs get on each of the actions. Doesn't it need to run the correct verb on each action, or does it work the way it is?
@Clemens, @erik, good eye, and thank you for pointing this out. I have not found any downside to using "get" at all times for testing this authentication before filter. However the solution Clements gave seems like a great way to handle this issue.
As a new person to tests and RSpec I have a problem getting my head around one thing:
How do the tests you write get integrated back into the code of the application? And how do methods like login_as_admin get used in the application?
If I'm writing code to make tests easier, shouldn't that code also make coding the application easier?
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
Have a good 1 buddy.
As usual another great screencast, thanks Ryan.
I am especially enjoying all your recent screencasts dedicated to testing as I felt I needed some extra help on this often underestimated aspect of programming.
I really appreciate your work. It helps me to improve my skills in Rails. Thanks a lot.
thanks! thanks! thanks!
At 3:07 on line 5 in the block 'action' changes to 'actual' - don't really see this as a problem, was just weird - thought I was seeing things till I wound it back.
Great episode as usual.
I'm a little foggy on why it_should_require_admin_for_actions needs to be a class method. Is it because you're using it to generate it-blocks?
As a new person to tests and RSpec I have a problem getting my head around one thing:
How do the tests you write get integrated back into the code of the application? And how do methods like login_as_admin get used in the application?
As always awesome reailscast.
I'm going into Rspec+Cucumber and so on right now and those last episodes are really useful.
Hope you are going to make some more on the topic.
Have a good 1 buddy.
Don`t understand what do this code
it "#{action} action should require admin" do
get action, :id => 1
Very senk!
Thanks! Recently I've been reading the RSpec beta book from Pragmatic Programmers, and it was not too much clear for me. Now I think I've finally understood how this works.