Skip to content

Commit

Permalink
Lint since rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie committed Dec 22, 2023
1 parent 797ed20 commit dff9e5e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 30 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ end
group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "launchy"
gem "rails-controller-testing"
gem "selenium-webdriver"
gem "shoulda-matchers"
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def filter_providers(providers, query)
provider.dig("attributes", "name"),
provider.dig("attributes", "postcode"),
provider.dig("attributes", "urn"),
provider.dig("attributes", "ukprn")
provider.dig("attributes", "ukprn"),
].any? { |attribute| attribute&.downcase&.include?(downcase_query) }
end
end
Expand All @@ -31,7 +31,7 @@ def formatted_provider(provider)
{
id: provider.fetch("id"),
name: provider.dig("attributes", "name"),
code: provider.dig("attributes", "code")
code: provider.dig("attributes", "code"),
}
end
end
4 changes: 2 additions & 2 deletions app/helpers/routes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ module RoutesHelper
def root_path
{
claims: claims_root_path,
placements: placements_root_path
placements: placements_root_path,
}.fetch current_service
end

def support_root_path
{
claims: root_path, # TODO: claims support path in another PR
placements: placements_support_root_path
placements: placements_support_root_path,
}.fetch current_service
end

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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# Changing type from feature => system stops the javascript working.
# Will attempt to resolve in another PR.
RSpec.describe "Placements / Providers / Support User adds a Provider", type: :feature do
RSpec.describe "Placements / Providers / Support User adds a Provider",
type: :feature do
before do
next_year = Time.current.next_year.year

Expand Down
8 changes: 4 additions & 4 deletions terraform/application/config/review.tfvars.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cluster": "test",
"namespace": "bat-qa",
"deploy_azure_backing_services": false,
"enable_postgres_ssl" : false
"cluster": "test",
"namespace": "bat-qa",
"deploy_azure_backing_services": false,
"enable_postgres_ssl": false
}

0 comments on commit dff9e5e

Please sign in to comment.