Skip to content

A set of Rspec matcher to allow relative comparison of images.

License

Notifications You must be signed in to change notification settings

MerchantsBonding/image_spec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This gem provides a set of RSpec matchers to allow relative comparisons of images.

e.g. User.image.should look_like(otherimage)

Requirements

The gem has only been tested with Rails 3.0 & 3.1 with the asset pipeline and RSpec 2.

It also relies on imagemagick being installed and available from the command line as it utilisies its 'identify' command. The Gem has only been tested with Imagemagick V6.x.

Setup

Include the gem in your Gemfile:-

gem 'image-spec'

include the matchers in your spec_helper.rb:-

require 'image_spec/matchers'

#Usage

###look_like

Allows you to test that an image is within a 1% of the expected image e.g.

actual.should look_like(expected)

or

user.picture.path(:thumb).should look_like(fixtures('member_picture/thumb/test.png'))

###have_image_that_looks_like

Test if a page contains an image that is like the stated image e.g.

About

A set of Rspec matcher to allow relative comparison of images.

Resources

License

Stars

Watchers

Forks

Packages

No packages published