-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use 'update!' to surface save errors
Previously we switched from 'update_attribute' to 'update' to fix linting issues, but this carries a risk of silently failing to save changes, since 'update' will run validations. This switches all uses of 'update' to 'update!' to ensure we become aware of any issues in case they are not covered by the tests.
- Loading branch information
Ben Thorner
committed
May 27, 2020
1 parent
2d6b614
commit ac607b4
Showing
12 changed files
with
24 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,7 @@ def self.build(params) | |
|
||
def make_missing | ||
self.url = nil | ||
save | ||
save! | ||
end | ||
|
||
private | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
feature "The broken links page" do | ||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
|
||
@service = create(:service, :all_tiers) | ||
@service_interaction = create(:service_interaction, service: @service) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
feature "The links for a local authority" do | ||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
@time = Timecop.freeze("2016-07-14 11:34:09 +0100") | ||
@local_authority = create(:local_authority, status: "ok", link_last_checked: @time - (60 * 60)) | ||
@service = create(:service) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
feature "The local authorities index page" do | ||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
|
||
@angus = create(:local_authority, name: "Angus") | ||
@zorro = create(:local_authority, name: "Zorro Council", broken_link_count: 1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
let!(:local_authority) { create(:district_council) } | ||
|
||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
visit local_authority_path(local_authority_slug: local_authority.slug) | ||
end | ||
|
||
|
@@ -26,7 +26,7 @@ | |
|
||
it "displays 'No link'" do | ||
local_authority.homepage_url = nil | ||
local_authority.save | ||
local_authority.save! | ||
visit local_authority_path(local_authority_slug: local_authority.slug) | ||
within(:css, ".page-title") do | ||
expect(page).to have_content("No link") | ||
|
@@ -35,7 +35,7 @@ | |
|
||
it "does not display 'Link not checked'" do | ||
local_authority.homepage_url = nil | ||
local_authority.save | ||
local_authority.save! | ||
visit local_authority_path(local_authority_slug: local_authority.slug) | ||
within(:css, ".page-title") do | ||
expect(page).not_to have_content("Link not checked") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
feature "The services index page" do | ||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
|
||
@aardvark = create(:service, label: "Aardvark Wardens") | ||
@zebra = create(:service, label: "Zebra Fouling", broken_link_count: 1) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
feature "The services show page" do | ||
before do | ||
User.create(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
User.create!(email: "[email protected]", name: "Test User", permissions: %w[signin]) | ||
|
||
@service = create(:service, :all_tiers) | ||
service_interaction = create(:service_interaction, service: @service) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters