Home

Awesome

Oktobertest::Contrib

Contributed Oktobertest extensions.

Installation

Add this line to your application's Gemfile:

gem 'oktobertest-contrib', group: :test
# or this if you want to use oktobertest-contrib master
# gem 'oktobertest-contrib', group: :test, github: 'patriciomacadden/oktobertest-contrib'

And then execute:

$ bundle

Or install it yourself as:

$ gem install oktobertest-contrib

Optional dependencies

Usage

require an extension to use it. If you want to use all of them, just require 'oktobertest/contrib'.

Available extensions

Extra assertions

This extension includes a lot of useful assertions. To use it, just require it:

require 'oktobertest'
require 'oktobertest/assertions'

scope do
  test do
    expected, actual = 1, 1
    assert_equal expected, actual
  end
end

Available assertions

Rack related assertions

This extesion includes rack related assertions. To use it, just require it:

require 'oktobertest'
require 'oktobertest/rack/test'

scope do
  setup do
    @app = Proc.new { |env| [200, {}, ['hello world']] }
  end

  test 'GET /' do
    get '/'
    assert_status 200
    # equivalent to:
    # assert_equal 200, last_response.status
  end
end

Available assertions

Capybara

This extension includes automatic setup for Capybara.

require 'oktobertest'
require 'oktobertest/capybara'

Capybara.app = App

scope do
  test 'works' do
    visit '/'
    assert page.has_content? 'hello world'
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

See the LICENSE.