Skip to content

Commit

Permalink
replace mocha and bourne with rspec mocks (kreeti#6)
Browse files Browse the repository at this point in the history
* initial work on replacing mocha with rspec-mocks

* replacing stubs with allow

* fix validators tests and warnings

* fix attachment_processing_spec.rb

* fixes paperclip/interpolation_spec.rb

* stubs and related methods fixes

* argument fixes related in 'with'

* using double instead of stub

* s3 and fog fixes

* yield multiple times

* has_attached_file spec fixes

* s3_spec fixes

* adding libjpeg to allow support for jpeg images

* imagemagick installation

* updating packages before installation

* removing policy.xml to allow pdf images to be read/written

* replacing ghostscript-9.20 by ghostscript

* removing unnecessary lines

* removing unnecessary lines from travis.yml

* updating syntax in fog_spec
  • Loading branch information
sbhawsingka authored and ssinghi committed Dec 6, 2019
1 parent 6f1b0e3 commit 6682a00
Show file tree
Hide file tree
Showing 33 changed files with 514 additions and 605 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: ruby
sudo: false

rvm:
- 2.1
Expand All @@ -11,9 +10,13 @@ script: "bundle exec rake clean spec cucumber"

addons:
apt:
update: true
packages:
- ghostscript

before_install:
- sudo rm /etc/ImageMagick-6/policy.xml

gemfile:
- gemfiles/4.2.gemfile
- gemfiles/5.0.gemfile
Expand Down
1 change: 0 additions & 1 deletion lib/paperclip/media_type_spoof_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def mapping_override_mismatch?
!Array(mapped_content_type).include?(calculated_content_type)
end


def supplied_content_type
@content_type
end
Expand Down
2 changes: 0 additions & 2 deletions paperclip.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('shoulda')
s.add_development_dependency('rspec', '~> 3.0')
s.add_development_dependency('appraisal')
s.add_development_dependency('mocha')
s.add_development_dependency('aws-sdk-s3')
s.add_development_dependency('bourne')
s.add_development_dependency('cucumber-rails')
s.add_development_dependency('cucumber-expressions', '4.0.3') # TODO: investigate failures on 4.0.4
s.add_development_dependency('aruba', '~> 0.9.0')
Expand Down
14 changes: 7 additions & 7 deletions spec/paperclip/attachment_processing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Dummy.validates_attachment_content_type :avatar, content_type: "image/png"
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles)
expect(attachment).to receive(:post_process_styles)

attachment.assign(file)
end
Expand All @@ -19,7 +19,7 @@
Dummy.validates_attachment_content_type :avatar, not: "image/png"
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles).never
expect(attachment).not_to receive(:post_process_styles)

attachment.assign(file)
end
Expand All @@ -29,7 +29,7 @@
Dummy.validates_attachment_content_type :avatar, content_type: "image/tiff"
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles).never
expect(attachment).not_to receive(:post_process_styles)

attachment.assign(file)
end
Expand All @@ -39,7 +39,7 @@
Dummy.validates_attachment_content_type :avatar, content_type: "image/tiff", if: lambda{false}
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles)
expect(attachment).to receive(:post_process_styles)

attachment.assign(invalid_assignment)
end
Expand All @@ -51,7 +51,7 @@
Dummy.validates_attachment :avatar, content_type: {content_type: "image/png"}
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles)
expect(attachment).to receive(:post_process_styles)

attachment.assign(file)
end
Expand All @@ -61,7 +61,7 @@
Dummy.validates_attachment :avatar, content_type: {not: "image/png"}
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles).never
expect(attachment).not_to receive(:post_process_styles)

attachment.assign(file)
end
Expand All @@ -71,7 +71,7 @@
Dummy.validates_attachment :avatar, content_type: {content_type: "image/tiff"}
instance = Dummy.new
attachment = instance.avatar
attachment.expects(:post_process_styles).never
expect(attachment).not_to receive(:post_process_styles)

attachment.assign(file)
end
Expand Down
Loading

0 comments on commit 6682a00

Please sign in to comment.