From 2d6b614f537c25b54d0cd9bbb38bccf36e129ee4 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Wed, 20 May 2020 10:16:48 +0100 Subject: [PATCH] Manually fix remaining linting errors We should avoid making the Gemfile conditional on environment variables. This can always be done locally, on the relatively few occassions it's actually needed. --- Gemfile | 7 +------ app/models/local_authority.rb | 5 +---- app/models/service.rb | 5 +---- db/migrate/20200415103445_enable_service1113.rb | 1 - db/migrate/20200501124957_enable_service_1287.rb | 1 - lib/local-links-manager/import/services_tier_importer.rb | 2 +- spec/factories/links.rb | 2 +- 7 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Gemfile b/Gemfile index 48d79ebc2..e7c8afaae 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,9 @@ ruby File.read(".ruby-version").strip source "https://rubygems.org" -if ENV["API_DEV"] - gem "gds-api-adapters", path: "../gds-api-adapters" -else - gem "gds-api-adapters", "~> 63.6.0" -end - gem "addressable", "~> 2.7.0" gem "dalli" +gem "gds-api-adapters", "~> 63.6.0" gem "gds-sso", "~> 14.3" gem "google-api-client", "~> 0.39.4" gem "googleauth", "~> 0.12.0" diff --git a/app/models/local_authority.rb b/app/models/local_authority.rb index 985673b01..9829de504 100644 --- a/app/models/local_authority.rb +++ b/app/models/local_authority.rb @@ -36,10 +36,7 @@ def provided_service_links end def update_broken_link_count - update_attribute( - :broken_link_count, - provided_service_links.broken_or_missing.count, - ) + update(broken_link_count: provided_service_links.broken_or_missing.count) end def to_param diff --git a/app/models/service.rb b/app/models/service.rb index 7e3f20d4f..797e5a0e4 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -16,10 +16,7 @@ def tiers end def update_broken_link_count - update_attribute( - :broken_link_count, - Link.for_service(self).broken_or_missing.count, - ) + update(broken_link_count: Link.for_service(self).broken_or_missing.count) end def valid_tier?(tier) diff --git a/db/migrate/20200415103445_enable_service1113.rb b/db/migrate/20200415103445_enable_service1113.rb index 29c779147..ab1f18fa3 100644 --- a/db/migrate/20200415103445_enable_service1113.rb +++ b/db/migrate/20200415103445_enable_service1113.rb @@ -10,7 +10,6 @@ def up if service_interaction service_interaction.update!(live: true) - puts "Successfully enabled service 1113" else raise "Service 1113 has not been imported from ESD" end diff --git a/db/migrate/20200501124957_enable_service_1287.rb b/db/migrate/20200501124957_enable_service_1287.rb index 1e0135fe9..cadab8c62 100644 --- a/db/migrate/20200501124957_enable_service_1287.rb +++ b/db/migrate/20200501124957_enable_service_1287.rb @@ -10,7 +10,6 @@ def up if service_interaction service_interaction.update!(live: true) - puts "Successfully enabled service 1287" else raise "Service 1287 has not been imported from ESD" end diff --git a/lib/local-links-manager/import/services_tier_importer.rb b/lib/local-links-manager/import/services_tier_importer.rb index bd801bfab..3fe49a0d4 100644 --- a/lib/local-links-manager/import/services_tier_importer.rb +++ b/lib/local-links-manager/import/services_tier_importer.rb @@ -72,7 +72,7 @@ def checked_services def check_for_missing_services(summariser) missing = [] Service.enabled.each do |service| - next unless checked_services.exclude?(service) + next if checked_services.include?(service) summariser.increment_missing_record_count missing << service diff --git a/spec/factories/links.rb b/spec/factories/links.rb index 44335c6b0..72e43ba63 100644 --- a/spec/factories/links.rb +++ b/spec/factories/links.rb @@ -32,7 +32,7 @@ factory :link_for_disabled_service, parent: :link do after(:create) do |link| - link.service.update_attribute(:enabled, false) + link.service.update(enabled: false) end end end