Skip to content

Instantly share code, notes, and snippets.

@duderonomy
Last active August 29, 2015 14:26
Show Gist options
  • Save duderonomy/cc8225ee7949ffa65dd8 to your computer and use it in GitHub Desktop.
Save duderonomy/cc8225ee7949ffa65dd8 to your computer and use it in GitHub Desktop.
confusing user variable, visit vs. put
describe 'authorization' do
let(:user) { FactoryGirl.create(:user) }
describe 'for non-signed-in users' do
describe 'in the Users controller' do
# describe 'visiting the edit page' do
# before { visit edit_user_path(user) }
# it { expect(page).to have_title(full_title('Sign in')) }
# it { expect(page).to have_selector('div.alert.alert-notice') }
# end
describe 'submitting to the update action' do
before { put user_path(user) }
it { expect(response).to redirect_to(login_path) }
end
end
end
end
$ rspec spec/features/authentication_pages_spec.rb
No DRb server is running. Running in local process instead ...
F.............
Failures:
1) Authentication authorization for non-signed-in users in the Users controller submitting to the update action
Failure/Error: before { put user_path(user) }
ActionController::ParameterMissing:
param is missing or the value is empty: user
# ./app/controllers/users_controller.rb:46:in `user_params'
# ./app/controllers/users_controller.rb:29:in `update'
# ./spec/features/authentication_pages_spec.rb:64:in `block (6 levels) in <top (required)>'
Finished in 1 second (files took 3.69 seconds to load)
14 examples, 1 failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment