15 Jan 2012
Cucumber + Capybara + Sinatra
This post is not to provide a tutorial of how to combine those three awesome applications together, but it might stop you from scratching your head when the test cannot be run correctly.
- You need to have Sinatra in subclass style rather than classic style. Sinatra subclass-style
- This is quite importance, you might find some website that is using Spec. but you need to change it to be “RSpec” in order for it to work.
require File.join(File.dirname(__FILE__), '..', '..', '/server.rb')
require 'rspec'
require 'rspec/expectations'
require 'rack/test'
require 'capybara'
require 'capybara/cucumber'
require 'capybara/envjs'
App.set(:environment, :test)
World do
Capybara.app = App
Capybara.javascript_driver = :envjs
include Capybara
include RSpec::Expectations
include RSpec::Matchers
end
Til next time,
noppanit
at 00:00