Project

image_spec

0.01
No commit activity in last 3 years
No release in over 3 years
A library of Rspec matchers to allow comparison of similar images
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

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 relies on ImageMagick being installed and available from the command line as it utilizes its identify command.

The gem has only been tested with Rails 3.0 & 3.1 with the asset pipeline and RSpec 2; it has also 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.:

rendered.should have_image_that_looks_like(expected)