👋 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

@ -53,7 +53,7 @@ module Admin
def update
@url = admin_conference_booth_path(@conference.short_title, @booth.id)
@booth.update_attributes(booth_params)
@booth.update(booth_params)
if @booth.save
redirect_to admin_conference_booths_path,

View file

@ -35,7 +35,7 @@ module Admin
send_mail_on_cfp_dates_updates = @cfp.notify_on_cfp_date_update?
if @cfp.update_attributes(cfp_params)
if @cfp.update(cfp_params)
ConferenceCfpUpdateMailJob.perform_later(@conference) if send_mail_on_cfp_dates_updates
redirect_to admin_conference_program_cfps_path(@conference.short_title),
notice: 'Call for papers successfully updated.'

View file

@ -91,7 +91,7 @@ module Admin
@conference.assign_attributes(conference_params)
send_mail_on_conf_update = @conference.notify_on_dates_changed?
if @conference.update_attributes(conference_params)
if @conference.update(conference_params)
ConferenceDateUpdateMailJob.perform_later(@conference) if send_mail_on_conf_update
redirect_to edit_admin_conference_path(id: @conference.short_title),
notice: 'Conference was successfully updated.'

View file

@ -28,7 +28,7 @@ module Admin
end
def update
if @difficulty_level.update_attributes(difficulty_level_params)
if @difficulty_level.update(difficulty_level_params)
redirect_to admin_conference_program_difficulty_levels_path(conference_id: @conference.short_title),
notice: 'Difficulty level successfully updated.'
else

View file

@ -26,7 +26,7 @@ module Admin
end
def update
if @event_type.update_attributes(event_type_params)
if @event_type.update(event_type_params)
redirect_to admin_conference_program_event_types_path(conference_id: @conference.short_title),
notice: 'Event type successfully updated.'
else

View file

@ -72,7 +72,7 @@ module Admin
def update
@languages = @program.languages_list
if @event.update_attributes(event_params)
if @event.update(event_params)
if request.xhr?
render js: 'index'
@ -142,7 +142,7 @@ module Admin
@votes = @event.votes.includes(:user)
if (votes = current_user.votes.find_by_event_id(params[:id]))
votes.update_attributes(rating: params[:rating])
votes.update(rating: params[:rating])
else
@myvote = @event.votes.build
@myvote.user = current_user

View file

@ -26,7 +26,7 @@ module Admin
def edit; end
def update
if @lodging.update_attributes(lodging_params)
if @lodging.update(lodging_params)
redirect_to admin_conference_lodgings_path(conference_id: @conference.short_title),
notice: 'Lodging successfully updated.'
else

View file

@ -27,7 +27,7 @@ module Admin
def edit; end
def update
if @organization.update_attributes(organization_params)
if @organization.update(organization_params)
redirect_to admin_organizations_path,
notice: 'Organization successfully updated'
else

View file

@ -16,7 +16,7 @@ module Admin
send_mail_on_schedule_public = @program.notify_on_schedule_public?
event_schedules_count_was = @program.event_schedules.count
if @program.update_attributes(program_params)
if @program.update(program_params)
ConferenceScheduleUpdateMailJob.perform_later(@conference) if send_mail_on_schedule_public
respond_to do |format|
format.html do

View file

@ -48,7 +48,7 @@ module Admin
# PUT questions/1
def update
if @question.update_attributes(question_params)
if @question.update(question_params)
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Question '#{@question.title}' for #{@conference.short_title} successfully updated."
else
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed. #{@question.errors.full_messages.join('. ')}"
@ -58,7 +58,7 @@ module Admin
# Update questions used for the conference
def update_conference
authorize! :update, Question.new(conference_id: @conference.id)
if @conference.update_attributes(conference_params)
if @conference.update(conference_params)
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Questions for #{@conference.short_title} successfully updated."
else
redirect_to admin_conference_questions_path(conference_id: @conference.short_title), notice: "Update of questions for #{@conference.short_title} failed."

View file

@ -37,9 +37,9 @@ module Admin
def edit; end
def update
@user.update_attributes(user_params)
@user.update(user_params)
@registration.update_attributes(registration_params)
@registration.update(registration_params)
if @registration.save
redirect_to admin_conference_registrations_path(@conference.short_title),
notice: "Successfully updated registration for #{@registration.user.email}!"

View file

