👋 update_attributes

You served us well...
This commit is contained in:
Henne Vogelsang 2022-02-14 17:53:58 +01:00
parent ca80b753e7
commit 85dae98a76
No known key found for this signature in database
GPG key ID: 97DDB66BDAF8D4D6
46 changed files with 109 additions and 109 deletions

View file

@ -32,7 +32,7 @@ describe EmailSettings do
context 'user does not have name' do
before do
user.update_attributes(name: nil)
user.update(name: nil)
username_hash = { 'name' => 'johnd' }
expected_hash.merge!(username_hash)
end
@ -59,7 +59,7 @@ describe EmailSettings do
context 'conference has venue' do
before do
conference.update_attributes(venue: create(:venue))
conference.venue = create(:venue)
venue_hash = { 'venue' => conference.venue.name, 'venue_address' => conference.venue.address }
expected_hash.merge!(venue_hash)
end
@ -71,9 +71,9 @@ describe EmailSettings do
context 'conference has registration period' do
before do
conference.update_attributes(registration_period: create(:registration_period,
start_date: Date.new(2014, 05, 03),
end_date: Date.new(2014, 05, 05)))
conference.registration_period = create(:registration_period,
start_date: Date.new(2014, 05, 03),
end_date: Date.new(2014, 05, 05))
registration_period_hash = { 'registration_start_date' => Date.new(2014, 05, 03), 'registration_end_date' => Date.new(2014, 05, 05) }
expected_hash.merge!(registration_period_hash)
end

View file

@ -192,8 +192,8 @@ describe Program do
program.schedule_interval = 5
program.save!
program.event_types.first.update_attributes length: 5
program.event_types.last.update_attributes length: 25
program.event_types.first.update_attribute(:length, 5)
program.event_types.last.update_attribute(:length, 25)
create(:event_type, program: program, length: 30)
program.schedule_interval = 10

View file

@ -84,7 +84,7 @@ describe Ticket do
end
context 'user has paid' do
before { ticket_purchase.update_attributes(paid: true) }
before { ticket_purchase.update_attribute(:paid, true) }
it 'returns false' do
expect(ticket.unpaid?(user)).to eq(false)
@ -120,7 +120,7 @@ describe Ticket do
context 'user has paid' do
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) }
before { ticket_purchase.update_attributes(paid: true) }
before { ticket_purchase.update_attribute(:paid, true) }
it 'returns the correct value if the user has bought and paid for this ticket' do
expect(ticket.quantity_bought_by(user, paid: true)).to eq(20)
@ -145,7 +145,7 @@ describe Ticket do
context 'user has paid' do
let!(:ticket_purchase) { create(:ticket_purchase, user: user, ticket: ticket, quantity: 20) }
before { ticket_purchase.update_attributes(paid: true) }
before { ticket_purchase.update_attribute(:paid, true) }
it 'returns the correct value if the user has bought this ticket' do
expect(ticket.total_price(user, paid: true)).to eq(Money.new(100000, 'USD'))
@ -203,7 +203,7 @@ describe Ticket do
it 'should allow currency update' do
free_ticket = Ticket.first
expect { free_ticket.update_attributes(price_currency: 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR')
expect { free_ticket.update_attribute(:price_currency, 'INR') }.to change { free_ticket.reload.price_currency }.from('USD').to('INR')
end
end
end

View file

@ -118,7 +118,7 @@ describe User do
describe '#attended_event?' do
context 'user has attended to the event' do
before do
events_registration.update_attributes(attended: true)
events_registration.update_attribute(:attended, true)
end
it 'returns true' do
@ -201,7 +201,7 @@ describe User do
end
describe '.for_ichain_username' do
before { user.update_attributes(current_sign_in_at: Date.new(2014, 12, 12)) }
before { user.update_attribute(:current_sign_in_at, Date.new(2014, 12, 12)) }
context 'user exists' do
it 'updates last_sign_in_at of user' do
@ -220,7 +220,7 @@ describe User do
end
context 'user is disabled' do
before { user.update_attributes(is_disabled: true) }
before { user.update_attribute(:is_disabled, true) }
it 'User.for_ichain_username raises exception if user is disabled' do
expect{ User.for_ichain_username(user.username, email: user.email) }
@ -292,7 +292,7 @@ describe User do
let(:conf2_organizer_role) { Role.find_by(name: 'organizer', resource: conference2) }
before do
user.update_attributes(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
user.update_attribute(:role_ids, [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
end
it 'returns hash of role and conference' do
@ -351,7 +351,7 @@ describe User do
end
context 'unconfirmed user' do
before { user.update_attributes(confirmed_at: nil) }
before { user.update_attribute(:confirmed_at, nil) }
it 'returns false' do
expect(user.confirmed?).to eq false