From ef2409e38f24c1aeb084d72b1c79671b8f5132cf Mon Sep 17 00:00:00 2001 From: Tom Sabin Date: Sat, 22 Nov 2014 08:17:31 +0000 Subject: [PATCH] Add RSpec, Capybara & Poltergeist --- .rspec | 2 ++ Gemfile | 6 ++++++ Gemfile.lock | 38 +++++++++++++++++++++++++++++++++++++ config/environments/test.rb | 1 + spec/rails_helper.rb | 12 ++++++++++++ spec/spec_helper.rb | 13 +++++++++++++ 6 files changed, 72 insertions(+) create mode 100644 .rspec create mode 100644 spec/rails_helper.rb create mode 100644 spec/spec_helper.rb diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/Gemfile b/Gemfile index 8c097c4..c6c8929 100644 --- a/Gemfile +++ b/Gemfile @@ -9,6 +9,7 @@ gem 'turbolinks' gem 'rails_config' group :development, :test do + gem 'rspec-rails', '~> 3.0' gem 'pry' end @@ -16,4 +17,9 @@ group :development do gem 'spring' end +group :test do + gem 'capybara' + gem 'poltergeist' +end + ruby '2.1.5' diff --git a/Gemfile.lock b/Gemfile.lock index de605a5..c703b2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,6 +29,13 @@ GEM tzinfo (~> 1.1) arel (5.0.1.20140414130214) builder (3.2.2) + capybara (2.4.4) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + xpath (~> 2.0) + cliver (0.3.2) coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) @@ -37,6 +44,7 @@ GEM coffee-script-source execjs coffee-script-source (1.8.0) + diff-lcs (1.2.5) erubis (2.7.0) execjs (2.2.2) hike (1.2.3) @@ -49,9 +57,17 @@ GEM mime-types (>= 1.16, < 3) method_source (0.8.2) mime-types (2.4.3) + mini_portile (0.6.1) minitest (5.4.3) multi_json (1.10.1) + nokogiri (1.6.4.1) + mini_portile (~> 0.6.0) pg (0.17.1) + poltergeist (1.5.1) + capybara (~> 2.1) + cliver (~> 0.3.1) + multi_json (~> 1.0) + websocket-driver (>= 0.2.0) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) @@ -77,6 +93,22 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) + rspec-core (3.1.7) + rspec-support (~> 3.1.0) + rspec-expectations (3.1.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.1.0) + rspec-mocks (3.1.3) + rspec-support (~> 3.1.0) + rspec-rails (3.1.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.1.0) + rspec-expectations (~> 3.1.0) + rspec-mocks (~> 3.1.0) + rspec-support (~> 3.1.0) + rspec-support (3.1.2) sass (3.2.19) sass-rails (4.0.4) railties (>= 4.0.0, < 5.0) @@ -104,16 +136,22 @@ GEM uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) + websocket-driver (0.4.0) + xpath (2.0.0) + nokogiri (~> 1.3) PLATFORMS ruby DEPENDENCIES + capybara jquery-rails pg + poltergeist pry rails (= 4.1.8) rails_config + rspec-rails (~> 3.0) sass-rails (~> 4.0.3) spring turbolinks diff --git a/config/environments/test.rb b/config/environments/test.rb index 44971f5..242db69 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -9,4 +9,5 @@ config.action_controller.allow_forgery_protection = false config.action_mailer.delivery_method = :test config.active_support.deprecation = :stderr + config.allow_concurrency = false end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 0000000..8538e8e --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,12 @@ +ENV["RAILS_ENV"] ||= 'test' +require 'spec_helper' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' + +ActiveRecord::Migration.maintain_test_schema! + +RSpec.configure do |config| + config.fixture_path = "#{::Rails.root}/spec/fixtures" + config.use_transactional_fixtures = true + config.infer_spec_type_from_file_location! +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..76f278d --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,13 @@ +require 'capybara/rspec' +require 'capybara/poltergeist' +Capybara.javascript_driver = :poltergeist + +RSpec.configure do |config| + config.expect_with :rspec do |expectations| + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + config.mock_with :rspec do |mocks| + mocks.verify_partial_doubles = true + end +end