Add (admin-only) tickets via 'visibile' attribute [migration]
(cherry picked from commit ce0db3d7a736e7bcde480721986dbfb4a82aa083)
This commit is contained in:
parent
6e276b2787
commit
199bc00c08
15 changed files with 73 additions and 9 deletions
|
|
@ -29,6 +29,35 @@ feature Ticket do
|
|||
expect(Ticket.count).to eq(2)
|
||||
end
|
||||
|
||||
scenario 'add a invalid ticket', feature: true, js: true do
|
||||
visit admin_conference_tickets_path(conference.short_title)
|
||||
click_link 'Add Ticket'
|
||||
|
||||
fill_in 'ticket_title', with: ''
|
||||
fill_in 'ticket_price', with: '-1'
|
||||
|
||||
click_button 'Create Ticket'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq("Creating Ticket failed: Title can't be blank. Price cents must be greater than or equal to 0.")
|
||||
expect(Ticket.count).to eq(1)
|
||||
end
|
||||
|
||||
scenario 'add a hidden ticket', feature: true do
|
||||
visit admin_conference_tickets_path(conference.short_title)
|
||||
click_link 'Add Ticket'
|
||||
|
||||
fill_in 'ticket_title', with: 'Hidden Ticket'
|
||||
fill_in 'ticket_description', with: 'The hidden ticket'
|
||||
fill_in 'ticket_price', with: '100'
|
||||
uncheck 'ticket_visible'
|
||||
|
||||
click_button 'Create Ticket'
|
||||
page.find('#flash')
|
||||
expect(flash).to eq('Ticket successfully created.')
|
||||
expect(Ticket.count).to eq(2)
|
||||
expect(Ticket.visible.count).to eq(1)
|
||||
end
|
||||
|
||||
context 'Ticket already created' do
|
||||
let!(:ticket) { create(:ticket, title: 'Business Ticket', price: 100, conference_id: conference.id) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue