Skip to content

Commit

Permalink
Rubocop:
Browse files Browse the repository at this point in the history
  • Loading branch information
Janell-Huyck committed Apr 26, 2024
1 parent 86977ed commit caf0c21
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 28 deletions.
9 changes: 4 additions & 5 deletions spec/features/specs/user_scenarios/admin_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

require 'rails_helper'

RSpec.describe "Admin User Functionalities", type: :feature do
include_context "admin user context"
RSpec.describe 'Admin User Functionalities', type: :feature do
include_context 'admin user context'

it "passes a test" do
it 'passes a test' do
expect(1).to eq(1)
end

end
end
9 changes: 4 additions & 5 deletions spec/features/specs/user_scenarios/read_only_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

require 'rails_helper'

RSpec.describe "Read-Only User Functionalities", type: :feature do
include_context "read-only user context"
RSpec.describe 'Read-Only User Functionalities', type: :feature do
include_context 'read-only user context'

it "passes a test" do
it 'passes a test' do
expect(1).to eq(1)
end

end
end
9 changes: 4 additions & 5 deletions spec/features/specs/user_scenarios/standard_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

require 'rails_helper'

RSpec.describe "Standard User Functionalities", type: :feature do
include_context "standard user context"
RSpec.describe 'Standard User Functionalities', type: :feature do
include_context 'standard user context'

it "passes a test" do
it 'passes a test' do
expect(1).to eq(1)
end

end
end
25 changes: 18 additions & 7 deletions spec/features/support/helpers/authentication_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,24 @@ def log_in_as_user(user)
fill_in 'Email', with: user.email
fill_in 'Password', with: 'notapassword' # from the factory
click_button 'Log in'
validate_login_success
end

private

def validate_login_success
check_successful_sign_in
check_no_error_messages
end

def check_successful_sign_in
expect(page).to have_content('Signed in successfully')
expect(page).to have_content('Conservation Records')
end

aggregate_failures "checking login and dashboard access" do
expect(page).to have_content('Signed in successfully')
expect(page).to have_content('Conservation Records')
expect(page).to_not have_content('Invalid Email or password.')
expect(page).to_not have_content('Log in')
expect(page).to_not have_content('You are already signed in.')
end
def check_no_error_messages
expect(page).to_not have_content('Invalid Email or password.')
expect(page).to_not have_content('Log in')
expect(page).to_not have_content('You are already signed in.')
end
end
4 changes: 2 additions & 2 deletions spec/features/support/shared_contexts/admin_user_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Sets up and logs in an admin user for tests, using aggregate_failures to
# report all login-related issues at once.
RSpec.shared_context "admin user context", shared_context: :metadata do
RSpec.shared_context 'admin user context', shared_context: :metadata do
let(:user) { create(:user, role: 'admin') }

before(:each) do
user
log_in_as_user(user)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Sets up and logs in an admin user for tests, using aggregate_failures to
# report all login-related issues at once.
RSpec.shared_context "read-only user context", shared_context: :metadata do
RSpec.shared_context 'read-only user context', shared_context: :metadata do
let(:user) { create(:user, role: 'read_only') }

before(:each) do
user
log_in_as_user(user)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# Sets up and logs in an admin user for tests, using aggregate_failures to
# report all login-related issues at once.
RSpec.shared_context "standard user context", shared_context: :metadata do
RSpec.shared_context 'standard user context', shared_context: :metadata do
let(:user) { create(:user, role: 'standard') }

before(:each) do
user
log_in_as_user(user)
end
end
end

0 comments on commit caf0c21

Please # to comment.