Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Set up test environment.

  • Loading branch information...
commit c4bde5f9ce12bbb5feeb9adb6684de3f478bc00f 1 parent b0f29a5
Tristan Dunn authored
40 Gemfile
@@ -2,36 +2,14 @@ source 'https://rubygems.org'
2 2
3 3 gem 'rails', '3.2.1'
4 4
5   -# Bundle edge Rails instead:
6   -# gem 'rails', :git => 'git://github.com/rails/rails.git'
7   -
8   -
9   -
10   -# Gems used only for assets and not required
11   -# in production environments by default.
12   -group :assets do
13   - gem 'sass-rails', '~> 3.2.3'
14   - gem 'coffee-rails', '~> 3.2.1'
15   -
16   - # See https://github.com/sstephenson/execjs#readme for more supported runtimes
17   - # gem 'therubyracer'
18   -
19   - gem 'uglifier', '>= 1.0.3'
  5 +group :development do
  6 + gem 'rspec-rails', '2.8.1'
20 7 end
21 8
22   -
23   -
24   -# To use ActiveModel has_secure_password
25   -# gem 'bcrypt-ruby', '~> 3.0.0'
26   -
27   -# To use Jbuilder templates for JSON
28   -# gem 'jbuilder'
29   -
30   -# Use unicorn as the web server
31   -# gem 'unicorn'
32   -
33   -# Deploy with Capistrano
34   -# gem 'capistrano'
35   -
36   -# To use debugger
37   -# gem 'ruby-debug19', :require => 'ruby-debug'
  9 +group :test do
  10 + gem 'bourne', '1.0'
  11 + gem 'cucumber-rails', '1.2.1', require: false
  12 + gem 'pusher-fake', git: 'git://github.com/tristandunn/pusher-fake.git'
  13 + gem 'rspec-rails', '2.8.1'
  14 + gem 'shoulda-matchers', '1.0.0'
  15 +end
98 Gemfile.lock
... ... @@ -1,3 +1,13 @@
  1 +GIT
  2 + remote: git://github.com/tristandunn/pusher-fake.git
  3 + revision: d9309262dba2f5b6ca57ac6842d6fae908198a06
  4 + specs:
  5 + pusher-fake (0.1.0)
  6 + em-websocket (= 0.3.6)
  7 + ruby-hmac (= 0.4.0)
  8 + thin (= 1.3.1)
  9 + yajl-ruby (= 1.1.0)
  10 +
1 11 GEM
2 12 remote: https://rubygems.org/
3 13 specs:
@@ -28,18 +38,40 @@ GEM
28 38 activesupport (3.2.1)
29 39 i18n (~> 0.6)
30 40 multi_json (~> 1.0)
  41 + addressable (2.2.6)
31 42 arel (3.0.0)
  43 + bourne (1.0)
  44 + mocha (= 0.9.8)
32 45 builder (3.0.0)
33   - coffee-rails (3.2.2)
34   - coffee-script (>= 2.2.0)
35   - railties (~> 3.2.0)
36   - coffee-script (2.2.0)
37   - coffee-script-source
38   - execjs
39   - coffee-script-source (1.2.0)
  46 + capybara (1.1.2)
  47 + mime-types (>= 1.16)
  48 + nokogiri (>= 1.3.3)
  49 + rack (>= 1.0.0)
  50 + rack-test (>= 0.5.4)
  51 + selenium-webdriver (~> 2.0)
  52 + xpath (~> 0.1.4)
  53 + childprocess (0.3.1)
  54 + ffi (~> 1.0.6)
  55 + cucumber (1.1.4)
  56 + builder (>= 2.1.2)
  57 + diff-lcs (>= 1.1.2)
  58 + gherkin (~> 2.7.1)
  59 + json (>= 1.4.6)
  60 + term-ansicolor (>= 1.0.6)
  61 + cucumber-rails (1.2.1)
  62 + capybara (>= 1.1.2)
  63 + cucumber (>= 1.1.3)
  64 + nokogiri (>= 1.5.0)
  65 + daemons (1.1.8)
  66 + diff-lcs (1.1.3)
  67 + em-websocket (0.3.6)
  68 + addressable (>= 2.1.1)
  69 + eventmachine (>= 0.12.9)
