diff --git a/spec/lib/asset_processor_spec.rb b/spec/lib/asset_processor_spec.rb index 56d89a37..99e1a14d 100644 --- a/spec/lib/asset_processor_spec.rb +++ b/spec/lib/asset_processor_spec.rb @@ -8,15 +8,15 @@ let(:output) { StringIO.new } let(:report_progress_every) { 1 } - let!(:asset_1) { FactoryBot.create(:asset) } - let!(:asset_2) { FactoryBot.create(:asset) } + let!(:first_asset) { FactoryBot.create(:asset) } + let!(:second_asset) { FactoryBot.create(:asset) } it "iterates over all assets" do asset_ids = [] processor.process_all_assets_with do |asset_id| asset_ids << asset_id end - expect(asset_ids).to contain_exactly(asset_1.id.to_s, asset_2.id.to_s) + expect(asset_ids).to contain_exactly(first_asset.id.to_s, second_asset.id.to_s) end it "reports progress for every asset" do diff --git a/spec/requests/access_limited_assets_spec.rb b/spec/requests/access_limited_assets_spec.rb index 9b903a67..1c0f3e5c 100644 --- a/spec/requests/access_limited_assets_spec.rb +++ b/spec/requests/access_limited_assets_spec.rb @@ -1,10 +1,10 @@ require "rails_helper" RSpec.describe "Access limited assets", type: :request do - let(:user_1) { FactoryBot.create(:user, uid: "user-1-id") } - let(:user_2) { FactoryBot.create(:user, uid: "user-2-id") } - let(:user_3) { FactoryBot.create(:user, uid: "user-3-id", organisation_content_id: "org-a") } - let(:user_4) { FactoryBot.create(:user, uid: "user-4-id", organisation_content_id: "org-b") } + let(:authorised_user) { FactoryBot.create(:user, uid: "user-1-id") } + let(:unauthorised_user) { FactoryBot.create(:user, uid: "user-2-id") } + let(:user_from_authorised_organisation) { FactoryBot.create(:user, uid: "user-3-id", organisation_content_id: "org-a") } + let(:user_from_unauthorised_organisation) { FactoryBot.create(:user, uid: "user-4-id", organisation_content_id: "org-b") } let(:asset) { FactoryBot.create(:uploaded_asset, draft: true, access_limited: ["user-1-id"], access_limited_organisation_ids: %w[org-a]) } let(:s3) { S3Configuration.build } @@ -15,7 +15,7 @@ end it "are accessible to users who are authorised to view them" do - login_as user_1 + login_as authorised_user get download_media_path(id: asset, filename: asset.filename) @@ -23,7 +23,7 @@ end it "are not accessible to users who are not authorised to view them" do - login_as user_2 + login_as unauthorised_user get download_media_path(id: asset, filename: asset.filename) @@ -31,7 +31,7 @@ end it "are accessible to users in organisations authorised to view them" do - login_as user_3 + login_as user_from_authorised_organisation get download_media_path(id: asset, filename: asset.filename) @@ -39,7 +39,7 @@ end it "are not accessible to users in organisations not authorised to view them" do - login_as user_4 + login_as user_from_unauthorised_organisation get download_media_path(id: asset, filename: asset.filename) diff --git a/spec/requests/access_limited_whitehall_assets_spec.rb b/spec/requests/access_limited_whitehall_assets_spec.rb index 7b05301c..16e3ed9a 100644 --- a/spec/requests/access_limited_whitehall_assets_spec.rb +++ b/spec/requests/access_limited_whitehall_assets_spec.rb @@ -1,8 +1,8 @@ require "rails_helper" RSpec.describe "Access limited Whitehall assets", type: :request do - let(:user_1) { FactoryBot.create(:user, uid: "user-1-id") } - let(:user_2) { FactoryBot.create(:user, uid: "user-2-id") } + let(:authorised_user) { FactoryBot.create(:user, uid: "user-1-id") } + let(:unauthorised_user) { FactoryBot.create(:user, uid: "user-2-id") } let(:asset) { FactoryBot.create(:uploaded_whitehall_asset, draft: true, access_limited: ["user-1-id"]) } let(:s3) { S3Configuration.build } @@ -13,7 +13,7 @@ end it "are accessible to users who are authorised to view them" do - login_as user_1 + login_as authorised_user get asset.legacy_url_path @@ -21,7 +21,7 @@ end it "are not accessible to users who are not authorised to view them" do - login_as user_2 + login_as unauthorised_user get asset.legacy_url_path