|
97 | 97 | end
|
98 | 98 | end
|
99 | 99 |
|
100 |
| - describe 'strict_string' do |
| 100 | + describe '::enabled?' do |
| 101 | + context 'when the value is always' do |
| 102 | + before { subject.enable_header_comment = 'always' } |
| 103 | + |
| 104 | + it 'returns true' do |
| 105 | + expect(subject.enabled? :header_comment).to be true |
| 106 | + end |
| 107 | + end |
| 108 | + |
| 109 | + context 'when the value is never' do |
| 110 | + before { subject.enable_header_comment = 'never' } |
| 111 | + |
| 112 | + it 'returns false' do |
| 113 | + expect(subject.enabled? :header_comment).to be false |
| 114 | + end |
| 115 | + end |
| 116 | + |
| 117 | + context 'when the value is production in a production env' do |
| 118 | + before do |
| 119 | + subject.enable_header_comment = 'production' |
| 120 | + subject.env = :production |
| 121 | + end |
| 122 | + |
| 123 | + it 'returns true' do |
| 124 | + expect(subject.enabled? :header_comment).to be true |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + context 'when the value is production in a development env' do |
| 129 | + before do |
| 130 | + subject.enable_header_comment = 'production' |
| 131 | + subject.env = :development |
| 132 | + end |
| 133 | + |
| 134 | + after { subject.env = nil } |
| 135 | + |
| 136 | + it 'returns false' do |
| 137 | + expect(subject.enabled? :header_comment).to be false |
| 138 | + end |
| 139 | + end |
| 140 | + |
| 141 | + context 'when the value is development in a production env' do |
| 142 | + before do |
| 143 | + subject.enable_header_comment = 'development' |
| 144 | + subject.env = :production |
| 145 | + end |
| 146 | + |
| 147 | + it 'returns false' do |
| 148 | + expect(subject.enabled? :header_comment).to be false |
| 149 | + end |
| 150 | + end |
| 151 | + |
| 152 | + context 'when the value is development in a development env' do |
| 153 | + before do |
| 154 | + subject.enable_header_comment = 'development' |
| 155 | + subject.env = :development |
| 156 | + end |
| 157 | + |
| 158 | + after { subject.env = nil } |
| 159 | + |
| 160 | + it 'returns true' do |
| 161 | + expect(subject.enabled? :header_comment).to be true |
| 162 | + end |
| 163 | + end |
| 164 | + end |
| 165 | + |
| 166 | + describe '::strict_string' do |
101 | 167 | context 'when strict is true' do
|
102 | 168 | before { subject.strict = true }
|
103 | 169 |
|
|
0 commit comments