Skip to content

Commit

Permalink
Merge pull request #112 from hashicorp/remove-remaining-rails-depreca…
Browse files Browse the repository at this point in the history
…tions

Remove remaining Rails 5.0 thru 6.0 deprecations
  • Loading branch information
chrisarcand authored Oct 27, 2020
2 parents 90ea4db + 65b6933 commit 91228ba
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
5 changes: 5 additions & 0 deletions spec/dummy/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Use native SQLite integers as booleans in Rails 5.2+
if ActiveRecord.gem_version >= Gem::Version.new("5.2")
config.active_record.sqlite3.represent_boolean_as_integer = true
end
end
5 changes: 5 additions & 0 deletions spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Use native SQLite integers as booleans in Rails 5.2+
if ActiveRecord.gem_version >= Gem::Version.new("5.2")
config.active_record.sqlite3.represent_boolean_as_integer = true
end
end
32 changes: 16 additions & 16 deletions spec/integration/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

it "allows attributes to be unset" do
person = Person.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
Expand All @@ -67,15 +67,15 @@
it "allows attributes to be unset after reload" do
person = Person.create!(ssn: "123-45-6789")
person.reload
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
end

it "allows attributes to be blank" do
person = Person.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: "")
person.update!(ssn: "")
person.reload

expect(person.ssn).to eq("")
Expand All @@ -84,7 +84,7 @@

it "allows attributes to be null" do
person = Person.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to eq(nil)
Expand Down Expand Up @@ -172,7 +172,7 @@

it "allows attributes to be unset" do
person = LazyPerson.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
Expand All @@ -198,15 +198,15 @@
it "allows attributes to be unset after reload" do
person = LazyPerson.create!(ssn: "123-45-6789")
person.reload
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
end

it "allows attributes to be blank" do
person = LazyPerson.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: "")
person.update!(ssn: "")
person.reload

expect(person.ssn).to eq("")
Expand Down Expand Up @@ -270,7 +270,7 @@

it "does not decrypt all attributes on single read" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.update_attributes!(credit_card: "abcd-efgh-hijk-lmno")
person.update!(credit_card: "abcd-efgh-hijk-lmno")
expect(person.credit_card).to eq("abcd-efgh-hijk-lmno")

person.reload
Expand All @@ -285,7 +285,7 @@

it "does not decrypt all attributes on single write" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.update_attributes!(credit_card: "abcd-efgh-hijk-lmno")
person.update!(credit_card: "abcd-efgh-hijk-lmno")
expect(person.credit_card).to eq("abcd-efgh-hijk-lmno")

person.reload
Expand Down Expand Up @@ -315,7 +315,7 @@

it "allows attributes to be unset" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
Expand All @@ -330,15 +330,15 @@
it "allows attributes to be unset after reload" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.reload
person.update_attributes!(ssn: nil)
person.update!(ssn: nil)
person.reload

expect(person.ssn).to be(nil)
end

it "allows attributes to be blank" do
person = LazySinglePerson.create!(ssn: "123-45-6789")
person.update_attributes!(ssn: "")
person.update!(ssn: "")
person.reload

expect(person.ssn).to eq("")
Expand Down Expand Up @@ -406,15 +406,15 @@

it "allows attributes to be unset" do
person = Person.create!(credit_card: "1234567890111213")
person.update_attributes!(credit_card: nil)
person.update!(credit_card: nil)
person.reload

expect(person.credit_card).to be(nil)
end

it "allows attributes to be blank" do
person = Person.create!(credit_card: "1234567890111213")
person.update_attributes!(credit_card: "")
person.update!(credit_card: "")
person.reload

expect(person.credit_card).to eq("")
Expand Down Expand Up @@ -457,15 +457,15 @@

it "allows attributes to be unset" do
person = Person.create!(non_ascii: "dás ümlaut")
person.update_attributes!(non_ascii: nil)
person.update!(non_ascii: nil)
person.reload

expect(person.non_ascii).to be(nil)
end

it "allows attributes to be blank" do
person = Person.create!(non_ascii: "dás ümlaut")
person.update_attributes!(non_ascii: "")
person.update!(non_ascii: "")
person.reload

expect(person.non_ascii).to eq("")
Expand Down

0 comments on commit 91228ba

Please sign in to comment.