Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Consolidate configs from minitest-helper to gem #17

Merged
merged 3 commits into from over 1 year ago

3 participants

Robert Bousquet Phil Cohen Don Morrison
Robert Bousquet
Owner

No description provided.

lib/generators/thincloud/test/templates/factory_girl.rb
... ...
@@ -1,3 +1,4 @@
1 1
 class MiniTest::Spec
  2
+  FactoryGirl.find_definitions
1
Phil Cohen Owner
phlipper added a note

Move this outside of the class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
thincloud-test.gemspec
((10 lines not shown))
25  
-  s.add_dependency "guard-minitest", "~> 0.5.0"
26  
-  s.add_dependency "minitest-rails", "~> 0.2.0"
27  
-  s.add_dependency "minitest-rails-shoulda", "~> 0.2.0"
28  
-  s.add_dependency "rb-fsevent", "~> 0.9.1"
29  
-  s.add_dependency "simplecov", "~> 0.6.4"
30  
-  s.add_dependency "mocha", "~> 0.12.5" # Must be after minitest
  19
+  s.add_dependency "rails",                   "~> 3.2.8"
  20
+  s.add_dependency "cane",                    "~> 2.3.0"
  21
+  s.add_dependency "database_cleaner",        "~> 0.8.0"
  22
+  s.add_dependency "guard",                   "~> 1.4.0"
  23
+  s.add_dependency "factory_girl_rails",      "~> 4.1.0"
  24
+  s.add_dependency "minitest",                "~> 3.5.0"
  25
+  s.add_dependency "guard-minitest",          "~> 0.5.0"
  26
+  s.add_dependency "minitest-rails-shoulda",  "~> 0.3.0"
  27
+  s.add_dependency "rb-fsevent",              "~> 0.9.1"
  28
+  s.add_dependency "simplecov",               "~> 0.6.4"
1
Phil Cohen Owner
phlipper added a note

bump me to 0.7.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
thincloud-test.gemspec
((11 lines not shown))
26  
-  s.add_dependency "minitest-rails", "~> 0.2.0"
27  
-  s.add_dependency "minitest-rails-shoulda", "~> 0.2.0"
28  
-  s.add_dependency "rb-fsevent", "~> 0.9.1"
29  
-  s.add_dependency "simplecov", "~> 0.6.4"
30  
-  s.add_dependency "mocha", "~> 0.12.5" # Must be after minitest
  19
+  s.add_dependency "rails",                   "~> 3.2.8"
  20
+  s.add_dependency "cane",                    "~> 2.3.0"
  21
+  s.add_dependency "database_cleaner",        "~> 0.8.0"
  22
+  s.add_dependency "guard",                   "~> 1.4.0"
  23
+  s.add_dependency "factory_girl_rails",      "~> 4.1.0"
  24
+  s.add_dependency "minitest",                "~> 3.5.0"
  25
+  s.add_dependency "guard-minitest",          "~> 0.5.0"
  26
+  s.add_dependency "minitest-rails-shoulda",  "~> 0.3.0"
  27
+  s.add_dependency "rb-fsevent",              "~> 0.9.1"
  28
+  s.add_dependency "simplecov",               "~> 0.6.4"
  29
+  s.add_dependency "mocha",                   "~> 0.12.5" # Must be after minitest
1
Phil Cohen Owner
phlipper added a note

bump to 0.12.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Don Morrison elskwid commented on the diff
lib/generators/thincloud/test/templates/minitest_helper.rb
((7 lines not shown))
16  
-require "database_cleaner"  # reset database on each test run
17  
-
18  
-require "minitest/autorun"
19  
-require "minitest/rails"
20  
-require "minitest/pride"          # Provides awesome colorful output
21  
-require "minitest-rails-shoulda"  # shoulda matchers
22  
-
23  
-# Uncomment if you want Capybara in accceptance/integration tests
24  
-# require "minitest/rails/capybara"
25  
-
26  
-require "mocha"  # mocks and stubs
27  
-
28  
-# use factories instead of fixtures
29  
-require "factory_girl"
30  
-FactoryGirl.find_definitions
  16
+require "thincloud-test"
31 17
 
6
Don Morrison Owner
elskwid added a note

We're forcing anyone that uses thincloud-test to use our setup here?

Phil Cohen Owner
phlipper added a note

It is opinionated software... What is an alternative?

Don Morrison Owner
elskwid added a note

More specifically, does the helper template give more flexibility than having these requirements buried in the gem?

Robert Bousquet Owner
bousquet added a note

I see thincloud-test as our configuration preferences for a test harness.

Robert Bousquet Owner
bousquet added a note

You could not require "thincloud-test" in the helper and manually load the components you want.

Don Morrison Owner
elskwid added a note

I'm not suggesting we cover every possibility. Maybe I should have said what I like about this …. we don't have to worry about updating the helper when we change thincloud-test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Don Morrison elskwid commented on the diff
lib/generators/thincloud/test/templates/minitest.rb
... ...
@@ -0,0 +1,8 @@
  1
+class MiniTest::Rails::ActiveSupport::TestCase
  2
+
  3
+  # Register any classes that respond to validate to a specific test class
1
Don Morrison Owner
elskwid added a note

Hooray! :rainbow:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Phil Cohen
Owner

Merging with @elskwid's blessing :pray::star2:

Phil Cohen phlipper merged commit ccd68e0 into from
Phil Cohen phlipper closed this
Don Morrison
Owner

:star2: okay :star2:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  Gemfile
... ...
@@ -1,4 +1,4 @@
1  
-source 'https://rubygems.org'
  1
+source :rubygems
2 2
 
3 3
 # Specify your gem's dependencies in thincloud-test.gemspec
4 4
 gemspec
10  lib/generators/thincloud/test/templates/capybara.rb
... ...
@@ -0,0 +1,10 @@
  1
+require "minitest/rails/capybara"
  2
+
  3
+class MiniTest::Rails::ActionDispatch::IntegrationTest
  4
+
  5
+  # Public: Reset the Capybara session after every run.
  6
+  teardown do
  7
+    Capybara.reset_sessions!
  8
+  end
  9
+
  10
+end
1  lib/generators/thincloud/test/templates/factory_girl.rb
... ...
@@ -1,3 +1,4 @@
1 1
 class MiniTest::Spec
2 2
   include FactoryGirl::Syntax::Methods
3 3
 end
  4
+FactoryGirl.find_definitions
8  lib/generators/thincloud/test/templates/minitest.rb
... ...
@@ -0,0 +1,8 @@
  1
+class MiniTest::Rails::ActiveSupport::TestCase
  2
+
  3
+  # Register any classes that respond to validate to a specific test class
  4
+  Minitest::Spec.register_spec_type(self) do |desc|
  5
+    desc.respond_to?(:validate)
  6
+  end
  7
+
  8
+end
18  lib/generators/thincloud/test/templates/minitest_helper.rb
@@ -11,23 +11,9 @@
11 11
 end
12 12
 
13 13
 ENV["RAILS_ENV"] = "test"
14  
-require File.expand_path('../../config/environment', __FILE__)
  14
+require File.expand_path("../../config/environment", __FILE__)
15 15
 
16  
-require "database_cleaner"  # reset database on each test run
17  
-
18  
-require "minitest/autorun"
19  
-require "minitest/rails"
20  
-require "minitest/pride"          # Provides awesome colorful output
21  
-require "minitest-rails-shoulda"  # shoulda matchers
22  
-
23  
-# Uncomment if you want Capybara in accceptance/integration tests
24  
-# require "minitest/rails/capybara"
25  
-
26  
-require "mocha"  # mocks and stubs
27  
-
28  
-# use factories instead of fixtures
29  
-require "factory_girl"
30  
-FactoryGirl.find_definitions
  16
+require "thincloud-test"
31 17
 
32 18
 # Requires supporting ruby files with custom matchers and macros, etc,
33 19
 # in spec/support/ and its subdirectories.
12  lib/generators/thincloud/test/templates/routing_spec.rb
... ...
@@ -0,0 +1,12 @@
  1
+class RoutingSpec < MiniTest::Rails::ActiveSupport::TestCase
  2
+  include ::ActionDispatch::Assertions::RoutingAssertions
  3
