From 86ef5c839b1d0d4f9eec5eec2290aa2ebbb02a30 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 1 Feb 2022 13:18:56 +0000 Subject: [PATCH] fix all offences except for allow_any_instance --- spec/features/organisation_spec.rb | 12 ++++++------ spec/features/user_spec.rb | 2 +- ...n_view_helper.rb => question_view_helper_spec.rb} | 0 spec/helpers/tab_nav_helper_spec.rb | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) rename spec/helpers/{question_view_helper.rb => question_view_helper_spec.rb} (100%) diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index 2512f0d27..aeebc125b 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -17,10 +17,10 @@ RSpec.describe "User Features" do sign_in user end - context "User is a data coordinator" do + context "when user is a data coordinator" do let!(:user) { FactoryBot.create(:user, :data_coordinator) } - context "Organisation page" do + context "when viewing organisation page" do it "defaults to organisation details" do visit("/logs") click_link("Your organisation") @@ -36,7 +36,7 @@ RSpec.describe "User Features" do end end - context "Organisation users" do + context "when users are part of organisation" do it "users can be added" do visit("/organisations/#{org_id}") click_link("Users") @@ -65,10 +65,10 @@ RSpec.describe "User Features" do end end - context "User is a data provider" do - let!(:user) { FactoryBot.create(:user) } + context "when the user is a data provider" do + let(:user) { FactoryBot.create(:user) } - context "Organisation page" do + context "when viewing organisation page" do it "can only see the details tab" do visit("/logs") click_link("Your organisation") diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 3ec72db35..ed022868c 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -4,7 +4,7 @@ require_relative "../request_helper" RSpec.describe "User Features" do let!(:user) { FactoryBot.create(:user, last_sign_in_at: Time.zone.now) } let(:reset_password_template_id) { DeviseNotifyMailer::RESET_PASSWORD_TEMPLATE_ID } - let(:notify_client) { double(Notifications::Client) } + let(:notify_client) { instance_double(Notifications::Client) } let(:reset_password_token) { "MCDH5y6Km-U7CFPgAMVS" } before do diff --git a/spec/helpers/question_view_helper.rb b/spec/helpers/question_view_helper_spec.rb similarity index 100% rename from spec/helpers/question_view_helper.rb rename to spec/helpers/question_view_helper_spec.rb diff --git a/spec/helpers/tab_nav_helper_spec.rb b/spec/helpers/tab_nav_helper_spec.rb index 8d2d0fe45..92185a685 100644 --- a/spec/helpers/tab_nav_helper_spec.rb +++ b/spec/helpers/tab_nav_helper_spec.rb @@ -19,7 +19,7 @@ RSpec.describe TabNavHelper do end describe "#tab_items" do - context "user is a data_coordinator" do + context "when user is a data_coordinator" do let(:user) { FactoryBot.build(:user, :data_coordinator, organisation: organisation) } it "returns details and user tabs" do @@ -30,7 +30,7 @@ RSpec.describe TabNavHelper do end end - context "user is a data_provider" do + context "when user is a data_provider" do it "returns details tab only" do result = tab_items(user).map { |i| i[:name] } expect(result.count).to eq(1)