No commit activity in last 3 years
No release in over 3 years
Provides assertions for minitest based on Capybara's RSpec matchers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 5.4
~> 1.5
~> 10.0

Runtime

~> 2.4
 Project Readme

Capybara::Minitest

Gem Version Dependency Status Build Status Codeship Code Climate Coverage Status Inline docs

Note: the 0.9.0 and 0.9.1 gems were broken, make sure to update to 0.9.2 using $ gem install capybara-minitest.

If you're using Minitest::Test with the Capybara::DSL for your tests, this gem will allow you to do:

# With Capybara::Minitest::Assertions included
assert_has_text page, 'Squeak', 'optional message'

instead of:

# Without Capybara::Minitest
assert page.has_text?('Squeak'), 'optional message'

The assertions are dynamically generated from Capybara's RSpec matchers. You can optionally provide custom failure messages and the backtrace will be cleaned up for you.

You can see the full list of assertions (and refutations) in the auto-generated RDoc.

Install

# Gemfile
gem 'capybara-minitest'

Usage

require 'capybara/minitest/assertions'

class AcceptanceTest < Minitest::Test
  include Capybara::DSL
  include Capybara::Minitest::Assertions
end

Or, if you're using Rails:

require 'capybara/minitest/assertions'

class AcceptanceTest < ActionDispatch::IntegrationTest
  include Capybara::DSL
  include Capybara::Minitest::Assertions
end

Example

class RodentTest < Minitest::Test
  include Capybara::DSL
  include Capybara::Minitest::Assertions

  def test_squeak
    visit '/rodent'
    assert_has_text page, 'Squeak', 'optional message'
  end
end