@ -25,7 +25,7 @@ module Admin
end
def update
if @resource.update_attributes(resource_params)
if @resource.update(resource_params)
redirect_to admin_conference_resources_path(conference_id: @conference.short_title),
notice: 'Resource successfully updated.'
else

View file

@ -36,7 +36,7 @@ module Admin
def update
role_name = @role.name
if @role.update_attributes(role_params)
if @role.update(role_params)
url = if @track
admin_conference_program_track_role_path(@conference.short_title, @track, @role.name)
else

View file

@ -26,7 +26,7 @@ module Admin
end
def update
if @room.update_attributes(room_params)
if @room.update(room_params)
redirect_to admin_conference_venue_rooms_path(conference_id: @conference.short_title),
notice: 'Room successfully updated.'
else

View file

@ -25,7 +25,7 @@ module Admin
end
def update
if @splashpage.update_attributes(splashpage_params)
if @splashpage.update(splashpage_params)
redirect_to admin_conference_splashpage_path,
notice: 'Splashpage successfully updated.'
else

View file

@ -28,7 +28,7 @@ module Admin
end
def update
if @sponsor.update_attributes(sponsor_params)
if @sponsor.update(sponsor_params)
redirect_to admin_conference_sponsors_path(
conference_id: @conference.short_title),
notice: 'Sponsor successfully updated.'

View file

@ -27,7 +27,7 @@ module Admin
end
def update
if @sponsorship_level.update_attributes(sponsorship_level_params)
if @sponsorship_level.update(sponsorship_level_params)
redirect_to admin_conference_sponsorship_levels_path(
conference_id: @conference.short_title),
notice: 'Sponsorship level successfully updated.'

View file

@ -28,7 +28,7 @@ module Admin
# PUT questions/1
def update
if @survey_question.update_attributes(survey_question_params)
if @survey_question.update(survey_question_params)
redirect_to admin_conference_survey_path(@conference.short_title, @survey), notice: 'Successfully updated Survey Question.'
else
@url = admin_conference_survey_survey_question_path(@conference.short_title, @survey, @survey_question)

View file

@ -28,7 +28,7 @@ module Admin
end
def update
if @survey.update_attributes(survey_params)
if @survey.update(survey_params)
redirect_to admin_conference_surveys_path(@conference.short_title)
else
@url = admin_conference_survey_path(@conference.short_title, @survey)

View file

@ -29,7 +29,7 @@ module Admin
def edit; end
def update
if @ticket.update_attributes(ticket_params)
if @ticket.update(ticket_params)
redirect_to admin_conference_tickets_path(conference_id: @conference.short_title),
notice: 'Ticket successfully updated.'
else

View file

@ -56,7 +56,7 @@ module Admin
def edit; end
def update
if @track.update_attributes(track_params)
if @track.update(track_params)
redirect_to admin_conference_program_tracks_path(conference_id: @conference.short_title),
notice: 'Track successfully updated.'
else
@ -122,7 +122,7 @@ module Admin
end
def update_selected_schedule
if @track.update_attributes(params.require(:track).permit(:selected_schedule_id))
if @track.update(params.require(:track).permit(:selected_schedule_id))
respond_to do |format|
format.js { render json: {} }
end

View file

@ -56,7 +56,7 @@ module Admin
end
end
if @user.update_attributes(user_params)
if @user.update(user_params)
redirect_to admin_users_path, notice: "Updated #{@user.name} (#{@user.email})!" + message
else
redirect_to admin_users_path, error: "Could not update #{@user.name} (#{@user.email}). #{@user.errors.full_messages.join('. ')}."

View file

@ -25,7 +25,7 @@ module Admin
end
def update
if @venue.update_attributes(venue_params)
if @venue.update(venue_params)
redirect_to admin_conference_venue_path(conference_id: @conference.short_title),
notice: 'Venue was successfully updated.'
else

View file

@ -26,7 +26,7 @@ module Admin
end
def update
if @conference.update_attributes(conference_params)
if @conference.update(conference_params)
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), notice: 'Volunteering options were successfully updated.'
else
redirect_to admin_conference_volunteers_info_path(conference_id: params[:conference_id]), error: "Volunteering options update failed: #{@conference.errors.full_messages.join '. '}"

View file

@ -36,7 +36,7 @@ class BoothsController < ApplicationController
def update
@url = conference_booth_path(@conference.short_title, @booth.id)
@booth.update_attributes(booth_params)
@booth.update(booth_params)
if @booth.save
redirect_to conference_booths_path,

View file

@ -72,7 +72,7 @@ class ConferenceRegistrationsController < ApplicationController
end
def update
if @registration.update_attributes(registration_params)
if @registration.update(registration_params)
redirect_to conference_conference_registration_path(@conference.short_title),
notice: 'Registration was successfully updated.'
else

View file

@ -27,14 +27,14 @@ class SurveysController < ApplicationController
reply_text = survey_submission[survey_question.id.to_s].reject(&:blank?).join(',')
if reply
reply.update_attributes(text: reply_text) unless reply.text == reply_text
reply.update(text: reply_text) unless reply.text == reply_text
else
survey_question.survey_replies.create!(text: reply_text, user: current_user)
end
user_survey_submission = @survey.survey_submissions.find_by(user: current_user)
if user_survey_submission
user_survey_submission.update_attributes(updated_at: Time.current)
user_survey_submission.update_attribute(:updated_at, Time.current)
else
@survey.survey_submissions.create!(user: current_user)
end

View file

@ -31,7 +31,7 @@ class TracksController < ApplicationController
end
def update
if @track.update_attributes(track_params)
if @track.update(track_params)
redirect_to conference_program_tracks_path(conference_id: @conference.short_title),
notice: 'Track request successfully updated.'
else

View file

@ -268,7 +268,7 @@ class Program < ApplicationRecord
def normalize_event_types_length
event_types.each do |event_type|
new_length = event_type.length > schedule_interval ? event_type.length - (event_type.length % schedule_interval) : schedule_interval
event_type.update_attributes length: new_length
event_type.update_attribute(:length, new_length)
end
end
end

View file

@ -77,7 +77,7 @@ class TicketPurchase < ApplicationRecord
end
def pay(payment)
update_attributes(paid: true, payment: payment)
update(paid: true, payment: payment)
PhysicalTicket.transaction do
quantity.times { physical_tickets.create }
end

View file

@ -156,9 +156,9 @@ class User < ApplicationRecord
raise UserDisabled if user&.is_disabled
if user
user.update_attributes(email: attributes[:email],
last_sign_in_at: user.current_sign_in_at,
current_sign_in_at: Time.current)
user.update(email: attributes[:email],
last_sign_in_at: user.current_sign_in_at,
current_sign_in_at: Time.current)
else
begin
user = create!(username: username, email: attributes[:email])

View file

@ -6,7 +6,7 @@ namespace :data do
task demo: :environment do
include FactoryBot::Syntax::Methods
conference = create(:full_conference, title: 'Open Source Event Manager Demo', short_title: 'osemdemo' ,description: "This is a [Open Source Event Manager](http://osem.io/) demo instance. You can log in as **admin** with the password **password123** or just you just [sign up](/accounts/sign_up) with your own user. We hope you enjoy checking out all the functionality, if you have questions don't hesitate to [contact us](http://osem.io/#contact)!\r\n\r\n## Data will be destroyed every thirty minutes or whenever someone updates the [OSEM source code on github](https://github.com/openSUSE/osem/commits/master).")
conference.contact.update_attributes(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io')
conference.contact.update(email: 'osemdemo@osem.io', sponsor_email: 'osemdemo@osem.io')
create(:admin, email: 'admin@osem.io', username: 'admin', password: 'password123', password_confirmation: 'password123')
end
end

View file

@ -36,7 +36,7 @@ namespace :data do
selected_schedule = create(:schedule, program: program)
demo_schedule = create(:schedule, program: program)
program.update_attributes!(selected_schedule: selected_schedule)
program.update_attribute(:selected_schedule, selected_schedule)
create(:event, program: program, title: 'Demo Event', abstract: 'This is a demo event instance whose state not defined.')
create(:event, program: program, title: 'Demo Rejected Event', state: 'rejected', abstract: 'This is demo event instance in a rejected state.')
@ -72,9 +72,9 @@ namespace :data do
# So that events can be created without any failure in validations.
conference = create(:full_conference, title: 'Jangouts Demo Conference', short_title: 'jangouts', start_date: 7.days.ago, end_date: 6.days.from_now, start_hour: 15, end_hour: 20, description: 'This is a full conference demo instance happened in the past. It contains open cfp, venue/rooms, submitted talks by multiple speakers, partly confirmed talks and multiple schedules.')
generate_program conference
conference.program.cfp.update_attributes!(start_date: 4.days.ago, end_date: 2.days.ago)
conference.update_attributes!(end_date: 1.day.ago)
conference.registration_period.update_attributes!(start_date: 9.days.ago, end_date: 8.days.ago)
conference.program.cfp.update!(start_date: 4.days.ago, end_date: 2.days.ago)
conference.update_attribute!(:end_date, 1.day.ago)
conference.registration_period.update!(start_date: 9.days.ago, end_date: 8.days.ago)
# This is a conference that will happen in the future
# It only has a registration period and unscheduled events

View file

@ -7,7 +7,7 @@ namespace :data do
PaperTrail::Version.where(conference_id: nil, item_type: %w[Conference Event]).each do |version|
# All pre-existing versions are either of Conference or Event
if version.item_type == 'Conference'
version.update_attributes(conference_id: version.item_id)
version.update_attribute(:conference_id, version.item_id)
elsif version.item_type == 'Event'
event = version.item
@ -30,7 +30,7 @@ namespace :data do
puts "Setting conference_id value failed for PaperTrail::Version object with ID=#{version.id}"
nil
end
version.update_attributes(conference_id: conference_id)
version.update_attribute(:conference_id, conference_id)
end
end
puts 'All done!'

View file

@ -17,7 +17,7 @@ describe Admin::VersionsController do
end
it 'reverts all changes for update actions' do
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
conference.update(short_title: 'testtitle', description: 'Some random text')
get :revert_object, params: { id: conference.versions.last.id }
conference.reload
expect(conference.short_title).to eq 'exampletitle'
@ -62,7 +62,7 @@ describe Admin::VersionsController do
end
it 'reverts specified change for update actions' do
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
conference.update(short_title: 'testtitle', description: 'Some random text')
get :revert_attribute, params: { id: conference.versions.last.id, attribute: 'short_title' }
conference.reload
expect(conference.short_title).to eq 'exampletitle'
@ -70,8 +70,8 @@ describe Admin::VersionsController do
end
it 'shows correct flash on trying to revert to the current state' do
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
conference.update_attributes(short_title: 'exampletitle')
conference.update(short_title: 'testtitle', description: 'Some random text')
conference.update_attribute(:short_title, 'exampletitle')
get :revert_attribute, params: { id: conference.versions[-2].id, attribute: 'short_title' }
expect(flash[:error]).to match('The item is already in the state that you are trying to revert it back to')
expect(conference.short_title).to eq 'exampletitle'
@ -79,7 +79,7 @@ describe Admin::VersionsController do
it 'fails on trying to revert deleted object' do
event_type = conference.program.event_types.first
event_type.update_attributes(title: 'New Event Title')
event_type.update_attribute(:title, 'New Event Title')
event_type.destroy
get :revert_attribute, params: { id: event_type.versions[-2].id, attribute: 'title' }
conference.reload
@ -93,7 +93,7 @@ describe Admin::VersionsController do
end
it 'revert fails when attribute is invalid' do
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
conference.update(short_title: 'testtitle', description: 'Some random text')
before_conference_title = conference.title
# Note: even though title is a valid attribute of conference, it was not updated in the change we are trying to revert
get :revert_attribute, params: { id: conference.versions.last.id, attribute: 'title' }
@ -117,12 +117,12 @@ describe Admin::VersionsController do
before :each do
@user = create(:user)
conference.update_attributes(short_title: 'testtitle', description: 'Some random text')
conference.update(short_title: 'testtitle', description: 'Some random text')
@version_organizer = conference.versions.last
cfp = create(:cfp, program: conference.program)
@version_cfp = cfp.versions.last
registration = create(:registration, conference: conference)
registration.update_attributes(attended: true)
registration.update_attribute(:attended, true)
@version_info_desk = registration.versions.last
end

View file

@ -316,7 +316,7 @@ describe ConferenceRegistrationsController, type: :controller do
context 'update fails' do
before do
allow_any_instance_of(Registration).to receive(:update_attributes).and_return(false)
allow_any_instance_of(Registration).to receive(:update).and_return(false)
patch :update, params: {
registration: attributes_for(:registration, volunteer: true),
conference_id: conference.short_title

View file

@ -415,7 +415,7 @@ describe ProposalsController do
end
describe 'PATCH #confirm' do
before { event.update_attributes(state: 'unconfirmed') }
before { event.update_attribute(:state, 'unconfirmed') }
context 'confirmed successfully' do
describe 'when require_registration is set' do
@ -501,7 +501,7 @@ describe ProposalsController do
context 'event save fails' do
before do
event.update_attributes(state: 'unconfirmed')
event.update_attribute(:state, 'unconfirmed')
allow_any_instance_of(Event).to receive(:save).and_return(false)
patch :confirm, params: { conference_id: conference.short_title, id: event.id }
end
@ -521,7 +521,7 @@ describe ProposalsController do
end
describe 'PATCH #restart' do
before { event.update_attributes(state: 'withdrawn') }
before { event.update_attribute(:state, 'withdrawn') }
it 'assigns url variable' do
patch :restart, params: { conference_id: conference.short_title, id: event.id }

View file

@ -33,7 +33,7 @@ FactoryBot.define do
# Contact/Program is created by Conference callbacks
conference.contact.destroy
conference.contact = create(:contact, conference: conference)
conference.program.update_attributes(schedule_public: true)
conference.program.update_attribute(:schedule_public, true)
create(:cfp, program: conference.program)
create_list(:track, 2, program: conference.program)

View file

@ -35,7 +35,7 @@ feature 'Version' do
end
scenario 'display changes in cfp', feature: true, versioning: true, js: true do
cfp.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
cfp.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
cfp_id = cfp.id
cfp.destroy
@ -47,7 +47,7 @@ feature 'Version' do
scenario 'display changes in registration_period', feature: true, versioning: true, js: true do
registration_period = create(:registration_period, conference: conference)
registration_period.update_attributes(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
registration_period.update(start_date: (Time.zone.today + 1).strftime('%d/%m/%Y'), end_date: (Time.zone.today + 3).strftime('%d/%m/%Y'))
registration_period_id = registration_period.id
registration_period.destroy
@ -60,7 +60,7 @@ feature 'Version' do
scenario 'display changes in conference', feature: true, versioning: true, js: true do
new_conference = create(:conference, title: 'Test Conference')
organizer.add_role :organizer, new_conference
new_conference.update_attributes(title: 'New Con', short_title: 'NewCon')
new_conference.update(title: 'New Con', short_title: 'NewCon')
visit admin_revision_history_path
select '100', from: 'versionstable_length'
@ -72,7 +72,7 @@ feature 'Version' do
scenario 'display changes in event_type', feature: true, versioning: true, js: true do
event_type = create(:event_type, program: conference.program, name: 'Discussion')
event_type.update_attributes(length: 90, maximum_abstract_length: 10000)
event_type.update(length: 90, maximum_abstract_length: 10000)
event_type_id = event_type.id
event_type.destroy
@ -84,7 +84,7 @@ feature 'Version' do
scenario 'display changes in lodging', feature: true, versioning: true, js: true do
lodging = create(:lodging, conference: conference, name: 'Hotel XYZ')
lodging.update_attributes(description: 'Nice view,close to venue', website_link: 'http://www.example.com')
lodging.update(description: 'Nice view,close to venue', website_link: 'http://www.example.com')
lodging_id = lodging.id
lodging.destroy
@ -106,7 +106,7 @@ feature 'Version' do
scenario 'display changes in room', feature: true, versioning: true, js: true do
venue = create(:venue, conference: conference)
room = create(:room, venue: venue, name: 'Auditorium')
room.update_attributes(size: 120)
room.update_attribute(:size, 120)
room_id = room.id
room.destroy
@ -119,7 +119,7 @@ feature 'Version' do
scenario 'display changes in sponsor', feature: true, versioning: true, js: true do
conference.sponsorship_levels << create_list(:sponsorship_level, 2, conference: conference)
sponsor = create(:sponsor, conference: conference, name: 'SUSE', sponsorship_level: conference.sponsorship_levels.first)
sponsor.update_attributes(website_url: 'https://www.suse.com/company/history', sponsorship_level: conference.sponsorship_levels.second)
sponsor.update(website_url: 'https://www.suse.com/company/history', sponsorship_level: conference.sponsorship_levels.second)
sponsor.destroy
sponsor_id = sponsor.id
@ -131,7 +131,7 @@ feature 'Version' do
scenario 'display changes in sponsorship_level', feature: true, versioning: true, js: true do
sponsorship_level = create(:sponsorship_level, conference: conference)
sponsorship_level.update_attributes(title: 'Gold')
sponsorship_level.update_attribute(:title, 'Gold')
sponsorship_level_id = sponsorship_level.id
sponsorship_level.destroy
@ -143,7 +143,7 @@ feature 'Version' do
scenario 'display changes in ticket', feature: true, versioning: true, js: true do
ticket = create(:ticket, conference: conference, title: 'Gold')
ticket.update_attributes(price: 50, description: 'Premium Ticket')
ticket.update(price: 50, description: 'Premium Ticket')
ticket_id = ticket.id
ticket.destroy
@ -155,7 +155,7 @@ feature 'Version' do
scenario 'display changes in track', feature: true, versioning: true, js: true do
track = create(:track, program: conference.program, name: 'Distribution')
track.update_attributes(description: 'Events about Linux distributions')
track.update_attribute(:description, 'Events about Linux distributions')
track_id = track.id
track.destroy
@ -167,7 +167,7 @@ feature 'Version' do
scenario 'display changes in venue', feature: true, versioning: true, js: true do
venue = create(:venue, conference: conference, name: 'Example University')
venue.update_attributes(website: 'www.example.com new', description: 'Just another beautiful venue')
venue.update(website: 'www.example.com new', description: 'Just another beautiful venue')
venue_id = venue.id
venue.destroy
@ -221,7 +221,7 @@ feature 'Version' do
scenario 'display changes in difficulty levels', feature: true, versioning: true, js: true do
difficulty_level = create(:difficulty_level, program: conference.program, title: 'Expert')
difficulty_level.update_attributes(description: 'Only for Experts')
difficulty_level.update_attribute(:description, 'Only for Experts')
difficulty_level_id = difficulty_level.id
difficulty_level.destroy
@ -273,7 +273,7 @@ feature 'Version' do
scenario 'display changes in conference commercials', feature: true, versioning: true, js: true do
conference_commercial = create(:conference_commercial, commercialable: conference)
conference_commercial.update_attributes(url: 'https://www.youtube.com/watch?v=VNkDJk5_9eU')
conference_commercial.update_attribute(:url, 'https://www.youtube.com/watch?v=VNkDJk5_9eU')
conference_commercial.destroy
visit admin_revision_history_path
@ -284,7 +284,7 @@ feature 'Version' do
scenario 'display changes in event commercials', feature: true, versioning: true, js: true do
event_commercial
event_commercial.update_attributes(url: 'https://www.youtube.com/watch?v=VNkDJk5_9eU')
event_commercial.update_attribute(:url, 'https://www.youtube.com/watch?v=VNkDJk5_9eU')
event_commercial.destroy
visit admin_revision_history_path
@ -354,7 +354,7 @@ feature 'Version' do
end
scenario 'display changes in email settings', feature: true, versioning: true, js: true do
conference.email_settings.update_attributes(registration_subject: 'xxxxx', registration_body: 'yyyyy', accepted_subject: 'zzzzz')
conference.email_settings.update(registration_subject: 'xxxxx', registration_body: 'yyyyy', accepted_subject: 'zzzzz')
visit admin_revision_history_path
expect(page).to have_text("Someone (probably via the console) updated registration body, registration subject and accepted subject of email settings in conference #{conference.short_title}")
@ -374,7 +374,7 @@ feature 'Version' do
registration = Registration.create(user: organizer, conference: conference)
event = create(:event, program: conference.program, title: 'My second event')
EventsRegistration.create(registration: registration, event: event)
EventsRegistration.first.update_attributes(attended: true)
EventsRegistration.first.update_attribute(:attended, true)
EventsRegistration.last.destroy
# Here registration is deleted to ensure the event registration related change still displays the associated user's name
registration.destroy
@ -433,7 +433,7 @@ feature 'Version' do
scenario 'display updates to user', feature: true, versioning: true, js: true do
user = create(:user)
user.update_attributes(nickname: 'testnick', affiliation: 'openSUSE')
user.update(nickname: 'testnick', affiliation: 'openSUSE')
visit admin_revision_history_path
expect(page).to have_text("Someone (probably via the console) updated nickname and affiliation of user #{user.name}")

View file

@ -29,7 +29,7 @@ describe ApplicationHelper, type: :helper do
before :each do
@other_event = create(:event, program: conference.program, state: 'confirmed')
schedule = create(:schedule, program: conference.program)
conference.program.update_attributes!(selected_schedule: schedule)
conference.program.update_attribute(:selected_schedule, schedule)
@event_schedule = create(:event_schedule, event: event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule)
@other_event_schedule = create(:event_schedule, event: @other_event, start_time: conference.start_date + conference.start_hour.hours, room: create(:room), schedule: schedule)
end
@ -40,7 +40,7 @@ describe ApplicationHelper, type: :helper do
end
it 'when event is in between the other event' do
@event_schedule.update_attributes!(start_time: @other_event_schedule.start_time + 10.minutes)
@event_schedule.update_attribute(:start_time, @other_event_schedule.start_time + 10.minutes)
expect(concurrent_events(event).include?(@other_event)).to eq true
end
end
@ -52,12 +52,12 @@ describe ApplicationHelper, type: :helper do
end
it 'when one event starts and other ends at the same time' do
@event_schedule.update_attributes!(start_time: @other_event_schedule.end_time)
@event_schedule.update_attribute(:start_time, @other_event_schedule.end_time)
expect(concurrent_events(event).present?).to eq false
end
it 'when conference program does not have a selected schedule' do
conference.program.update_attributes!(selected_schedule_id: nil)
conference.program.update_attribute(:selected_schedule_id, nil)
expect(concurrent_events(event).present?).to eq false
end
end
@ -83,7 +83,7 @@ describe ApplicationHelper, type: :helper do
context 'first sponsorship_level' do
before do
first_sponsorship_level = create(:sponsorship_level, position: 1)
sponsor.update_attributes(sponsorship_level: first_sponsorship_level)
sponsor.update_attribute(:sponsorship_level, first_sponsorship_level)
end
it 'returns correct url' do
@ -94,7 +94,7 @@ describe ApplicationHelper, type: :helper do
context 'second sponsorship_level' do
before do
second_sponsorship_level = create(:sponsorship_level, position: 2)
sponsor.update_attributes(sponsorship_level: second_sponsorship_level)
sponsor.update_attribute(:sponsorship_level, second_sponsorship_level)
end
it 'returns correct url' do
@ -105,7 +105,7 @@ describe ApplicationHelper, type: :helper do
context 'other sponsorship_level' do
before do
other_sponsorship_level = create(:sponsorship_level, position: 3)
sponsor.update_attributes(sponsorship_level: other_sponsorship_level)
sponsor.update_attribute(:sponsorship_level, other_sponsorship_level)
end
it 'returns correct url' do

View file

@ -7,7 +7,7 @@ describe Mailbot do
let!(:email_settings) { create(:email_settings, conference: conference) }
let(:user) { create(:user, email: 'user@example.com') }
before { conference.contact.update_attributes(email: 'conf@domain.com') }
before { conference.contact.update_attribute(:email, 'conf@domain.com') }
context 'onboarding and proposal' do
let(:event) { create(:event, program: conference.program, submitter: user) }
@ -39,9 +39,9 @@ describe Mailbot do
describe '.acceptance_mail' do
before do
conference.email_settings.update_attributes(send_on_accepted: true,
accepted_subject: 'Lorem Ipsum Dolsum',
accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
conference.email_settings.update(send_on_accepted: true,
accepted_subject: 'Lorem Ipsum Dolsum',
accepted_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
end
include_examples 'mailer actions' do
@ -51,9 +51,9 @@ describe Mailbot do
describe '.rejection_mail' do
before do
conference.email_settings.update_attributes(send_on_rejected: true,
rejected_subject: 'Lorem Ipsum Dolsum',
rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
conference.email_settings.update(send_on_rejected: true,
rejected_subject: 'Lorem Ipsum Dolsum',
rejected_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
end
include_examples 'mailer actions' do
@ -63,9 +63,9 @@ describe Mailbot do
describe '.confirm_reminder_mail' do
before do
conference.email_settings.update_attributes(send_on_confirmed_without_registration: true,
confirmed_without_registration_subject: 'Lorem Ipsum Dolsum',
confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
conference.email_settings.update(send_on_confirmed_without_registration: true,
confirmed_without_registration_subject: 'Lorem Ipsum Dolsum',
confirmed_without_registration_body: 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit')
end
include_examples 'mailer actions' do

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

View file

@ -18,7 +18,7 @@ describe SpeakerSerializer, type: :serializer do
end
context 'speaker has biography' do
before{ speaker.update_attributes(biography: 'Doest of all Jon Does') }
before{ speaker.update_attribute(:biography, 'Doest of all Jon Does') }
it 'sets name, affiliation and biography' do
expected_json = {