wrong number of arguments calling `request` (0 for 1) (ArgumentError)

11 views
Skip to first unread message

ROR Architect

unread,
Jun 24, 2013, 2:59:28 PM6/24/13
to shangha...@googlegroups.com
Here is the scenario

  Scenario: Successful login
    Given an unauthenticated visitor

    When visitor goes to /users/login
    And fills in Email with: amitpandya
    And fills in Password with: amitpandya
    And clicks the Login button

    Then amitpandya should be logged in
    And page should include a notice with text: Welcome amitpandya
    And amitpandya should see the home mypage page

now in steps file

When "$person logs in" do |user|
  post_via_redirect "/users/login", {:authenticator => {:username => user, :password => "washington"}},{:https => 'on'}
  request.should_not be_ssl
  request.session[:user_id].should == Person.find_by_username(user).id
end

working fine with cucumber-0.10.0 and cucumber-rails-0.3.2 but if I upgrade with cucumber-rails-1.2.1 or cucumber-rails-1.3.1 - at this line request.session[:user_id].should == Person.find_by_username(user).id

I am getting bellow error.

Then amitpandya should be logged in                            # features/step_definitions/session_steps.rb:11
 wrong number of arguments calling `request` (0 for 1) (ArgumentError)
 ./features/step_definitions/session_steps.rb:12:in `/^(.*)\ should\ be\ logged\ in$/'
 features/login.feature:23:in `Then amitpandya should be logged in'

Any help How can I fix it?


Thank you.

With kind regards,
Amit Pandya

Matthew Rudy Jacobs

unread,
Jun 24, 2013, 9:44:32 PM6/24/13
to shangha...@googlegroups.com

the backtrace says the error is in "should be logged in"

perhaps you can show us that code.

--
--
--~--~---------~--~----~------------~-------~--~----~
Shanghai Ruby&Rails 爱好者论坛是一个非营利的民间组织,它旨在为Ruby&Rails爱好者提供一个自由,开放的交流平台,论坛每季度举行一次大型会议,会议的所有费用由赞助商支付,来宾不需交纳任何费用。
We push the china ruby&rails community forward!!
Shanghai Ruby&Rails的邮件列表地址是 shangha...@googlegroups.com
要了解更多详情,请访问 http://groups.google.com/group/shanghaionrails?hl=en?hl=en
退订请发送mail到 shanghaionrai...@googlegroups.com
--~--~---------~--~----~------------~-------~--~----~
---
You received this message because you are subscribed to the Google Groups "Shanghai on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shanghaionrai...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Pandya, Amit

unread,
Jun 24, 2013, 9:51:10 PM6/24/13
to shangha...@googlegroups.com, matthewr...@gmail.com
Here is the code I write in /features/step_definitions/session_steps.rb

When "$person logs in" do |user|
  post_via_redirect "/users/login", {:authenticator => {:username => user, :password => "washington"}},{:https => 'on'}
  request.should_not be_ssl
  request.session[:user_id].should == Person.find_by_username(user).id
end
--
Warm Regards,

A
mit Pandya

End is not end, In-fact E.N.D is "EFFORT NEVER DIES"
If you get NO in answer, remember N.O. is "NEXT OPPORTUNITY"
Impossible just separate the word - I M Possible

Reply all
Reply to author
Forward
0 new messages