Skip to content

Commit

Permalink
Upgraded RSpec configuration files.
Browse files Browse the repository at this point in the history
  • Loading branch information
gsrohde committed Apr 20, 2016
1 parent 5de608c commit e726bb9
Show file tree
Hide file tree
Showing 46 changed files with 188 additions and 104 deletions.
4 changes: 3 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
--colour
--color
--require rails_helper # use this instead of spec_helper for now since most tests require the Rails environment

1 change: 0 additions & 1 deletion spec/controllers/bulk_upload_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe BulkUploadController, :type => :controller do

Expand Down
1 change: 0 additions & 1 deletion spec/controllers/sessions_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe SessionsController do

Expand Down
1 change: 0 additions & 1 deletion spec/controllers/static_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe StaticController do

Expand Down
1 change: 0 additions & 1 deletion spec/controllers/traits_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'
describe TraitsController do
let(:session) {
{user_id: 512127716}
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/treatments_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
Expand Down
1 change: 0 additions & 1 deletion spec/controllers/users_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe UsersController do

Expand Down
2 changes: 1 addition & 1 deletion spec/features/bulk_upload_integration_2_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper
include BulkUploadHelper

Expand Down
2 changes: 1 addition & 1 deletion spec/features/bulk_upload_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper
include BulkUploadHelper

Expand Down
2 changes: 1 addition & 1 deletion spec/features/citation_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Citation features work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/covariate_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Covariate pages work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/cultivars_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Cultivars index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/ensemble_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Ensembles work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/entitiy_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Entities index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/format_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Formats index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/input_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Inputs features work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/management_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Management features work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/method_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Methods index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/model_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Models features work' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/pft_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Pfts features work works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/posterior_search_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# test for redmine task #1908
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Posteriors search' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/prior_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper, AutocompletionHelper

feature 'Priors index works' do
Expand Down
1 change: 0 additions & 1 deletion spec/features/session_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe "Login page", :type => :request do
describe "GET /login" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/site_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Sites index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/specie_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Species pages work' do
Expand Down
6 changes: 0 additions & 6 deletions spec/features/static_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
require 'spec_helper'
include LoginHelper

feature 'Citation index works' do
# before :each do
# login_test_user
# end

context 'GET /' do
it 'should have "Welcome to BETYdb" ' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/trait_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper, AutocompletionHelper

feature 'Traits index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/treatment_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Treatment features work' do
Expand Down
1 change: 0 additions & 1 deletion spec/features/user_creation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe "Signup page", :type => :request do
describe "GET /signup" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/user_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Users index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/variable_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Variables index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/work_flow_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# the test for the work_flow page

require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Work_flow index works' do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/yield_integration_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'support/helpers'
include LoginHelper

feature 'Yields pages work' do
Expand Down
1 change: 0 additions & 1 deletion spec/helpers/sessions_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the SessionsHelper. For example:
Expand Down
1 change: 0 additions & 1 deletion spec/helpers/static_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the StaticHelper. For example:
Expand Down
1 change: 0 additions & 1 deletion spec/models/bulk_upload_data_set_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe BulkUploadDataSet do

Expand Down
1 change: 0 additions & 1 deletion spec/models/trait_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe Trait do
it 'should be invalid if no attributes are given' do
Expand Down
1 change: 0 additions & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'spec_helper'

describe User do
before { @user = User.new(login => "carlcrott", email => "user@gmail.com") }
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'
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 'spec_helper'
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
begin
require 'capybara/rails'
require 'capybara/rspec'
rescue => e
puts e.message
puts "Go to https://github.com/PecanProject/bety/wiki/Testing for instructions on setting up the testing environment."
exit
end

# 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 }

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 = true

# 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")

if ENV["RAILS_DEBUG"] == "true"
Bundler.require('debug')
Capybara.javascript_driver = :selenium
else
Bundler.require('javascript_testing')
Capybara.javascript_driver = :webkit

Capybara::Webkit.configure do |config|
config.block_unknown_urls
end

class Binding
def pry
puts "!!! binding.pry is for use with the Selenium JavaScript driver."
end
end
end

end

Loading

0 comments on commit e726bb9

Please sign in to comment.