Skip to content

Commit

Permalink
Added testing gems.
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahW91 committed Apr 26, 2018
1 parent c8d9130 commit 14f06dc
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ dump.rdb
specimens.xls
species.xls
public/assets/
latest.dump
latest.dump
spec/examples.txt
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,24 @@ group :development do
gem 'capistrano-rbenv', require: false
gem 'capistrano-sidekiq', require: false, github: 'seuros/capistrano-sidekiq'
gem 'capistrano3-puma', require: false, github: 'seuros/capistrano-puma' # TODO: remove github once fixed version is officially deployed
gem 'spring' # Spring speeds up development by keeping your application running in the background
gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
gem 'minitest' # TODO: Replace by RSpec
gem 'minitest-fail-fast'
gem 'minitest-rails-capybara'
gem 'minitest-reporters'
gem 'rails-controller-testing'
gem 'selenium-webdriver' # TODO: Replace by phantom.js
gem 'simplecov'
gem 'webrat'
gem 'selenium-webdriver' # TODO: Replace by phantom.js
end

group :development, :test do
gem 'better_errors'
gem 'bullet' # Checks for n+1 queries
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'meta_request' # Supporting gem for Google Chrome Rails Panel
gem 'poltergeist'
gem 'rails_best_practices'
gem 'rspec-rails'
gem 'yard' # Documentation generation tool
end
76 changes: 40 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ GEM
public_suffix (>= 2.0.2, < 4.0)
airbrussh (1.3.0)
sshkit (>= 1.6.1, != 1.7.0)
ansi (1.5.0)
arel (7.1.4)
autoprefixer-rails (8.3.0)
execjs
Expand Down Expand Up @@ -669,6 +668,7 @@ GEM
sass-rails (>= 3.2)
chronic (0.10.2)
climate_control (0.2.0)
cliver (0.3.2)
code_analyzer (0.4.8)
sexp_processor
coderay (1.1.2)
Expand All @@ -682,12 +682,14 @@ GEM
concurrent-ruby (1.0.5)
connection_pool (2.2.1)
crass (1.0.4)
database_cleaner (1.7.0)
devise (4.4.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
diff-lcs (1.3)
docile (1.3.0)
erubi (1.7.1)
erubis (2.7.0)
Expand Down Expand Up @@ -718,6 +720,10 @@ GEM
json (2.1.0)
launchy (2.4.3)
addressable (~> 2.3)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
Expand All @@ -735,27 +741,6 @@ GEM
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
minitest-capybara (0.8.2)
capybara (~> 2.2)
minitest (~> 5.0)
rake
minitest-fail-fast (0.1.0)
minitest (~> 5)
minitest-metadata (0.6.0)
minitest (>= 4.7, < 6.0)
minitest-rails (3.0.0)
minitest (~> 5.8)
railties (~> 5.0)
minitest-rails-capybara (3.0.1)
capybara (~> 2.7)
minitest-capybara (~> 0.8)
minitest-metadata (~> 0.6)
minitest-rails (~> 3.0)
minitest-reporters (1.2.0)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
multi_json (1.13.1)
mustermann (1.0.2)
net-scp (1.2.1)
Expand All @@ -779,6 +764,10 @@ GEM
activerecord (>= 4.2)
activesupport (>= 4.2)
arel (>= 6)
poltergeist (1.17.0)
capybara (~> 2.1)
cliver (~> 0.3.1)
websocket-driver (>= 0.2.0)
public_suffix (3.0.2)
puma (3.11.4)
rack (2.0.4)
Expand All @@ -800,10 +789,6 @@ GEM
bundler (>= 1.3.0, < 2.0)
railties (= 5.0.0)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.1)
actionpack (~> 5.x)
actionview (~> 5.x)
activesupport (~> 5.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -839,8 +824,26 @@ GEM
nokogiri
roo (>= 2.0.0, < 3)
spreadsheet (> 0.9.0)
rspec-core (3.7.1)
rspec-support (~> 3.7.0)
rspec-expectations (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-mocks (3.7.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-rails (3.7.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
rspec-mocks (~> 3.7.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.1)
ruby-ole (1.2.12.1)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.6)
sass-listen (~> 4.0.0)
Expand Down Expand Up @@ -887,6 +890,11 @@ GEM
tilt (>= 1.3.3, < 2.1)
spreadsheet (1.1.7)
ruby-ole (>= 1.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand Down Expand Up @@ -915,10 +923,6 @@ GEM
uniform_notifier (1.11.0)
warden (1.2.7)
rack (>= 1.0)
webrat (0.7.3)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
websocket-driver (0.6.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand Down Expand Up @@ -949,8 +953,10 @@ DEPENDENCIES
capistrano-rbenv
capistrano-sidekiq!
capistrano3-puma!
capybara
chosen-rails
coffee-rails (~> 4.2)
database_cleaner
devise
jbuilder (~> 2.5)
jquery-datatables-rails!
Expand All @@ -961,19 +967,16 @@ DEPENDENCIES
launchy
meta_request
mime-types
minitest
minitest-fail-fast
minitest-rails-capybara
minitest-reporters
paperclip
pg (~> 0.21)
pg_search
poltergeist
puma (~> 3.0)
rails (= 5.0.0)
rails-controller-testing
rails_best_practices
redis (~> 3.0)
roo-xls
rspec-rails
rubyzip
sass-rails (~> 5.0)
scenic
Expand All @@ -985,10 +988,11 @@ DEPENDENCIES
simplecov
sinatra
slim
spring
spring-watcher-listen (~> 2.0.0)
sprockets-rails
tzinfo-data
uglifier (>= 1.3.0)
webrat
whenever
will_paginate (> 3.0)
will_paginate-bootstrap
Expand Down
81 changes: 81 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
require 'rspec/capybara'
require 'capybara/poltergeist'

Capybara.javascript_driver = :poltergeist

# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }

# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"

# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = false

# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!

# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")

config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end

config.before(:each) do
DatabaseCleaner.strategy = :transaction
end

config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end

config.before(:each) do
DatabaseCleaner.start
end

config.after(:each) do
DatabaseCleaner.clean
end
end
Loading

0 comments on commit 14f06dc

Please sign in to comment.