40 70 erubis (2.7.0)
41   - execjs (1.3.0)
42   - multi_json (~> 1.0)
  71 + eventmachine (0.12.10)
  72 + ffi (1.0.11)
  73 + gherkin (2.7.7)
  74 + json (>= 1.4.6)
43 75 hike (1.2.1)
44 76 i18n (0.6.0)
45 77 journey (1.0.1)
@@ -49,7 +81,10 @@ GEM
49 81 mime-types (~> 1.16)
50 82 treetop (~> 1.4.8)
51 83 mime-types (1.17.2)
  84 + mocha (0.9.8)
  85 + rake
52 86 multi_json (1.0.4)
  87 + nokogiri (1.5.0)
53 88 polyglot (0.3.3)
54 89 rack (1.4.1)
55 90 rack-cache (1.1)
@@ -76,30 +111,53 @@ GEM
76 111 rake (0.9.2.2)
77 112 rdoc (3.12)
78 113 json (~> 1.4)
79   - sass (3.1.15)
80   - sass-rails (3.2.4)
81   - railties (~> 3.2.0)
82   - sass (>= 3.1.10)
83   - tilt (~> 1.3)
  114 + rspec (2.8.0)
  115 + rspec-core (~> 2.8.0)
  116 + rspec-expectations (~> 2.8.0)
  117 + rspec-mocks (~> 2.8.0)
  118 + rspec-core (2.8.0)
  119 + rspec-expectations (2.8.0)
  120 + diff-lcs (~> 1.1.2)
  121 + rspec-mocks (2.8.0)
  122 + rspec-rails (2.8.1)
  123 + actionpack (>= 3.0)
  124 + activesupport (>= 3.0)
  125 + railties (>= 3.0)
  126 + rspec (~> 2.8.0)
  127 + ruby-hmac (0.4.0)
  128 + rubyzip (0.9.6.1)
  129 + selenium-webdriver (2.19.0)
  130 + childprocess (>= 0.2.5)
  131 + ffi (~> 1.0.9)
  132 + multi_json (~> 1.0.4)
  133 + rubyzip
  134 + shoulda-matchers (1.0.0)
84 135 sprockets (2.1.2)
85 136 hike (~> 1.2)
86 137 rack (~> 1.0)
87 138 tilt (~> 1.1, != 1.3.0)
  139 + term-ansicolor (1.0.7)
  140 + thin (1.3.1)
  141 + daemons (>= 1.0.9)
  142 + eventmachine (>= 0.12.6)
  143 + rack (>= 1.0.0)
88 144 thor (0.14.6)
89 145 tilt (1.3.3)
90 146 treetop (1.4.10)
91 147 polyglot
92 148 polyglot (>= 0.3.1)
93 149 tzinfo (0.3.31)
94   - uglifier (1.2.3)
95   - execjs (>= 0.3.0)
96   - multi_json (>= 1.0.2)
  150 + xpath (0.1.4)
  151 + nokogiri (~> 1.3)
  152 + yajl-ruby (1.1.0)
97 153
98 154 PLATFORMS
99 155 ruby
100 156
101 157 DEPENDENCIES
102   - coffee-rails (~> 3.2.1)
  158 + bourne (= 1.0)
  159 + cucumber-rails (= 1.2.1)
  160 + pusher-fake!
103 161 rails (= 3.2.1)
104   - sass-rails (~> 3.2.3)
105   - uglifier (>= 1.0.3)
  162 + rspec-rails (= 2.8.1)
  163 + shoulda-matchers (= 1.0.0)
8 config/cucumber.yml
... ... @@ -0,0 +1,8 @@
  1 +<%
  2 +rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
  3 +rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
  4 +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
  5 +%>
  6 +default: <%= std_opts %> features
  7 +wip: --tags @wip:3 --wip features
  8 +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
