From 3bfb43386cb144b0a1be932da76dafe7cfe76767 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 13 May 2020 09:49:28 +0000 Subject: [PATCH 1/2] Bump rubocop-govuk from 3.9.0 to 3.10.0 Bumps [rubocop-govuk](https://github.com/alphagov/rubocop-govuk) from 3.9.0 to 3.10.0. - [Release notes](https://github.com/alphagov/rubocop-govuk/releases) - [Changelog](https://github.com/alphagov/rubocop-govuk/blob/master/CHANGELOG.md) - [Commits](https://github.com/alphagov/rubocop-govuk/compare/v3.9.0...v3.10.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b5437b2c1..f4a11c2be 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -133,7 +133,6 @@ GEM progress (~> 3.0, >= 3.0.1) image_size (2.0.2) in_threads (1.5.3) - jaro_winkler (1.5.4) jasmine-core (2.99.2) jasmine-rails (0.15.0) jasmine-core (>= 1.3, < 4.0) @@ -237,16 +236,15 @@ GEM netrc (~> 0.8) rexml (3.2.4) rouge (3.19.0) - rubocop (0.82.0) - jaro_winkler (~> 1.5.1) + rubocop (0.83.0) parallel (~> 1.10) parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-govuk (3.9.0) - rubocop (= 0.82.0) + rubocop-govuk (3.10.0) + rubocop (= 0.83.0) rubocop-rails (~> 2) rubocop-rake (~> 0.5.1) rubocop-rspec (~> 1.28) From dbb7e811a764b9f5d70f9e0ee504db069806fc67 Mon Sep 17 00:00:00 2001 From: Ben Thorner Date: Thu, 14 May 2020 11:52:51 +0100 Subject: [PATCH 2/2] Linting auto-correct --- lib/emergency_banner/deploy.rb | 19 ++-- ...copy_component_translations_from_whitehall | 2 +- test/integration/notifications_test.rb | 38 +++++--- test/unit/emergency_banner/deploy_test.rb | 95 +++++++++++++------ 4 files changed, 103 insertions(+), 51 deletions(-) diff --git a/lib/emergency_banner/deploy.rb b/lib/emergency_banner/deploy.rb index 40bfe72ac..b7e15b81b 100644 --- a/lib/emergency_banner/deploy.rb +++ b/lib/emergency_banner/deploy.rb @@ -2,12 +2,19 @@ module EmergencyBanner class Deploy def run(campaign_class, heading, short_description = "", link = "", link_text = "") redis = Redis.new - redis.hmset(:emergency_banner, - :campaign_class, campaign_class, - :heading, heading, - :short_description, short_description, - :link, link, - :link_text, link_text) + redis.hmset( + :emergency_banner, + :campaign_class, + campaign_class, + :heading, + heading, + :short_description, + short_description, + :link, + link, + :link_text, + link_text, + ) end end end diff --git a/script/copy_component_translations_from_whitehall b/script/copy_component_translations_from_whitehall index a2a6e5873..0543d55fa 100755 --- a/script/copy_component_translations_from_whitehall +++ b/script/copy_component_translations_from_whitehall @@ -3,7 +3,7 @@ require "yaml" class Hash - def dig_by_path path + def dig_by_path(path) dig(*path.split(".")) end diff --git a/test/integration/notifications_test.rb b/test/integration/notifications_test.rb index dd0880c55..bb1a067fb 100644 --- a/test/integration/notifications_test.rb +++ b/test/integration/notifications_test.rb @@ -34,9 +34,11 @@ def stub_redis_response(hash) end should "render the more information link" do - stub_redis_response(campaign_class: "notable-death", - heading: "Alas poor Yorick", - link: "https://yoricks.gov") + stub_redis_response( + campaign_class: "notable-death", + heading: "Alas poor Yorick", + link: "https://yoricks.gov", + ) visit "/templates/wrapper.html.erb" @@ -45,10 +47,12 @@ def stub_redis_response(hash) end should "render the more information link with specified text" do - stub_redis_response(campaign_class: "notable-death", - heading: "Alas poor Yorick", - link: "https://yoricks.gov", - link_text: "Some specified text for more information") + stub_redis_response( + campaign_class: "notable-death", + heading: "Alas poor Yorick", + link: "https://yoricks.gov", + link_text: "Some specified text for more information", + ) visit "/templates/wrapper.html.erb" @@ -56,8 +60,10 @@ def stub_redis_response(hash) end should "not render the more information link if it does not exist" do - stub_redis_response(campaign_class: "notable-death", - heading: "Alas poor Yorick") + stub_redis_response( + campaign_class: "notable-death", + heading: "Alas poor Yorick", + ) visit "/templates/wrapper.html.erb" @@ -66,9 +72,11 @@ def stub_redis_response(hash) end should "render the extra information" do - stub_redis_response(campaign_class: "notable-death", - heading: "Alas poor Yorick", - short_description: "I knew him well") + stub_redis_response( + campaign_class: "notable-death", + heading: "Alas poor Yorick", + short_description: "I knew him well", + ) visit "/templates/wrapper.html.erb" @@ -76,8 +84,10 @@ def stub_redis_response(hash) end should "does not render the extra information if it does not exist" do - stub_redis_response(campaign_class: "notable-death", - heading: "Alas poor Yorick") + stub_redis_response( + campaign_class: "notable-death", + heading: "Alas poor Yorick", + ) visit "/templates/wrapper.html.erb" diff --git a/test/unit/emergency_banner/deploy_test.rb b/test/unit/emergency_banner/deploy_test.rb index 2d867e546..3f1e81699 100644 --- a/test/unit/emergency_banner/deploy_test.rb +++ b/test/unit/emergency_banner/deploy_test.rb @@ -4,56 +4,91 @@ describe "Emergency Banner::Deploy" do context "#run" do should "create an emergency_banner hash in Redis with a campaign_class and a heading" do - Redis.any_instance.expects(:hmset).with(:emergency_banner, - :campaign_class, "notable-death", - :heading, "A title", - :short_description, "", - :link, "", - :link_text, "") + Redis.any_instance.expects(:hmset).with( + :emergency_banner, + :campaign_class, + "notable-death", + :heading, + "A title", + :short_description, + "", + :link, + "", + :link_text, + "", + ) EmergencyBanner::Deploy.new.run("notable-death", "A title") end should "create an emergency_banner with a campaign_class, heading and short_description" do - Redis.any_instance.expects(:hmset).with(:emergency_banner, - :campaign_class, "notable-death", - :heading, "A title", - :short_description, "A short description of the event", - :link, "", - :link_text, "") + Redis.any_instance.expects(:hmset).with( + :emergency_banner, + :campaign_class, + "notable-death", + :heading, + "A title", + :short_description, + "A short description of the event", + :link, + "", + :link_text, + "", + ) EmergencyBanner::Deploy.new.run("notable-death", "A title", "A short description of the event") end should "create an emergency_banner with a campaign_class, heading and link" do - Redis.any_instance.expects(:hmset).with(:emergency_banner, - :campaign_class, "notable-death", - :heading, "A title", - :short_description, "", - :link, "https://www.gov.uk", - :link_text, "") + Redis.any_instance.expects(:hmset).with( + :emergency_banner, + :campaign_class, + "notable-death", + :heading, + "A title", + :short_description, + "", + :link, + "https://www.gov.uk", + :link_text, + "", + ) EmergencyBanner::Deploy.new.run("notable-death", "A title", "", "https://www.gov.uk") end should "create an emergency_banner with a campaign_class, heading, short_description and link" do - Redis.any_instance.expects(:hmset).with(:emergency_banner, - :campaign_class, "notable-death", - :heading, "A title", - :short_description, "A short description of the event", - :link, "https://www.gov.uk", - :link_text, "") + Redis.any_instance.expects(:hmset).with( + :emergency_banner, + :campaign_class, + "notable-death", + :heading, + "A title", + :short_description, + "A short description of the event", + :link, + "https://www.gov.uk", + :link_text, + "", + ) EmergencyBanner::Deploy.new.run("notable-death", "A title", "A short description of the event", "https://www.gov.uk") end should "create an emergency_banner with a campaign_class, heading, short_description, link and link_text" do - Redis.any_instance.expects(:hmset).with(:emergency_banner, - :campaign_class, "notable-death", - :heading, "A title", - :short_description, "A short description of the event", - :link, "https://www.gov.uk", - :link_text, "Text for hyperlink") + Redis.any_instance.expects(:hmset).with( + :emergency_banner, + :campaign_class, + "notable-death", + :heading, + "A title", + :short_description, + "A short description of the event", + :link, + "https://www.gov.uk", + :link_text, + "Text for hyperlink", + ) EmergencyBanner::Deploy.new.run("notable-death", "A title", "A short description of the event", "https://www.gov.uk", "Text for hyperlink") end