mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
currency of a single ticket could be updated now
closes #1913 fixed travis faliures minor changes removed empty file added tests regarding currency updation
This commit is contained in:
parent
769cc6c970
commit
33d32b9294
2 changed files with 25 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ describe Ticket do
|
|||
let(:user) { create(:user) }
|
||||
|
||||
describe 'validation' do
|
||||
|
||||
it 'has a valid factory' do
|
||||
expect(build(:ticket)).to be_valid
|
||||
end
|
||||
|
|
@ -177,4 +178,25 @@ describe Ticket do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'currency updation' do
|
||||
context 'when more than one ticket exist for a conference' do
|
||||
it 'should not allow currency update' do
|
||||
ticket.update(price_currency: 'INR')
|
||||
expected_error_message = 'Price currency is different from the existing tickets of this conference.'
|
||||
expect(ticket.errors.full_messages).to eq([expected_error_message])
|
||||
end
|
||||
end
|
||||
|
||||
context 'when a single ticket exists for a conference' do
|
||||
before do
|
||||
ticket.destroy
|
||||
end
|
||||
|
||||
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')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue