mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
add tests about event price's categories
This commit is contained in:
parent
7592a778ae
commit
0307972f9c
14
test/fixtures/event_price_categories.yml
vendored
14
test/fixtures/event_price_categories.yml
vendored
@ -1,11 +1,13 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
event_id:
|
||||
price_category_id:
|
||||
amount: 1
|
||||
id: 1
|
||||
event_id: 1
|
||||
price_category_id: 1
|
||||
amount: 1500
|
||||
|
||||
two:
|
||||
event_id:
|
||||
price_category_id:
|
||||
amount: 1
|
||||
id: 2
|
||||
event_id: 2
|
||||
price_category_id: 1
|
||||
amount: 1700
|
||||
|
6
test/fixtures/price_categories.yml
vendored
6
test/fixtures/price_categories.yml
vendored
@ -1,9 +1,11 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
youngs:
|
||||
id: 1
|
||||
name: "- de 25 ans"
|
||||
conditions: "Tarif réservé aux jeunes de moins de 25 ans"
|
||||
|
||||
two:
|
||||
unemployed:
|
||||
id: 2
|
||||
name: "chômeurs"
|
||||
conditions: "Tarif préférentiel pour les demandeurs d'emploi pouvant justifier de leur situation."
|
||||
|
10
test/fixtures/tickets.yml
vendored
10
test/fixtures/tickets.yml
vendored
@ -1,11 +1 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
reservation_id:
|
||||
event_price_category_id:
|
||||
booked: 1
|
||||
|
||||
two:
|
||||
reservation_id:
|
||||
event_price_category_id:
|
||||
booked: 1
|
||||
|
@ -1,7 +1,9 @@
|
||||
require 'test_helper'
|
||||
|
||||
class EventPriceCategoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test "event price's category cannot be empty" do
|
||||
epc = EventPriceCategory.new({price_category_id: 1, event_id: 3})
|
||||
assert epc.invalid?
|
||||
assert epc.errors[:amount].present?
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,15 @@
|
||||
require 'test_helper'
|
||||
|
||||
class PriceCategoryTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test 'price category name must be unique' do
|
||||
pc = PriceCategory.new({name: '- DE 25 ANS', conditions: 'Tarif préférentiel pour les jeunes'})
|
||||
assert pc.invalid?
|
||||
assert pc.errors[:name].present?
|
||||
end
|
||||
|
||||
test 'associated price category cannot be destroyed' do
|
||||
pc = PriceCategory.find(1)
|
||||
assert_not pc.safe_destroy
|
||||
assert_not_empty PriceCategory.where(id: 1)
|
||||
end
|
||||
end
|
||||
|
@ -1,7 +1,9 @@
|
||||
require 'test_helper'
|
||||
|
||||
class TicketTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
test "ticket must have at least 1 seat" do
|
||||
t = Ticket.new({event_price_category_id: 1, booked: -1})
|
||||
assert t.invalid?
|
||||
assert t.errors[:booked].present?
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user