Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@balinterdi
Created March 11, 2009 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balinterdi/77581 to your computer and use it in GitHub Desktop.
Save balinterdi/77581 to your computer and use it in GitHub Desktop.
Scenario: Create album
Given I am logged in as "pepito"
When I go to my profile page
...
Given /^the user (.*) exists$/ do |login_name|
User.find_by_login(login_name) || Factory(:user_with_password, :login => login_name)
end
Given /^I log in as (.*)$/ do |login_name|
user = User.find_by_login(login_name)
# it is supposed that the user was generated by the :user_with_password fixture
# that has the 'secret' password
post "/session", :login => user.login, :password => 'secret'
end
Given /^I am logged in as "(.*)"$/ do |login_name|
Given "the user #{login_name} exists"
Given "I log in as #{login_name}"
end
When /^I go to (.+)$/ do |page_name|
visit path_to(page_name)
end
def path_to(page_name)
case page_name
when /my profile page/i
member_profile_path(:id => session[:user_id])
...
end
When I go to my profile page # features/step_definitions/webrat_steps.rb:6
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.session (NoMethodError)
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/test_process.rb:429:in `session'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment