2018-03-01 20:49:51 +00:00
|
|
|
# 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
|
2018-03-01 20:49:51 +00:00
|
|
|
end
|
2019-10-03 22:07:50 +00:00
|
|
|
end
|
2018-03-01 20:49:51 +00:00
|
|
|
|
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
|
2018-03-01 20:49:51 +00:00
|
|
|
end
|
2019-10-03 22:07:50 +00:00
|
|
|
end
|
2018-03-01 20:49:51 +00:00
|
|
|
end
|