Skip to content

Instantly share code, notes, and snippets.

@dasibre
Forked from peterhellberg/Gemfile
Created December 12, 2013 17:16
Show Gist options
  • Save dasibre/7931642 to your computer and use it in GitHub Desktop.
Save dasibre/7931642 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require_relative "spec_helper"
require_relative "../my_app.rb"
require 'capybara'
require 'capybara/dsl'
require 'capybara/webkit'
require 'capybara_minitest_spec'
Capybara.app = MyApp
Capybara.default_driver = :webkit
class MiniTest::Spec
include Capybara::DSL
end
class Capybara::Session
def params
Hash[*URI.parse(current_url).query.split(/\?|=|&/)]
end
end
source :rubygems
gem "sinatra", "~> 1.3.2"
group :test do
gem "minitest", "~> 2.10"
gem "rack-test", "~> 0.6.1"
gem "capybara", "~> 1.1"
gem "capybara-webkit", "~> 0.11"
gem "capybara_minitest_spec", "~> 0.2"
end
require_relative "acceptance_helper"
describe MyApp do
it "shows a site" do
visit '/'
fill_in 'q', :with => 'Test'
click_button 'Search'
page.must_have_content 'Test'
page.params['q'].must_equal 'Test'
end
end
%w{ rubygems bundler find rake/testtask}.each { |lib| require lib }
task :default => :spec
Rake::TestTask.new(:spec) do |t|
t.test_files = FileList['spec/*_spec.rb']
end
Rake::TestTask.new(:acceptance) do |t|
t.test_files = FileList['spec/*_acceptance.rb']
end
# encoding: UTF-8
require 'bundler'
Bundler.setup
Bundler.require
require 'minitest/pride'
require 'minitest/autorun'
require 'minitest/spec'
require 'rack/test'
class MiniTest::Spec
include Rack::Test::Methods
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment