diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-20 23:55:13 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2022-07-20 23:59:30 +0300 |
commit | 2e3bd14a09197a662f0aa9e6d406d0a1d82a0618 (patch) | |
tree | f98478024ef37de93c3f620506de67110b57d487 | |
parent | 3c4da76be52d48bb6f2646cc269cc47c5298f2bc (diff) |
Fix some update_attributes in tests only on next-minor
These were already fixed on develop in another branch but were never
backported, so lets do that now.
-rw-r--r-- | features/step_definitions/user_steps.rb | 8 | ||||
-rw-r--r-- | spec/models/person_spec.rb | 16 | ||||
-rw-r--r-- | spec/models/reshare_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/user_spec.rb | 4 |
4 files changed, 15 insertions, 15 deletions
diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 804642cae..a843c1b12 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -18,13 +18,13 @@ end Given /^a user named "([^\"]*)" with email "([^\"]*)"$/ do |name, email| first, last = name.split - user = create_user(:email => email, :username => "#{first}_#{last}") - user.profile.update_attributes!(:first_name => first, :last_name => last) if first + user = create_user(email: email, username: "#{first}_#{last}") + user.profile.update!(first_name: first, last_name: last) if first end Given /^a nsfw user with email "([^\"]*)"$/ do |email| - user = create_user(:email => email) - user.profile.update_attributes(:nsfw => true) + user = create_user(email: email) + user.profile.update(nsfw: true) end Given /^a moderator with email "([^\"]*)"$/ do |email| diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 8087506d8..a40047d0a 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -203,7 +203,7 @@ describe Person, :type => :model do describe "delegating" do it "delegates last_name to the profile" do expect(@person.last_name).to eq(@person.profile.last_name) - @person.profile.update_attributes(:last_name => "Heathers") + @person.profile.update(last_name: "Heathers") expect(@person.reload.last_name).to eq("Heathers") end end @@ -370,18 +370,18 @@ describe Person, :type => :model do end describe "#first_name" do - it 'returns username if first_name is not present in profile' do - alice.person.profile.update_attributes(:first_name => "") + it "returns username if first_name is not present in profile" do + alice.person.profile.update(first_name: "") expect(alice.person.first_name).to eq(alice.username) end - it 'returns first words in first_name if first_name is present' do - alice.person.profile.update_attributes(:first_name => "First Mid Last") + it "returns first words in first_name if first_name is present" do + alice.person.profile.update(first_name: "First Mid Last") expect(alice.person.first_name).to eq("First Mid") end - it 'returns first word in first_name if first_name is present' do - alice.person.profile.update_attributes(:first_name => "Alice") + it "returns first word in first_name if first_name is present" do + alice.person.profile.update(first_name: "Alice") expect(alice.person.first_name).to eq("Alice") end end @@ -591,7 +591,7 @@ describe Person, :type => :model do end it "handles broken keys and returns nil" do - @person.update_attributes(serialized_public_key: "broken") + @person.update(serialized_public_key: "broken") expect(@person.public_key).to be_nil end end diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index 39cbbcbf2..97593c115 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -26,7 +26,7 @@ describe Reshare, type: :model do reshare1 = FactoryGirl.create(:reshare, author: alice.person) reshare2 = FactoryGirl.create(:reshare, author: alice.person) - reshare1.update_attributes(root_guid: nil) + reshare1.update(root_guid: nil) reshare2.root_guid = nil expect(reshare2).to be_valid diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6a41d3472..6b026300b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -302,8 +302,8 @@ describe User, :type => :model do end it "resets a matching unconfirmed_email and confirm_email_token on save" do - eve.update_attributes(unconfirmed_email: "new@example.com", confirm_email_token: SecureRandom.hex(15)) - alice.update_attribute(:email, "new@example.com") + eve.update(unconfirmed_email: "new@example.com", confirm_email_token: SecureRandom.hex(15)) + alice.update(email: "new@example.com") eve.reload expect(eve.unconfirmed_email).to eql(nil) expect(eve.confirm_email_token).to eql(nil) |