Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.