Home

Awesome

No Longer being maintainer here.

Please use an active fork or consider using percy.io

Spectre ruby client

A gem to upload screenshots to Spectre.

Installation

Add this line to your application's Gemfile:

gem 'spectre_client', git: 'git@github.com:wearefriday/spectre_client.git'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spectre_client

Usage

There are two steps to submitting a test to Spectre: first create a "run" that is associated to a "project" (a category) and a "suite" (a sub-category), then submit multiple "tests" (screenshots) to the run.

A run will be created for you when creating a new instance of a SpectreClient::Client. Submitting a test with this client object will associate the test with the run.

Create a client object:

client = SpectreClient::Client.new('Project Name', 'Suite Name', "http://spectre.local")

Submit a test:

client.submit_test(options_hash)

The method accepts a hash with the following keys:

Example:

client.submit_test({
  name: 'Homepage',
  browser: 'Firefox',
  size: '1200',
  screenshot: File.new('homepage.png', 'rb'),
  source_url: 'http://mysite.dev/'
})

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/wearefriday/spectre_client.

Licence

The gem is available as open source under the terms of the MIT Licence.