Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description improves reading them and also makes all descriptions consistent. Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
This commit is contained in:
@@ -3,13 +3,13 @@ require 'rails_helper'
|
||||
describe Management::SessionsController do
|
||||
|
||||
describe 'Sign in' do
|
||||
it "should deny access if wrong manager credentials" do
|
||||
it "denies access if wrong manager credentials" do
|
||||
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false)
|
||||
expect { get :create, login: "nonexistent", clave_usuario: "wrong"}.to raise_error CanCan::AccessDenied
|
||||
expect(session[:manager]).to be_nil
|
||||
end
|
||||
|
||||
it "should redirect to management root path if authorized manager with right credentials" do
|
||||
it "redirects to management root path if authorized manager with right credentials" do
|
||||
manager = {login: "JJB033", user_key: "31415926", date: "20151031135905"}
|
||||
allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(manager)
|
||||
|
||||
@@ -18,7 +18,7 @@ describe Management::SessionsController do
|
||||
expect(session[:manager][:login]).to eq "JJB033"
|
||||
end
|
||||
|
||||
it "should redirect to management root path if user is admin" do
|
||||
it "redirects to management root path if user is admin" do
|
||||
user = create(:administrator).user
|
||||
sign_in user
|
||||
get :create
|
||||
@@ -26,7 +26,7 @@ describe Management::SessionsController do
|
||||
expect(session[:manager][:login]).to eq "admin_user_#{user.id}"
|
||||
end
|
||||
|
||||
it "should redirect to management root path if user is manager" do
|
||||
it "redirects to management root path if user is manager" do
|
||||
user = create(:manager).user
|
||||
sign_in user
|
||||
get :create
|
||||
@@ -34,7 +34,7 @@ describe Management::SessionsController do
|
||||
expect(session[:manager][:login]).to eq "manager_user_#{user.id}"
|
||||
end
|
||||
|
||||
it "should deny access if user is not admin or manager" do
|
||||
it "denies access if user is not admin or manager" do
|
||||
sign_in create(:user)
|
||||
expect { get :create}.to raise_error CanCan::AccessDenied
|
||||
expect(session[:manager]).to be_nil
|
||||
@@ -42,7 +42,7 @@ describe Management::SessionsController do
|
||||
end
|
||||
|
||||
describe 'Sign out' do
|
||||
it "should destroy the session data and redirect" do
|
||||
it "destroys the session data and redirect" do
|
||||
session[:manager] = {user_key: "31415926", date: "20151031135905", login: "JJB033"}
|
||||
session[:document_type] = "1"
|
||||
session[:document_number] = "12345678Z"
|
||||
|
||||
Reference in New Issue
Block a user