Skip to content

Commit

Permalink
Follow-up for #2653
Browse files Browse the repository at this point in the history
-  is no longer necessary
- Add specs that fails with Ruby 3.2
  • Loading branch information
mshibuya committed Mar 18, 2023
1 parent ec05cbc commit fd03ddd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/carrierwave/mounter.rb
Expand Up @@ -159,7 +159,7 @@ def remove=(value)
end

def remove?
remove.present? && (remove == true || remove.to_s !~ /\A0|false$\z/)
remove.present? && (remove.to_s !~ /\A0|false$\z/)
end

def remove!
Expand Down
10 changes: 8 additions & 2 deletions spec/mount_multiple_spec.rb
Expand Up @@ -705,17 +705,23 @@ def monkey
it { is_expected.to be_falsey }
end

context "when value is 0" do
context "when value is '0'" do
let(:remove_images) { "0" }

it { is_expected.to be_falsey }
end

context "when value is false" do
context "when value is 'false'" do
let(:remove_images) { 'false' }

it { is_expected.to be_falsey }
end

context "when value is 0" do
let(:remove_images) { 0 }

it { is_expected.to be_falsey }
end
end

describe '#images_integrity_errors' do
Expand Down
5 changes: 5 additions & 0 deletions spec/mount_single_spec.rb
Expand Up @@ -462,6 +462,11 @@ def default_url
expect(@instance.remove_image?).to be_falsey
end

it "should be false when the value is 0" do
@instance.remove_image = 0
expect(@instance.remove_image?).to be_falsey
end

end

describe '#image_integrity_error' do
Expand Down

0 comments on commit fd03ddd

Please sign in to comment.