2023-03-22 17:30:37 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:30:48 +02:00
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class PriceCategoryTest < ActiveSupport::TestCase
|
2016-09-08 16:58:18 +02:00
|
|
|
test 'price category name must be unique' do
|
2020-03-30 10:59:11 +02:00
|
|
|
pc = PriceCategory.new(name: '- DE 25 ANS', conditions: 'Tarif préférentiel pour les jeunes')
|
2016-09-08 16:58:18 +02:00
|
|
|
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
|
2016-08-24 12:30:48 +02:00
|
|
|
end
|