+  include ::Rails.application.routes.url_helpers
  4
+
  5
+  # Test subjects containing 'Routes' are treated as Routing tests
  6
+  #   e.g. describe "Product Routes" do ...
  7
+  register_spec_type /Routes/, self
  8
+
  9
+  before do
  10
+    @routes = ::Rails.application.routes
  11
+  end
  12
+end
5  lib/generators/thincloud/test/test_generator.rb
@@ -15,8 +15,11 @@ def test
15 15
         remove_file "test/minitest_helper.rb"
16 16
         copy_file "minitest_helper.rb", "test/minitest_helper.rb"
17 17
 
18  
-        copy_file "factory_girl.rb", "test/support/factory_girl.rb"
  18
+        copy_file "capybara.rb",         "test/support/capybara.rb"
  19
+        copy_file "factory_girl.rb",     "test/support/factory_girl.rb"
19 20
         copy_file "database_cleaner.rb", "test/support/database_cleaner.rb"
  21
+        copy_file "minitest.rb",         "test/support/minitest.rb"
  22
+        copy_file "routing_spec.rb",     "test/support/routing_spec.rb"
20 23
         copy_file "test.rake", "lib/tasks/test.rake"
21 24
 
22 25
         copy_file "Guardfile"
11  lib/thincloud-test.rb
... ...
@@ -1,5 +1,12 @@
1  
-require "thincloud/test/version"
2  
-require "thincloud/test/engine"
  1
+require "database_cleaner"  # reset database on each test run
  2
+require "minitest/autorun"
  3
+require "minitest/rails"
  4
+require "minitest/pride"          # Provides awesome colorful output
  5
+require "minitest-rails-shoulda"
  6
+
  7
+require "thincloud/test"
  8
+require "mocha"
  9
+require "factory_girl"
3 10
 
4 11
 module Thincloud
5 12
   module Test
2  lib/thincloud/test.rb
... ...
@@ -0,0 +1,2 @@
  1
+require "thincloud/test/version"
  2
+require "thincloud/test/engine"
25  thincloud-test.gemspec
@@ -16,16 +16,17 @@ Gem::Specification.new do |s|
16 16
   s.require_paths = ["lib"]
17 17
   s.version       = Thincloud::Test::VERSION
18 18
 
19  
-  s.add_dependency "rails", "~> 3.2.8"
20  
-  s.add_dependency "cane", "~> 2.3.0"
21  
-  s.add_dependency "database_cleaner", "~> 0.8.0"
22  
-  s.add_dependency "guard", "~> 1.4.0"
23  
-  s.add_dependency "factory_girl_rails", "~> 4.1.0"
24  
-  s.add_dependency "minitest", "~> 3.5.0"
25  
-  s.add_dependency "guard-minitest", "~> 0.5.0"
26  
-  s.add_dependency "minitest-rails", "~> 0.2.0"
27  
-  s.add_dependency "minitest-rails-shoulda", "~> 0.2.0"
28  
-  s.add_dependency "rb-fsevent", "~> 0.9.1"
29  
-  s.add_dependency "simplecov", "~> 0.6.4"
30  
-  s.add_dependency "mocha", "~> 0.12.5" # Must be after minitest
  19
+  s.add_dependency "rails",                   "~> 3.2.8"
  20
+  s.add_dependency "cane",                    "~> 2.3.0"
  21
+  s.add_dependency "database_cleaner",        "~> 0.8.0"
  22
+  s.add_dependency "guard",                   "~> 1.4.0"
  23
+  s.add_dependency "factory_girl_rails",      "~> 4.1.0"
  24
+  s.add_dependency "minitest",                "~> 3.5.0"
  25
+  s.add_dependency "guard-minitest",          "~> 0.5.0"
  26
+  s.add_dependency "minitest-rails-shoulda",  "~> 0.3.0"
  27
+  s.add_dependency "rb-fsevent",              "~> 0.9.1"
  28
+  s.add_dependency "simplecov",               "~> 0.7.1"
  29
+  s.add_dependency "mocha",                   "~> 0.12.7" # Must be after minitest
  30
+  s.add_dependency "minitest-rails-capybara", "~> 0.1"
  31
+
31 32
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.