Created
January 16, 2012 14:11
-
-
Save schneems/1621039 to your computer and use it in GitHub Desktop.
Devise stubbing in action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let(:user) { Factory.create(:user) } | |
| # To use the methods you can call | |
| # methods directly on them like this: | |
| scenario 'works while logged in' do | |
| as_user(user).visit teach_path | |
| # ... | |
| # Or you can pass the code you wish | |
| # to run in a block: | |
| scenario 'creating a class' do | |
| as_user(user) do | |
| visit teach_path | |
| click_link('Create') | |
| current_path.should == new_course_path | |
| fill_in 'course_title', :with => course_stub.title | |
| fill_in 'course_teaser', :with => course_stub.teaser | |
| fill_in 'course_experience', :with => course_stub.experience | |
| click_button 'Submit' | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment