This commit is contained in:
Aditya Chatterjee 2016-02-27 17:03:43 +05:30
parent 28e55f3f50
commit a5a2db4077
156 changed files with 3203 additions and 1206 deletions

View file

@ -2,11 +2,11 @@ require 'spec_helper'
feature 'Has correct abilities' do
# It is necessary to use bang version of let to build roles before user
let(:conference1) { create(:conference) } # user is organizer
let(:conference2) { create(:conference) } # user is cfp
let(:conference3) { create(:conference) } # user is info_desk
let(:conference4) { create(:conference) } # user is volunteer coordinator
let(:conference5) { create(:conference) } # user has no role
let(:conference1) { create(:full_conference) } # user is organizer
let(:conference2) { create(:full_conference) } # user is cfp
let(:conference3) { create(:full_conference) } # user is info_desk
let(:conference4) { create(:full_conference) } # user is volunteer coordinator
let(:conference5) { create(:full_conference) } # user has no role
let(:role_organizer) { create(:role, name: 'organizer', resource: conference1) }
let(:role_cfp) { create(:role, name: 'cfp', resource: conference2) }
@ -37,22 +37,23 @@ feature 'Has correct abilities' do
expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit")
expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/events")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference1.short_title}/schedule")
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns")
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/rooms")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/venue/rooms")
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings")
expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels")
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors")
expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles")
@ -65,8 +66,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference1.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference1.short_title))
visit admin_conference_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_events_path(conference1.short_title))
visit admin_conference_program_events_path(conference1.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference1.short_title))
visit admin_conference_schedule_path(conference1.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference1.short_title))
@ -93,8 +94,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference1.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference1.short_title))
visit new_admin_conference_call_for_paper_path(conference1.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference1.short_title))
visit new_admin_conference_program_cfp_path(conference1.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference1.short_title))
visit admin_conference_questions_path(conference1.short_title)
expect(current_path).to eq(admin_conference_questions_path(conference1.short_title))
@ -113,22 +114,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/events")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/program/events")
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations")
expect(page).to have_link('Schedule', href: "/admin/conference/#{conference2.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/rooms")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/venue/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/call_for_paper")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/difficulty_levels")
expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/program/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles")
@ -141,8 +143,8 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference2.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference2.short_title))
visit admin_conference_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_events_path(conference2.short_title))
visit admin_conference_program_events_path(conference2.short_title)
expect(current_path).to eq(admin_conference_program_events_path(conference2.short_title))
visit admin_conference_schedule_path(conference2.short_title)
expect(current_path).to eq(admin_conference_schedule_path(conference2.short_title))
@ -165,8 +167,8 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference2.short_title)
expect(current_path).to eq(admin_conference_emails_path(conference2.short_title))
visit new_admin_conference_call_for_paper_path(conference2.short_title)
expect(current_path).to eq(new_admin_conference_call_for_paper_path(conference2.short_title))
visit new_admin_conference_program_cfp_path(conference2.short_title)
expect(current_path).to eq(new_admin_conference_program_cfp_path(conference2.short_title))
visit admin_conference_questions_path(conference2.short_title)
expect(current_path).to eq(root_path)
@ -185,22 +187,23 @@ feature 'Has correct abilities' do
expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/events")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations")
expect(page).to_not have_link('Schedule', href: "/admin/conference/#{conference3.short_title}/schedule")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets")
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/rooms")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/venue/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels")
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/call_for_paper")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/difficulty_levels")
expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/program/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions")
expect(page).to_not have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles")
@ -213,7 +216,7 @@ feature 'Has correct abilities' do
visit admin_conference_registrations_path(conference3.short_title)
expect(current_path).to eq(admin_conference_registrations_path(conference3.short_title))
visit admin_conference_events_path(conference3.short_title)
visit admin_conference_program_events_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit admin_conference_schedule_path(conference3.short_title)
@ -237,7 +240,7 @@ feature 'Has correct abilities' do
visit admin_conference_emails_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit new_admin_conference_call_for_paper_path(conference3.short_title)
visit new_admin_conference_program_cfp_path(conference3.short_title)
expect(current_path).to eq(root_path)
visit admin_conference_questions_path(conference3.short_title)

