Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add be_format test matcher #1758

Merged

Conversation

yanivpr
Copy link
Contributor

@yanivpr yanivpr commented Oct 22, 2015

Add a test matcher for the format.
Could be useful to test that a conversion has happened.

Usage:

context 'the thumb format' do
  it 'should be JPEG' do
    @uploader.thumb.should be_format('JPEG')
   end
end

@thomasfedb
Copy link
Contributor

@yanivpr does the value of @expected need to be normalised at all? e.g. @expected.downcase?

@yanivpr
Copy link
Contributor Author

yanivpr commented Nov 26, 2015

@thomasfedb To clarify - you mean that I should cover all cases?
Something like /\A#{@actual_expected}\z/i.match(@expected)

@thomasfedb
Copy link
Contributor

@yanivpr is a regex the most efficient way to handle that?

@thomasfedb
Copy link
Contributor

Also @yanivpr, it might be worthwhile ensuring that your matcher gets used within the carrierwave test suite.

@yanivpr
Copy link
Contributor Author

yanivpr commented Dec 2, 2015

  • Test format case insensitive.
  • Use format test matcher in the test suite.
  • Add format test matcher to readme file.

img = ::MiniMagick::Image.open(@instance.current_path)
expect(img['format']).to match(/PNG/)
expect(@instance.file.extension).to eq('png')
expect(@instance).to be_format('PNG')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change 'PNG' to 'png'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@thomasfedb thomasfedb changed the title add format test matcher Add be_format test matcher Dec 4, 2015
@thomasfedb
Copy link
Contributor

This is looking great @yanivpr. If you could address the three comments I've left above, and also squash all your changes into a single commit (how to) then I'll git it merged! 🏆

* Test format case insensitive.
* Use format test matcher in the test suite.
* Add format test matcher to readme file.
@yanivpr
Copy link
Contributor Author

yanivpr commented Dec 6, 2015

Thank you for the code review!
I have squashed the commits.

@thomasfedb
Copy link
Contributor

Lovely. Cheers @yanivpr.

thomasfedb added a commit that referenced this pull request Dec 7, 2015
@thomasfedb thomasfedb merged commit e3acabb into carrierwaveuploader:master Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants