README.md in capybara-screenshot_config-0.0.1 vs README.md in capybara-screenshot_config-0.1.0

- old
+ new

@@ -1,10 +1,11 @@ # Capybara::ScreenshotConfig -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/capybara/screenshot_config`. To experiment with that code, run `bin/console` for an interactive prompt. +[![Gem Version](https://badge.fury.io/rb/capybara-screenshot_config.svg)](https://badge.fury.io/rb/capybara-screenshot_config) +[![Code Climate](https://codeclimate.com/github/toshimaru/capybara-screenshot_config/badges/gpa.svg)](https://codeclimate.com/github/toshimaru/capybara-screenshot_config) -TODO: Delete this and the text above, and describe your gem +Easier Capybara screenshot configuration gem. ## Installation Add this line to your application's Gemfile: @@ -18,19 +19,46 @@ Or install it yourself as: $ gem install capybara-screenshot_config +## Requirement +- capybara 2.x or more +- poltergeist for Capybara javascript_driver + ## Usage -TODO: Write usage instructions here +### Setup poltergeist +```ruby +require "capybara/poltergeist" +Capybara.javascript_driver = :poltergeist +``` + +For more information, see [here](https://github.com/teampoltergeist/poltergeist). + +### ScreenshotConfig configuration + +```ruby +Capybara::ScreenshotConfig.configure do |config| + config.save_dir = "screenshot" # [String] screenshot save directory + config.full = true # [Boolean] full screenshot +end +``` + +### save_screenshot + +```ruby +describe 'screenshot', js: true do + it { page.save_screenshot "screenshot.png" } +end +``` + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. 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](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/capybara-screenshot_config. -