View file

@ -8,13 +8,13 @@ feature Conference do
shared_examples 'add and update cfp' do
scenario 'adds a new cfp', feature: true, js: true do
expected_count = CallForPaper.count + 1
expected_count = Cfp.count + 1
sign_in organizer
visit new_admin_conference_call_for_paper_path(conference.short_title)
visit new_admin_conference_program_cfp_path(conference.short_title)
click_button 'Create Call for paper'
click_button 'Create Cfp'
expect(flash).
to eq('Creating the call for papers failed. ' +
@ -26,32 +26,29 @@ feature Conference do
page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 6).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '4'
click_button 'Create Call for paper'
click_button 'Create Cfp'
# Validations
expect(flash).
to eq('Call for papers successfully created.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 6).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('4')
expect(CallForPaper.count).to eq(expected_count)
expect(Cfp.count).to eq(expected_count)
end
scenario 'update cfp', feature: true, js: true do
conference.call_for_paper = create(:call_for_paper)
expected_count = CallForPaper.count
conference.program.cfp = create(:cfp)
expected_count = Cfp.count
sign_in organizer
visit admin_conference_call_for_paper_path(conference.short_title)
visit admin_conference_program_cfp_path(conference.short_title)
click_link 'Edit'
# Validate update with empty start date will not saved
page.execute_script(
"$('#conference-start-datepicker').val('')")
click_button 'Update Call for paper'
click_button 'Update Cfp'
expect(flash).
to eq('Updating call for papers failed. ' +
"Start date can't be blank.")
@ -63,16 +60,14 @@ feature Conference do
page.execute_script(
"$('#conference-end-datepicker').val('#{(today + 14).strftime('%d/%m/%Y')}')")
fill_in 'call_for_paper_rating', with: '0'
click_button 'Update Call for paper'
click_button 'Update Cfp'
# Validations
expect(flash).
to eq('Call for papers successfully updated.')
expect(find('#start_date').text).to eq(today.strftime('%A, %B %-d. %Y'))
expect(find('#end_date').text).to eq((today + 14).strftime('%A, %B %-d. %Y'))
expect(find('#rating').text).to eq('0')
expect(CallForPaper.count).to eq(expected_count)
expect(Cfp.count).to eq(expected_count)
end
end

View file

@ -42,7 +42,7 @@ feature Commercial do
end
context 'in public area' do
let!(:event) { create(:event, conference: conference, title: 'Example Proposal') }
let!(:event) { create(:event, program: conference.program, title: 'Example Proposal') }
before(:each) do
event.event_users = [create(:event_user,
@ -58,8 +58,8 @@ feature Commercial do
sign_out
end
scenario 'adds a commercial of an event', feature: true, js: true do
visit edit_conference_proposal_path(conference.short_title, event.id)
scenario 'adds a valid commercial of an event', feature: true, js: true do
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
@ -75,7 +75,7 @@ feature Commercial do
commercial = create(:commercial,
commercialable_id: event.id,
commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id)
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update'
@ -89,7 +89,7 @@ feature Commercial do
create(:commercial,
commercialable_id: event.id,
commercialable_type: 'Event')
visit edit_conference_proposal_path(conference.short_title, event.id)
visit edit_conference_program_proposal_path(conference.short_title, event.id)
click_link 'Commercials'
click_link 'Delete'
page.driver.network_traffic

View file

@ -9,7 +9,7 @@ feature DifficultyLevel do
scenario 'adds difficulty level', feature: true, js: true do
sign_in organizer
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Add difficulty level
@ -32,9 +32,9 @@ feature DifficultyLevel do
scenario 'updates difficulty level', feature: true, js: true do
conference.difficulty_levels << create(:difficulty_level)
conference.program.difficulty_levels << create(:difficulty_level)
sign_in organizer
visit admin_conference_difficulty_levels_path(
visit admin_conference_program_difficulty_levels_path(
conference_id: conference.short_title)
# Remove difficulty level

View file

@ -9,7 +9,7 @@ feature EventType do
scenario 'adds and updates event type', feature: true, js: true do
sign_in organizer
visit admin_conference_event_types_path(
visit admin_conference_program_event_types_path(
conference_id: conference.short_title)
within('table#event_types') do

View file

@ -46,7 +46,7 @@ feature Openid do
click_link 'omniauth-google'
end
expect(flash).to eq("Could not authenticate you from Google because \"Invalid credentials\".")
expect(flash).to eq('Could not authenticate you from Google because "Invalid credentials".')
end
scenario 'adds openid to existing user' do

View file

@ -0,0 +1,30 @@
require 'spec_helper'
feature Program do
let!(:conference) { create(:conference) }
let!(:program) { conference.program }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
describe 'edit program' do
before :each do
sign_in organizer
end
scenario 'changes rating', feature: true, js: true do
visit admin_conference_program_path(conference.short_title)
click_link 'Edit'
fill_in 'program_rating', with: '4'
click_button 'Update Program'
# Validations
expect(flash).
to eq('The program was successfully updated.')
expect(find('#rating').text).to eq('4')
end
end
end

View file

@ -1,7 +1,8 @@
require 'spec_helper'
feature Event do
let!(:conference) { create(:conference, call_for_paper: create(:call_for_paper)) }
let!(:conference) { create(:conference) }
let!(:cfp) { create(:cfp, program_id: conference.program.id) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, email: 'admin@example.com', role_ids: [organizer_role.id]) }
let!(:participant) { create(:user) }
@ -10,7 +11,7 @@ feature Event do
before(:each) do
@options = {}
@options[:send_mail] = 'false'
@event = create(:event, conference: conference, title: 'Example Proposal')
@event = create(:event, program: conference.program, title: 'Example Proposal')
end
after(:each) do
@ -23,7 +24,7 @@ feature Event do
end
scenario 'rejects a proposal', feature: true, js: true do
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'New'
@ -34,7 +35,7 @@ feature Event do
end
scenario 'accepts a proposal', feature: true, js: true do
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'New'
@ -47,7 +48,7 @@ feature Event do
scenario 'restarts review of a proposal', feature: true, js: true do
@event.reject!(@options)
visit admin_conference_events_path(conference.short_title)
visit admin_conference_program_events_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_button 'Rejected'
@ -71,7 +72,7 @@ feature Event do
expected_count_event = Event.count + 1
expected_count_user = User.count + 1
visit new_conference_proposal_path(conference.short_title)
visit new_conference_program_proposal_path(conference.short_title)
fill_in 'user_username', with: 'Test User'
fill_in 'user_email', with: 'testuser@osem.io'
@ -90,11 +91,12 @@ feature Event do
end
scenario 'update a proposal' do
proposal = create(:event)
conference = create(:conference)
proposal = create(:event, program: conference.program)
sign_in proposal.submitter
visit edit_conference_proposal_path(proposal.conference.short_title, proposal)
visit edit_conference_program_proposal_path(proposal.program.conference.short_title, proposal)
fill_in 'event_subtitle', with: 'My event subtitle'
select('Easy', from: 'event[difficulty_level_id]')
@ -106,7 +108,7 @@ feature Event do
scenario 'signed_in user submits a valid proposal', feature: true, js: true do
sign_in participant_without_bio
expected_count = Event.count + 1
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
click_link 'New Proposal'
fill_in 'event_title', with: 'Example Proposal'
@ -120,13 +122,13 @@ feature Event do
click_button 'Create Proposal'
expect(flash).to eq('Proposal was successfully submitted.')
expect(current_path).to eq(conference_proposal_index_path(conference.short_title))
expect(current_path).to eq(conference_program_proposal_index_path(conference.short_title))
expect(Event.count).to eq(expected_count)
end
scenario 'confirms a proposal', feature: true, js: true do
sign_in participant
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
expect(@event.state).to eq('unconfirmed')
click_link "confirm_proposal_#{@event.id}"
@ -139,7 +141,7 @@ feature Event do
scenario 'withdraw a proposal', feature: true, js: true do
sign_in participant
@event.confirm!
visit conference_proposal_index_path(conference.short_title)
visit conference_program_proposal_index_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true
click_link "delete_proposal_#{@event.id}"
expect(flash).to eq('Proposal was successfully withdrawn.')

View file

@ -25,7 +25,7 @@ feature RegistrationPeriod do
"#{Date.today.strftime('%d/%m/%Y')}')")
page.
execute_script("$('#registration-period-end-datepicker').val('" +
"#{(Date.today + 7).strftime('%d/%m/%Y')}')")
"#{(Date.today + 5).strftime('%d/%m/%Y')}')")
click_button 'Save Registration Period'
@ -35,7 +35,7 @@ feature RegistrationPeriod do
registration_period = RegistrationPeriod.where(conference_id: conference.id).first
registration_period.reload
expect(registration_period.start_date).to eq(Date.today)
expect(registration_period.end_date).to eq(Date.today + 7)
expect(registration_period.end_date).to eq(Date.today + 5)
end
end

View file

@ -2,13 +2,14 @@ require 'spec_helper'
feature Room do
let!(:conference) { create(:conference) }
let!(:venue) { create(:venue, conference: conference) }
let!(:organizer_role) { create(:organizer_role, resource: conference) }
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
shared_examples 'rooms' do
scenario 'adds a room', feature: true, js: true do
sign_in organizer
visit admin_conference_rooms_path(
visit admin_conference_venue_rooms_path(
conference_id: conference.short_title)
expect(page.has_no_table?('#rooms')).to be true
@ -30,9 +31,9 @@ feature Room do
end
scenario 'updates a room', feature: true, js: true do
room = create(:room, conference_id: conference.id)
room = create(:room, venue: venue)
sign_in organizer
visit edit_admin_conference_room_path(
visit edit_admin_conference_venue_room_path(
conference_id: conference.short_title, id: room.id)
fill_in 'room_name', with: 'Auditorium'

View file

@ -52,7 +52,8 @@ feature Ticket do
click_button 'Update Ticket'
ticket.reload
expect(ticket.price).to eq(50)
# It's necessary to multiply by 100 because the price is in cents
expect(ticket.price).to eq(Money.new(50 * 100, 'USD'))
expect(ticket.title).to eq('Free Ticket')
expect(flash).to eq('Ticket successfully updated.')
expect(Ticket.count).to eq(1)
@ -68,7 +69,8 @@ feature Ticket do
click_button 'Update Ticket'
ticket.reload
expect(ticket.price).to eq(100)
# It's necessary to multiply by 100 because the price is in cents
expect(ticket.price).to eq(Money.new(100 * 100, 'USD'))
expect(ticket.title).to eq('Business Ticket')
expect(flash).to eq("Ticket update failed: Title can't be blank. Price cents must be greater than 0.")
expect(Ticket.count).to eq(1)

View file

@ -10,7 +10,7 @@ feature Track do
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'New Track'
fill_in 'track_name', with: 'Distribution'
@ -27,10 +27,10 @@ feature Track do
end
scenario 'deletes a track', feature: true, js: true do
track = create(:track, conference_id: conference.id)
track = create(:track, program_id: conference.program.id)
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'Delete'
@ -43,10 +43,10 @@ feature Track do
end
scenario 'updates a track', feature: true, js: true do
create(:track, conference_id: conference.id)
create(:track, program_id: conference.program.id)
sign_in organizer
visit admin_conference_tracks_path(conference_id: conference.short_title)
visit admin_conference_program_tracks_path(conference_id: conference.short_title)
click_link 'Edit'
fill_in 'track_name', with: 'Distribution'