Skip to content

Commit

Permalink
Merge pull request #86 from AlchemyCMS/move-test-deps
Browse files Browse the repository at this point in the history
Move test deps
  • Loading branch information
tvdeyen authored Aug 23, 2019
2 parents cc54b7c + ca63cc5 commit 4785622
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 52 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ gemspec
gem 'rails', '~> 6.0.0'
gem 'alchemy_cms', github: 'AlchemyCMS/alchemy_cms', branch: 'master'
gem 'sassc-rails'
gem 'awesome_nested_set', github: 'collectiveidea/awesome_nested_set'

unless ENV['CI']
gem 'pry'
Expand All @@ -18,9 +17,7 @@ group :test do
gem 'sqlite3' if ENV['DB'].nil? || ENV['DB'] == 'sqlite'
gem 'mysql2' if ENV['DB'] == 'mysql'
gem 'pg', '~> 1.0' if ENV['DB'] == 'postgresql'
gem 'simplecov', require: false
if ENV['TRAVIS']
gem "codeclimate-test-reporter", '~> 1.0', require: false
end
gem 'rails-controller-testing'
end
2 changes: 2 additions & 0 deletions alchemy-devise.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ Gem::Specification.new do |s|

s.add_development_dependency "capybara"
s.add_development_dependency "factory_bot_rails"
s.add_development_dependency "rails-controller-testing"
s.add_development_dependency "rspec-activemodel-mocks", "~> 1.0"
s.add_development_dependency "rspec-rails", "~> 4.0.0.beta2"
s.add_development_dependency "simplecov"

s.post_install_message =<<-MSG
In order to complete the installation or the upgrade of Alchemy::Devise run:
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/admin/users_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

module Alchemy
describe Admin::UsersController do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/base_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe Alchemy::BaseController do

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/user_sessions_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe Alchemy::UserSessionsController do
routes { Alchemy::Engine.routes }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/admin/users_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "Admin users feature." do

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

describe "Login: " do
context "If user is present" do
Expand Down
2 changes: 1 addition & 1 deletion spec/features/password_reset_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "Password reset feature." do
let(:user) { create(:alchemy_admin_user) }
Expand Down
2 changes: 1 addition & 1 deletion spec/features/security_feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "Security: " do
context "If user is present" do
Expand Down
2 changes: 1 addition & 1 deletion spec/libraries/ability_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
require 'cancan/matchers'

describe Alchemy::Permissions do
Expand Down
2 changes: 1 addition & 1 deletion spec/mailers/notifications_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

module Alchemy
describe Notifications do
Expand Down
2 changes: 1 addition & 1 deletion spec/models/user_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'
require 'alchemy/test_support/factories/page_factory'

module Alchemy
Expand Down
39 changes: 39 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require_relative './spec_helper'

# Configure Rails Environment
ENV["RAILS_ENV"] ||= "test"

require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rails-controller-testing'
require "rspec/rails"
require 'rspec/active_model/mocks'
require "capybara/rails"
require 'factory_bot'
require 'alchemy/test_support/controller_requests'
require 'alchemy/test_support/integration_helpers'
require 'alchemy/devise/test_support/factories'

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"
Capybara.default_driver = :rack_test
Capybara.default_selector = :css
Capybara.ignore_hidden_elements = false
ActiveJob::Base.queue_adapter = :test

ActiveSupport::Deprecation.silenced = true

RSpec.configure do |config|
config.infer_spec_type_from_file_location!
config.use_transactional_fixtures = true
config.include Devise::TestHelpers, :type => :controller
config.include Alchemy::TestSupport::ControllerRequests, :type => :controller
config.include Alchemy::Engine.routes.url_helpers
config.include FactoryBot::Syntax::Methods
config.include ActiveJob::TestHelper
[:controller, :feature, :request].each do |type|
config.include Alchemy::TestSupport::IntegrationHelpers, type: type
end
end
2 changes: 1 addition & 1 deletion spec/requests/admin/users_controller_request_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

RSpec.describe Alchemy::Admin::UsersController, type: :request do
before do
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/password_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "Password Routing" do
routes { Alchemy::Engine.routes }
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/session_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "Session Routing" do
routes { Alchemy::Engine.routes }
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/user_routing_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'spec_helper'
require 'rails_helper'

describe "User Routing" do
routes { Alchemy::Engine.routes }
Expand Down
40 changes: 5 additions & 35 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'simplecov'
if ENV['TRAVIS']
require "codeclimate-test-reporter"
Expand All @@ -7,42 +9,10 @@
add_filter '/lib/generators'
end

# Configure Rails Environment
ENV["RAILS_ENV"] ||= "test"

require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rspec/rails"
require 'rspec/active_model/mocks'
require "capybara/rails"
require 'factory_bot'
require 'alchemy/seeder'
require 'alchemy/test_support/controller_requests'
require 'alchemy/test_support/integration_helpers'
require 'alchemy/devise/test_support/factories'

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"
Capybara.default_driver = :rack_test
Capybara.default_selector = :css
Capybara.ignore_hidden_elements = false
ActiveJob::Base.queue_adapter = :test

ActiveSupport::Deprecation.silenced = true
require 'rspec/core'

RSpec.configure do |config|
config.infer_spec_type_from_file_location!
config.raise_errors_for_deprecations!
config.use_transactional_fixtures = true
config.include Devise::TestHelpers, :type => :controller
config.include Alchemy::TestSupport::ControllerRequests, :type => :controller
config.include Alchemy::Engine.routes.url_helpers
config.include FactoryBot::Syntax::Methods
config.include ActiveJob::TestHelper
[:controller, :feature, :request].each do |type|
config.include Alchemy::TestSupport::IntegrationHelpers, type: type
end
config.before(:suite) do
Alchemy::Seeder.seed!
end
config.run_all_when_everything_filtered = true
config.filter_run :focus
end

0 comments on commit 4785622

Please sign in to comment.