Permalink
Browse files

Merge pull request #17 from bousquet/consolidate-configs

Consolidate configs from minitest-helper to gem
  • Loading branch information...
2 parents 374e66c + d551078 commit ccd68e046a65a1304f09a93f854205363bffff52 @phlipper phlipper committed Oct 24, 2012
View
@@ -1,4 +1,4 @@
-source 'https://rubygems.org'
+source :rubygems
# Specify your gem's dependencies in thincloud-test.gemspec
gemspec
@@ -0,0 +1,10 @@
+require "minitest/rails/capybara"
+
+class MiniTest::Rails::ActionDispatch::IntegrationTest
+
+ # Public: Reset the Capybara session after every run.
+ teardown do
+ Capybara.reset_sessions!
+ end
+
+end
@@ -1,3 +1,4 @@
class MiniTest::Spec
include FactoryGirl::Syntax::Methods
end
+FactoryGirl.find_definitions
@@ -0,0 +1,8 @@
+class MiniTest::Rails::ActiveSupport::TestCase
+
+ # Register any classes that respond to validate to a specific test class
+ Minitest::Spec.register_spec_type(self) do |desc|
+ desc.respond_to?(:validate)
+ end
+
+end
@@ -11,23 +11,9 @@
end
ENV["RAILS_ENV"] = "test"
-require File.expand_path('../../config/environment', __FILE__)
+require File.expand_path("../../config/environment", __FILE__)
-require "database_cleaner" # reset database on each test run
-
-require "minitest/autorun"
-require "minitest/rails"
-require "minitest/pride" # Provides awesome colorful output
-require "minitest-rails-shoulda" # shoulda matchers
-
-# Uncomment if you want Capybara in accceptance/integration tests
-# require "minitest/rails/capybara"
-
-require "mocha" # mocks and stubs
-
-# use factories instead of fixtures
-require "factory_girl"
-FactoryGirl.find_definitions
+require "thincloud-test"
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
@@ -0,0 +1,12 @@
+class RoutingSpec < MiniTest::Rails::ActiveSupport::TestCase
+ include ::ActionDispatch::Assertions::RoutingAssertions
+ include ::Rails.application.routes.url_helpers
+
+ # Test subjects containing 'Routes' are treated as Routing tests
+ # e.g. describe "Product Routes" do ...
+ register_spec_type /Routes/, self
+
+ before do
+ @routes = ::Rails.application.routes
+ end
+end
@@ -15,8 +15,11 @@ def test
remove_file "test/minitest_helper.rb"
copy_file "minitest_helper.rb", "test/minitest_helper.rb"
- copy_file "factory_girl.rb", "test/support/factory_girl.rb"
+ copy_file "capybara.rb", "test/support/capybara.rb"
+ copy_file "factory_girl.rb", "test/support/factory_girl.rb"
copy_file "database_cleaner.rb", "test/support/database_cleaner.rb"
+ copy_file "minitest.rb", "test/support/minitest.rb"
+ copy_file "routing_spec.rb", "test/support/routing_spec.rb"
copy_file "test.rake", "lib/tasks/test.rake"
copy_file "Guardfile"
View
@@ -1,5 +1,12 @@
-require "thincloud/test/version"
-require "thincloud/test/engine"
+require "database_cleaner" # reset database on each test run
+require "minitest/autorun"
+require "minitest/rails"
+require "minitest/pride" # Provides awesome colorful output
+require "minitest-rails-shoulda"
+
+require "thincloud/test"
+require "mocha"
+require "factory_girl"
module Thincloud
module Test
View
@@ -0,0 +1,2 @@
+require "thincloud/test/version"
+require "thincloud/test/engine"
View
@@ -16,16 +16,17 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]
s.version = Thincloud::Test::VERSION
- s.add_dependency "rails", "~> 3.2.8"
- s.add_dependency "cane", "~> 2.3.0"
- s.add_dependency "database_cleaner", "~> 0.8.0"
- s.add_dependency "guard", "~> 1.4.0"
- s.add_dependency "factory_girl_rails", "~> 4.1.0"
- s.add_dependency "minitest", "~> 3.5.0"
- s.add_dependency "guard-minitest", "~> 0.5.0"
- s.add_dependency "minitest-rails", "~> 0.2.0"
- s.add_dependency "minitest-rails-shoulda", "~> 0.2.0"
- s.add_dependency "rb-fsevent", "~> 0.9.1"
- s.add_dependency "simplecov", "~> 0.6.4"
- s.add_dependency "mocha", "~> 0.12.5" # Must be after minitest
+ s.add_dependency "rails", "~> 3.2.8"
+ s.add_dependency "cane", "~> 2.3.0"
+ s.add_dependency "database_cleaner", "~> 0.8.0"
+ s.add_dependency "guard", "~> 1.4.0"
+ s.add_dependency "factory_girl_rails", "~> 4.1.0"
+ s.add_dependency "minitest", "~> 3.5.0"
+ s.add_dependency "guard-minitest", "~> 0.5.0"
+ s.add_dependency "minitest-rails-shoulda", "~> 0.3.0"
+ s.add_dependency "rb-fsevent", "~> 0.9.1"
+ s.add_dependency "simplecov", "~> 0.7.1"
+ s.add_dependency "mocha", "~> 0.12.7" # Must be after minitest
+ s.add_dependency "minitest-rails-capybara", "~> 0.1"
+
end

0 comments on commit ccd68e0

Please sign in to comment.