Skip to content

Commit

Permalink
add specs for Settings.enabled?
Browse files Browse the repository at this point in the history
  • Loading branch information
DannyBen committed Dec 18, 2024
1 parent d922dbc commit 632226b
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion spec/bashly/settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,73 @@
end
end

describe 'strict_string' do
describe '::enabled?' do
context 'when the value is always' do
before { subject.enable_header_comment = 'always' }

it 'returns true' do
expect(subject.enabled? :header_comment).to be true
end
end

context 'when the value is never' do
before { subject.enable_header_comment = 'never' }

it 'returns false' do
expect(subject.enabled? :header_comment).to be false
end
end

context 'when the value is production in a production env' do
before do
subject.enable_header_comment = 'production'
subject.env = :production
end

it 'returns true' do
expect(subject.enabled? :header_comment).to be true
end
end

context 'when the value is production in a development env' do
before do
subject.enable_header_comment = 'production'
subject.env = :development
end

after { subject.env = nil }

it 'returns false' do
expect(subject.enabled? :header_comment).to be false
end
end

context 'when the value is development in a production env' do
before do
subject.enable_header_comment = 'development'
subject.env = :production
end

it 'returns false' do
expect(subject.enabled? :header_comment).to be false
end
end

context 'when the value is development in a development env' do
before do
subject.enable_header_comment = 'development'
subject.env = :development
end

after { subject.env = nil }

it 'returns true' do
expect(subject.enabled? :header_comment).to be true
end
end
end

describe '::strict_string' do
context 'when strict is true' do
before { subject.strict = true }

Expand Down

0 comments on commit 632226b

Please sign in to comment.