rating/spec/config/validations_spec.rb

32 lines
935 B
Ruby
Raw Normal View History

# frozen_string_literal: true
RSpec.describe Rating::Config, '.validations' do
2019-10-03 22:07:50 +00:00
if ENV['CONFIG_ENABLED_WITH_EXTRA_SCOPES'] != 'true'
context 'when rating.yml does not exist' do
it do
expect(subject.validations).to eq({
rate: {
case_sensitive: false,
scope: %w[author_type resource_id resource_type scopeable_id scopeable_type],
},
}.deep_stringify_keys
)
end
end
2019-10-03 22:07:50 +00:00
end
2019-10-03 22:07:50 +00:00
if ENV['CONFIG_ENABLED_WITH_EXTRA_SCOPES'] == 'true'
context 'when rating.yml exists' do
it do
expect(subject.validations).to eq({
rate: {
case_sensitive: false,
scope: %w[author_type resource_id resource_type scopeable_id scopeable_type scope_1 scope_2],
},
}.deep_stringify_keys
)
end
end
2019-10-03 22:07:50 +00:00
end
end