30 features/support/env.rb
... ... @@ -0,0 +1,30 @@
  1 +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2 +# It is recommended to regenerate this file in the future when you upgrade to a
  3 +# newer version of cucumber-rails. Consider adding your own code to a new file
  4 +# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5 +# files.
  6 +
  7 +require 'cucumber/rails'
  8 +
  9 +# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
  10 +# order to ease the transition to Capybara we set the default here. If you'd
  11 +# prefer to use XPath just remove this line and adjust any selectors in your
  12 +# steps to use the XPath syntax.
  13 +Capybara.default_selector = :css
  14 +
  15 +# By default, any exception happening in your Rails application will bubble up
  16 +# to Cucumber so that your scenario will fail. This is a different from how
  17 +# your application behaves in the production environment, where an error page will
  18 +# be rendered instead.
  19 +#
  20 +# Sometimes we want to override this default behaviour and allow Rails to rescue
  21 +# exceptions and display an error page (just like when the app is running in production).
  22 +# Typical scenarios where you want to do this is when you test your error pages.
  23 +# There are two ways to allow Rails to rescue exceptions:
  24 +#
  25 +# 1) Tag your scenario (or feature) with @allow-rescue
  26 +#
  27 +# 2) Set the value below to true. Beware that doing this globally is not
  28 +# recommended as it will mask a lot of errors for you!
  29 +#
  30 +ActionController::Base.allow_rescue = false
65 lib/tasks/cucumber.rake
... ... @@ -0,0 +1,65 @@
  1 +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
  2 +# It is recommended to regenerate this file in the future when you upgrade to a
  3 +# newer version of cucumber-rails. Consider adding your own code to a new file
  4 +# instead of editing this one. Cucumber will automatically load all features/**/*.rb
  5 +# files.
  6 +
  7 +
  8 +unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
  9 +
  10 +vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
  11 +$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
  12 +
  13 +begin
  14 + require 'cucumber/rake/task'
  15 +
  16 + namespace :cucumber do
  17 + Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
  18 + t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
  19 + t.fork = true # You may get faster startup if you set this to false
  20 + t.profile = 'default'
  21 + end
  22 +
  23 + Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
  24 + t.binary = vendored_cucumber_bin
  25 + t.fork = true # You may get faster startup if you set this to false
  26 + t.profile = 'wip'
  27 + end
  28 +
  29 + Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
  30 + t.binary = vendored_cucumber_bin
  31 + t.fork = true # You may get faster startup if you set this to false
  32 + t.profile = 'rerun'
  33 + end
  34 +
  35 + desc 'Run all features'
  36 + task :all => [:ok, :wip]
  37 +
  38 + task :statsetup do
  39 + require 'rails/code_statistics'
  40 + ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
  41 + ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
  42 + end
  43 + end
  44 + desc 'Alias for cucumber:ok'
  45 + task :cucumber => 'cucumber:ok'
  46 +
  47 + task :default => :cucumber
  48 +
  49 + task :features => :cucumber do
  50 + STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
  51 + end
  52 +
  53 + # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
  54 + task 'db:test:prepare' do
  55 + end
  56 +
  57 + task :stats => 'cucumber:statsetup'
  58 +rescue LoadError
  59 + desc 'cucumber rake task not available (cucumber not installed)'
  60 + task :cucumber do
  61 + abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
  62 + end
  63 +end
  64 +
  65 +end
10 script/cucumber
... ... @@ -0,0 +1,10 @@
  1 +#!/usr/bin/env ruby
  2 +
  3 +vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
  4 +if vendored_cucumber_bin
  5 + load File.expand_path(vendored_cucumber_bin)
  6 +else
  7 + require 'rubygems' unless ENV['NO_RUBYGEMS']
  8 + require 'cucumber'
  9 + load Cucumber::BINARY
  10 +end
24 spec/spec_helper.rb
... ... @@ -0,0 +1,24 @@
  1 +# This file is copied to spec/ when you run 'rails generate rspec:install'
  2 +ENV["RAILS_ENV"] ||= 'test'
  3 +require File.expand_path("../../config/environment", __FILE__)
  4 +require 'rspec/rails'
  5 +require 'rspec/autorun'
  6 +
  7 +# Requires supporting ruby files with custom matchers and macros, etc,
  8 +# in spec/support/ and its subdirectories.
  9 +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  10 +
  11 +RSpec.configure do |config|
  12 + # ## Mock Framework
  13 + #
  14 + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
  15 + #
  16 + config.mock_with :mocha
  17 + # config.mock_with :flexmock
  18 + # config.mock_with :rr
  19 +
  20 + # If true, the base class of anonymous controllers will be inferred
  21 + # automatically. This will be the default behavior in future versions of
  22 + # rspec-rails.
  23 + config.infer_base_class_for_anonymous_controllers = false
  24 +end

0 comments on commit c4bde5f

Please sign in to comment.
Something went wrong with that request. Please try again.