Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalinVoineag committed Dec 22, 2023
1 parent 19fd4a6 commit 3c85cb8
Show file tree
Hide file tree
Showing 24 changed files with 73 additions and 79 deletions.
28 changes: 11 additions & 17 deletions adr/00003-testing-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Use the following test types for our classes, modules, and functionalities.
```ruby
RSpec.describe User, type: :model do
subject { build(:user) }

describe ".class_method" do
it "does something" do
expect(User.class_method).to do_something
end
end

describe "#instance_method" do
it "does something" do
expect(subject.instance_method).to do_something
Expand All @@ -41,7 +41,7 @@ Use the following test types for our classes, modules, and functionalities.
expect(User.class_method).to do_something
end
end

describe "#instance_method" do
it "does something" do
expect(subject.instance_method).to do_something
Expand All @@ -59,11 +59,11 @@ Use the following test types for our classes, modules, and functionalities.
given_i_am_on_the_landing_page
i_can_see_something
end

def given_i_am_on_the_landing_page
visit "/"
end

def i_can_see_something
expect(page).to have_content("Something")
end
Expand All @@ -81,33 +81,27 @@ Use the following test types for our classes, modules, and functionalities.
# Base happy path first
it "returns a list of users" do
get :index

expected_json = [
{
id: 1,
first_name: "John",
last_name: "Doe"
}
]


expected_json = [{ id: 1, first_name: "John", last_name: "Doe" }]

expect(response.body).to eq(expected_json)
end

# Happy path variants next
context "when given a 'name' query parameter" do
it "returns a list of users filtered by name" do
# Assertion
end
end

# Error paths
context "without authentication" do
it "returns a 401 error" do
# Assertion
end
end
end

context "POST /users" do
it "returns a list of users" do
get :index
Expand Down
4 changes: 2 additions & 2 deletions app/models/dfe_sign_in_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.begin_session!(session, omniauth_payload)
"email" => omniauth_payload["info"]["email"],
# "dfe_sign_in_uid" => omniauth_payload["uid"],
"first_name" => omniauth_payload["info"]["first_name"],
"last_name" => omniauth_payload["info"]["last_name"]
"last_name" => omniauth_payload["info"]["last_name"],
# "last_active_at" => Time.zone.now,
# "id_token" => omniauth_payload["credentials"]["id_token"],
# "provider" => omniauth_payload["provider"],
Expand All @@ -39,7 +39,7 @@ def self.load_from_session(session)
last_name: dfe_sign_in_session["last_name"],
# id_token: dfe_sign_in_session["id_token"],
# provider: dfe_sign_in_session["provider"],
service: session["service"]
service: session["service"],
)
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/gias_csv_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def call
address2: school["Locality"].presence,
address3: school["Address3"].presence,
website: school["SchoolWebsite"].presence,
telephone: school["TelephoneNum"].presence
telephone: school["TelephoneNum"].presence,
}
end

Expand Down
2 changes: 1 addition & 1 deletion bin/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ m =
require_error = activation_error_handling { require "bundler/version" }
if require_error.nil? &&
Gem::Requirement.new(bundler_requirement).satisfied_by?(
Gem::Version.new(Bundler::VERSION)
Gem::Version.new(Bundler::VERSION),
)
return
end
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Application < Rails::Application
config.autoload_lib(ignore: %w[])

config.assets.paths << Rails.root.join(
"node_modules/govuk-frontend/dist/govuk/assets"
"node_modules/govuk-frontend/dist/govuk/assets",
)

config.autoload_paths += %W[#{config.root}/app/assets/components]
Expand Down
4 changes: 2 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}"
"Cache-Control" => "public, max-age=#{2.days.to_i}",
}
else
config.action_controller.perform_caching = false
Expand All @@ -35,7 +35,7 @@

config.action_mailer.delivery_method = :notify
config.action_mailer.notify_settings = {
api_key: ENV.fetch("GOVUK_NOTIFY_API_KEY")
api_key: ENV.fetch("GOVUK_NOTIFY_API_KEY"),
}

# Store uploaded files on the local file system (see config/storage.yml for options).
Expand Down
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
"Cache-Control" => "public, max-age=#{1.hour.to_i}",
}

# Show full error reports and disable caching.
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/better_html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

BetterHtml.config =
BetterHtml::Config.new(
YAML.safe_load(File.read(Rails.root.join(".better-html.yml")))
YAML.safe_load(File.read(Rails.root.join(".better-html.yml"))),
)

BetterHtml.configure do |config|
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
provider(
:developer,
fields: %i[uid email first_name last_name],
uid_field: :uid
uid_field: :uid,
)
end
when "dfe-sign-in"
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/persona.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
{
first_name: "Patricia",
last_name: "Adebayo",
email: "[email protected]"
email: "[email protected]",
},
{ first_name: "Mary", last_name: "Lawson", email: "[email protected]" },
{
first_name: "Colin",
last_name: "Chapman",
email: "[email protected]",
support_user: true
}
support_user: true,
},
].push((DEVELOPER_PERSONA if defined?(DEVELOPER_PERSONA))).compact.freeze

PERSONA_EMAILS = PERSONAS.map { |persona| persona[:email] }
2 changes: 1 addition & 1 deletion config/routes/placements.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
scope module: :placements,
as: :placements,
constraints: {
host: ENV["PLACEMENTS_HOST"]
host: ENV["PLACEMENTS_HOST"],
} do
root to: "pages#index"

Expand Down
2 changes: 1 addition & 1 deletion lib/hosting_environment.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module HostingEnvironment
PRODUCTION_BANNER_NAME = {
claims: "beta",
placements: "beta"
placements: "beta",
}.with_indifferent_access.freeze

def self.name(current_service)
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/auto_annotate_models.rake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if Rails.env.development?
"trace" => "false",
"wrapper_open" => nil,
"wrapper_close" => nil,
"with_comment" => "true"
"with_comment" => "true",
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/decorators/persona_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
context "when the persona is Patricia" do
it "returns orange" do
expect(build(:persona, :patricia).decorate.type_tag_colour).to eq(
"orange"
"orange",
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ def then_i_see_persona_details_for_anne
page_has_persona_content(
first_name: "Anne",
last_name: "Wilson",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_patricia
page_has_persona_content(
first_name: "Patricia",
last_name: "Adebayo",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_mary
page_has_persona_content(
first_name: "Mary",
last_name: "Lawson",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_colin
page_has_persona_content(
first_name: "Colin",
last_name: "Chapman",
email: "[email protected]"
email: "[email protected]",
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,31 @@ def then_i_see_persona_details_for_anne
page_has_persona_content(
first_name: "Anne",
last_name: "Wilson",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_patricia
page_has_persona_content(
first_name: "Patricia",
last_name: "Adebayo",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_mary
page_has_persona_content(
first_name: "Mary",
last_name: "Lawson",
email: "[email protected]"
email: "[email protected]",
)
end

def then_i_see_persona_details_for_colin
page_has_persona_content(
first_name: "Colin",
last_name: "Chapman",
email: "[email protected]"
email: "[email protected]",
)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/hosting_environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
it "returns the banner description of the hosting environment for claims" do
current_service = "claims"
expect(described_class.banner_description(current_service)).to eq(
"Make a complaint or give feedback"
"Make a complaint or give feedback",
)
end

it "returns the banner description of the hosting environment for placements" do
current_service = "placements"
expect(described_class.banner_description(current_service)).to eq(
"Make a complaint or give feedback"
"Make a complaint or give feedback",
)
end
end
Expand Down
30 changes: 15 additions & 15 deletions spec/models/dfe_sign_in_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"info" => {
"first_name" => "Example",
"last_name" => "User",
"email" => "[email protected]"
}
"email" => "[email protected]",
},
}
DfESignInUser.begin_session!(session, omniauth_payload)

Expand All @@ -18,9 +18,9 @@
"dfe_sign_in_user" => {
"first_name" => "Example",
"last_name" => "User",
"email" => "[email protected]"
}
}
"email" => "[email protected]",
},
},
)
end
end
Expand All @@ -31,9 +31,9 @@
"dfe_sign_in_user" => {
"first_name" => "Example",
"last_name" => "User",
"email" => "[email protected]"
"email" => "[email protected]",
},
"service" => :placements
"service" => :placements,
}
dfe_sign_in_user = DfESignInUser.load_from_session(session)

Expand All @@ -53,9 +53,9 @@
"dfe_sign_in_user" => {
"first_name" => claims_user.first_name,
"last_name" => claims_user.last_name,
"email" => claims_user.email
"email" => claims_user.email,
},
"service" => :claims
"service" => :claims,
}

dfe_sign_in_user = DfESignInUser.load_from_session(session)
Expand All @@ -73,9 +73,9 @@
"dfe_sign_in_user" => {
"first_name" => placements_user.first_name,
"last_name" => placements_user.last_name,
"email" => placements_user.email
"email" => placements_user.email,
},
"service" => :placements
"service" => :placements,
}

dfe_sign_in_user = DfESignInUser.load_from_session(session)
Expand All @@ -91,9 +91,9 @@
"dfe_sign_in_user" => {
"first_name" => support_user.first_name,
"last_name" => support_user.last_name,
"email" => support_user.email
"email" => support_user.email,
},
"service" => :placements
"service" => :placements,
}

dfe_sign_in_user = DfESignInUser.load_from_session(session)
Expand All @@ -110,8 +110,8 @@
"dfe_sign_in_user" => {
"first_name" => "Example",
"last_name" => "User",
"email" => "[email protected]"
}
"email" => "[email protected]",
},
}

DfESignInUser.end_session!(session)
Expand Down
Loading

0 comments on commit 3c85cb8

Please sign in to comment.