Lookout::Rack::Test
RSpec and Cucumber test helpers.
Installation
Add this line to your application's Gemfile:
gem 'lookout-rack-test'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lookout-rack-test
Usage
Lookout::Rack::Test is intended to be consumed in pieces; it falls into three
modules, RSpec, Cucumber, and Rake.
RSpec
See examples in spec/. Lookout::Rack::Test::RSpec::FakeRequest may also be
helpful, if you want to test helper modules that are intended to be mixed into a
route environment.
module Lookout::Rack::Test::RSpec
class FakeRequest
# Reopen the class to add a helper
include My::Helper
end
end
describe My::Helper do
let(:helper) { Lookout::Rack::Test::RSpec::FakeRequest.new }
# ... etc
end
Cucumber
See examples in features/.
Rake tasks
require 'lookout/rack/test/rake' in your Rakefile to pick up the RSpec and
Cucumber test tasks, namespaced under:specand:cucumber` respectively.
Note that the :cucumber tasks require a cucumber.yml, e.g.:
<%
standard = "--expand -r features --format pretty --format junit --out features/reports"
browser_opts = "--tags @selenium"
%>
default: <%= standard %> <%= browser_opts %> --tags ~@wip --tags ~@api
wip: <%= standard %> --tags @wip
api: <%= standard %> --tags @api --tags ~@wip
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request