Writing capybara/rspec tests with Rails... called id for nil error -
here test:
require 'spec_helper' describe "user signs in", focus: true "allows users sign in email address , password" user = factorygirl.create(:user) visit "/" click_link "sign in" fill_in "user_email", with: user.email fill_in "user_password", with: user.password click_button "#sign-in-btn" page.should have_content "vitals" end end here error:
1) user signs in allows users sign in email address , password failure/error: visit "/" actionview::template::error: called id nil, mistakenly 4 -- if wanted id of nil, use object_id # ./app/views/devise/registrations/_form.html.erb:2:in `block in _app_views_devise_registrations__form_html_erb__3809420936711950801_70201058646680' # ./app/views/devise/registrations/_form.html.erb:1:in `_app_views_devise_registrations__form_html_erb__3809420936711950801_70201058646680' # ./app/views/shared/modals/_sign_up.html.erb:39:in `_app_views_shared_modals__sign_up_html_erb___493445099205594204_70201081251380' # ./app/views/shared/_modals.html.erb:2:in `_app_views_shared__modals_html_erb__2261979984426842788_70201058520760' # ./app/views/layouts/home.html.erb:16:in `_app_views_layouts_home_html_erb__3485816781407765933_70201082986040' # ./app/controllers/pages_controller.rb:18:in `home' # ./spec/requests/user_registration_spec.rb:8:in `block (2 levels) in <top (required)>' here index method:
def home @user = user.new @account_type = accounttype.legend render layout: 'home' end the problem when home page visited there couple of instance variables need available other items on page... how account in sign in test?
don't worry setting instance variable. actual home action hit. create data needed hit action.
i think in case accounttype. create account type "legend" in test , should think
Comments
Post a Comment