You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using rspec/capybara for testing. Model testing goes well with with_user, but I can not run controller test with get_with. The following simple test gives the error message:
Failures:
1) Revision pages Index Authorisations Authorisation error
Failure/Error: get_with @admin1, revisions_path
RuntimeError:
@controller is nil: make sure you set it in your test's setup method.
# ./spec/controllers/revisions_controller_spec.rb:23:in `block (5 levels) in <top (required)>'
The test script:
require 'spec_helper'
require 'shared/user_helper'
describe "Revision pages" do
include SpecUserHelpers
subject { page }
describe "Index" do
describe "Authorisations" do
let(:auth_error_text) { "Sorry, you are not allowed to access that page." }
before do
without_access_control do
create_users_with_roles # see shared/user_helper
end
end
describe "Authorisation error" do
before do
get_with @admin1, revisions_path
end
it { should have_selector('div.alert.alert-error', text: auth_error_text) }
end
end
end
end
Do I something wrong? In the place of get_with the standard capybara visit revisions_path works, but I must set the user to test authorizations. I tried also
before do
with_user @admin1
visit revisions_path
end
end
but then I se in the log that the Anonymous user is used. But with_user is for model testing.
The text was updated successfully, but these errors were encountered:
I am using rspec/capybara for testing. Model testing goes well with with_user, but I can not run controller test with get_with. The following simple test gives the error message:
The test script:
Do I something wrong? In the place of get_with the standard capybara visit revisions_path works, but I must set the user to test authorizations. I tried also
but then I se in the log that the Anonymous user is used. But with_user is for model testing.
The text was updated successfully, but these errors were encountered: