minitest-rails 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/Manifest.txt +20 -19
  2. data/README.rdoc +6 -6
  3. data/Rakefile +5 -4
  4. data/lib/generators/{mini_test.rb → minitest.rb} +2 -2
  5. data/lib/generators/{mini_test → minitest}/controller/controller_generator.rb +3 -3
  6. data/lib/generators/{mini_test → minitest}/controller/templates/controller_spec.rb +0 -0
  7. data/lib/generators/{mini_test → minitest}/controller/templates/controller_test.rb +1 -1
  8. data/lib/generators/{mini_test → minitest}/helper/helper_generator.rb +3 -3
  9. data/lib/generators/{mini_test → minitest}/helper/templates/helper_spec.rb +0 -0
  10. data/lib/generators/{mini_test → minitest}/helper/templates/helper_test.rb +1 -1
  11. data/lib/generators/{mini_test → minitest}/install/install_generator.rb +1 -1
  12. data/lib/generators/minitest/install/templates/test/minitest_helper.rb +61 -0
  13. data/lib/generators/{mini_test → minitest}/mailer/mailer_generator.rb +3 -3
  14. data/lib/generators/{mini_test → minitest}/mailer/templates/mailer_spec.rb +0 -0
  15. data/lib/generators/{mini_test → minitest}/mailer/templates/mailer_test.rb +1 -1
  16. data/lib/generators/{mini_test → minitest}/model/model_generator.rb +3 -3
  17. data/lib/generators/{mini_test → minitest}/model/templates/fixtures.yml +0 -0
  18. data/lib/generators/{mini_test → minitest}/model/templates/model_spec.rb +0 -0
  19. data/lib/generators/{mini_test → minitest}/model/templates/model_test.rb +1 -1
  20. data/lib/generators/{mini_test → minitest}/scaffold/scaffold_generator.rb +3 -3
  21. data/lib/generators/{mini_test → minitest}/scaffold/templates/controller_spec.rb +0 -0
  22. data/lib/generators/{mini_test → minitest}/scaffold/templates/controller_test.rb +1 -1
  23. data/lib/minitest-rails.rb +5 -5
  24. data/lib/minitest/rails.rb +1 -1
  25. data/lib/minitest/rails/controller.rb +91 -2
  26. data/lib/minitest/rails/fixtures.rb +14 -0
  27. data/lib/minitest/rails/helper.rb +23 -1
  28. data/lib/minitest/rails/mailer.rb +1 -1
  29. data/lib/minitest/rails/model.rb +1 -1
  30. data/lib/minitest/rails/spec.rb +2 -2
  31. data/test/test_controller_generator.rb +5 -5
  32. data/test/test_helper_generator.rb +5 -5
  33. data/test/test_install_generator.rb +13 -13
  34. data/test/test_mailer_generator.rb +5 -5
  35. data/test/test_minitest.rb +2 -2
  36. data/test/test_model_generator.rb +5 -5
  37. data/test/test_scaffold_generator.rb +5 -5
  38. metadata +34 -33
  39. data/lib/generators/mini_test/install/templates/test/minitest_helper.rb +0 -61
data/Manifest.txt CHANGED
@@ -3,28 +3,29 @@ CHANGELOG.rdoc
3
3
  Manifest.txt
4
4
  README.rdoc
5
5
  Rakefile
6
- lib/generators/mini_test.rb
7
- lib/generators/mini_test/controller/controller_generator.rb
8
- lib/generators/mini_test/controller/templates/controller_spec.rb
9
- lib/generators/mini_test/controller/templates/controller_test.rb
10
- lib/generators/mini_test/helper/helper_generator.rb
11
- lib/generators/mini_test/helper/templates/helper_spec.rb
12
- lib/generators/mini_test/helper/templates/helper_test.rb
13
- lib/generators/mini_test/install/install_generator.rb
14
- lib/generators/mini_test/install/templates/test/minitest_helper.rb
15
- lib/generators/mini_test/mailer/mailer_generator.rb
16
- lib/generators/mini_test/mailer/templates/mailer_spec.rb
17
- lib/generators/mini_test/mailer/templates/mailer_test.rb
18
- lib/generators/mini_test/model/model_generator.rb
19
- lib/generators/mini_test/model/templates/fixtures.yml
20
- lib/generators/mini_test/model/templates/model_spec.rb
21
- lib/generators/mini_test/model/templates/model_test.rb
22
- lib/generators/mini_test/scaffold/scaffold_generator.rb
23
- lib/generators/mini_test/scaffold/templates/controller_spec.rb
24
- lib/generators/mini_test/scaffold/templates/controller_test.rb
6
+ lib/generators/minitest.rb
7
+ lib/generators/minitest/controller/controller_generator.rb
8
+ lib/generators/minitest/controller/templates/controller_spec.rb
9
+ lib/generators/minitest/controller/templates/controller_test.rb
10
+ lib/generators/minitest/helper/helper_generator.rb
11
+ lib/generators/minitest/helper/templates/helper_spec.rb
12
+ lib/generators/minitest/helper/templates/helper_test.rb
13
+ lib/generators/minitest/install/install_generator.rb
14
+ lib/generators/minitest/install/templates/test/minitest_helper.rb
15
+ lib/generators/minitest/mailer/mailer_generator.rb
16
+ lib/generators/minitest/mailer/templates/mailer_spec.rb
17
+ lib/generators/minitest/mailer/templates/mailer_test.rb
18
+ lib/generators/minitest/model/model_generator.rb
19
+ lib/generators/minitest/model/templates/fixtures.yml
20
+ lib/generators/minitest/model/templates/model_spec.rb
21
+ lib/generators/minitest/model/templates/model_test.rb
22
+ lib/generators/minitest/scaffold/scaffold_generator.rb
23
+ lib/generators/minitest/scaffold/templates/controller_spec.rb
24
+ lib/generators/minitest/scaffold/templates/controller_test.rb
25
25
  lib/minitest-rails.rb
26
26
  lib/minitest/rails.rb
27
27
  lib/minitest/rails/controller.rb
28
+ lib/minitest/rails/fixtures.rb
28
29
  lib/minitest/rails/helper.rb
29
30
  lib/minitest/rails/mailer.rb
30
31
  lib/minitest/rails/model.rb
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = minitest-rails
2
2
 
3
- MiniTest integration for Rails 3.1.
3
+ Minitest integration for Rails 3.1.
4
4
 
5
5
  == Install
6
6
 
@@ -30,19 +30,19 @@ Or, for the truly enlightened, add <tt>minitest-rails</tt> to the <tt>:test</tt>
30
30
 
31
31
  Next run the installation generator with the following:
32
32
 
33
- rails generate mini_test:install
33
+ rails generate minitest:install
34
34
 
35
35
  This will add the <tt>minitest_helper.rb</tt> file to the <tt>test</tt> directory.
36
36
 
37
37
  == Usage
38
38
 
39
- We aim to expose MiniTest with minimal changes for testing within Rails.
40
- Your test classes will inherit from MiniTest::Rails::Spec (or Model, or Controller, etc) and you can use the MiniTest::Spec DSL.
39
+ We aim to expose Minitest with minimal changes for testing within Rails.
40
+ Your test classes will inherit from Minitest::Rails::Spec (or Model, or Controller, etc) and you can use the Minitest::Spec DSL.
41
41
  You can generate test files with the standard model, controller, scaffold, and other generators:
42
42
 
43
43
  rails generate model User
44
44
 
45
- And you can specify generating the tests using the MiniTest::Spec DSL on any of the generators by providing the <tt>--spec</tt> option:
45
+ And you can specify generating the tests using the Minitest::Spec DSL on any of the generators by providing the <tt>--spec</tt> option:
46
46
 
47
47
  rails generate model User --spec
48
48
 
@@ -53,5 +53,5 @@ And you can specify generating the fixture for a model by providing the <tt>--fi
53
53
  You can also set these as defaults by adding the following to the <tt>config/application.rb</tt> file:
54
54
 
55
55
  config.generators do |g|
56
- g.test_framework :mini_test, :spec => true, :fixture => true
56
+ g.test_framework :minitest, :spec => true, :fixture => true
57
57
  end
data/Rakefile CHANGED
@@ -4,20 +4,21 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
6
  Hoe.plugin :git
7
+ Hoe.plugin :gemspec
7
8
  Hoe.plugins.delete :rubyforge
8
9
 
9
10
  Hoe.spec 'minitest-rails' do
10
11
  developer 'Mike Moore', 'mike@blowmage.com'
11
12
 
12
- self.summary = 'MiniTest integration for Rails 3.'
13
- self.description = 'Adds MiniTest as the default testing library in Rails 3.'
14
- self.url = 'http://blowmage.com/minitest-rails'
13
+ self.summary = 'Minitest integration for Rails 3.'
14
+ self.description = 'Adds Minitest as the default testing library in Rails 3.'
15
+ self.urls = ['http://blowmage.com/minitest-rails']
15
16
 
16
17
  self.history_file = "CHANGELOG.rdoc"
17
18
  self.readme_file = "README.rdoc"
18
19
  self.testlib = :minitest
19
20
 
20
- extra_deps << ['minitest', '~> 2.11']
21
+ extra_deps << ['minitest', '~> 2.12']
21
22
  extra_deps << ['rails', '~> 3.1']
22
23
  end
23
24
 
@@ -1,10 +1,10 @@
1
1
  require 'rails/generators/named_base'
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class Base < ::Rails::Generators::NamedBase #:nodoc:
6
6
  def self.source_root
7
- @_minitest_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'mini_test', generator_name, 'templates'))
7
+ @_minitest_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'minitest', generator_name, 'templates'))
8
8
  end
9
9
  end
10
10
  end
@@ -1,10 +1,10 @@
1
- require "generators/mini_test"
1
+ require "generators/minitest"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class ControllerGenerator < Base
6
6
  argument :actions, :type => :array, :default => [], :banner => "action action"
7
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
7
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use Minitest::Spec DSL"
8
8
 
9
9
  check_class_collision :suffix => "ControllerTest"
10
10
 
@@ -1,7 +1,7 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>ControllerTest < MiniTest::Rails::Controller
4
+ class <%= class_name %>ControllerTest < Minitest::Rails::Controller
5
5
 
6
6
  <% if actions.empty? -%>
7
7
  def test_sanity
@@ -1,9 +1,9 @@
1
- require "generators/mini_test"
1
+ require "generators/minitest"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class HelperGenerator < Base
6
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
6
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use Minitest::Spec DSL"
7
7
 
8
8
  check_class_collision :suffix => "HelperTest"
9
9
 
@@ -1,7 +1,7 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>HelperTest < MiniTest::Rails::Helper
4
+ class <%= class_name %>HelperTest < Minitest::Rails::Helper
5
5
 
6
6
  def test_sanity
7
7
  flunk "Need real tests"
@@ -1,6 +1,6 @@
1
1
  require 'rails/generators'
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class InstallGenerator < ::Rails::Generators::Base
6
6
 
@@ -0,0 +1,61 @@
1
+ require "minitest/autorun"
2
+ require "minitest/rails"
3
+
4
+ # Uncomment if you want awesome colorful output
5
+ # require "minitest/pride"
6
+
7
+ ENV["RAILS_ENV"] = "test"
8
+ require File.expand_path('../../config/environment', __FILE__)
9
+
10
+ class Minitest::Rails::Spec
11
+ # Uncomment if you want to support fixtures for all specs
12
+ # or
13
+ # place within spec class you want to support fixtures for
14
+ # include Minitest::Rails::Fixtures
15
+
16
+ # For backward compatibility with Test::Unit
17
+ def build_message(message, template = nil, *args)
18
+ template = template.gsub('<?>', '<%s>')
19
+ message || sprintf(template, *args)
20
+ end
21
+
22
+ # Add methods to be used by all specs here...
23
+
24
+ end
25
+
26
+ class Minitest::Rails::Model
27
+
28
+ # Add methods to be used by model specs here...
29
+
30
+ end
31
+
32
+ Minitest::Spec.register_spec_type(Minitest::Rails::Model) do |desc|
33
+ desc.respond_to?(:superclass) && desc.superclass == ActiveRecord::Base
34
+ end
35
+
36
+ class Minitest::Rails::Controller
37
+
38
+ # Add methods to be used by controller specs here...
39
+
40
+ end
41
+
42
+ Minitest::Spec.register_spec_type(/Controller$/, Minitest::Rails::Controller)
43
+
44
+ class Minitest::Rails::Helper
45
+
46
+ # Add methods to be used by helper specs here...
47
+
48
+ end
49
+
50
+ Minitest::Spec.register_spec_type(/Helper$/, Minitest::Rails::Helper)
51
+
52
+ class Minitest::Rails::Mailer
53
+
54
+ # Add methods to be used by mailer specs here...
55
+
56
+ end
57
+
58
+ Minitest::Spec.register_spec_type(Minitest::Rails::Mailer) do |desc|
59
+ desc.respond_to?(:superclass) && desc.superclass == ActionMailer::Base
60
+ end
61
+
@@ -1,10 +1,10 @@
1
- require "generators/mini_test"
1
+ require "generators/minitest"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class MailerGenerator < Base
6
6
  argument :actions, :type => :array, :default => [], :banner => "method method"
7
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
7
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use Minitest::Spec DSL"
8
8
 
9
9
  check_class_collision :suffix => "MailerTest"
10
10
 
@@ -1,7 +1,7 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>Test < MiniTest::Rails::Mailer
4
+ class <%= class_name %>Test < Minitest::Rails::Mailer
5
5
  <% actions.each do |action| -%>
6
6
  def test_<%= action %>
7
7
  mail = <%= class_name %>.<%= action %>
@@ -1,11 +1,11 @@
1
- require "generators/mini_test"
1
+ require "generators/minitest"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Generators
5
5
  class ModelGenerator < Base
6
6
  argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
7
7
  class_option :fixture, :type => :boolean, :default => false, :desc => "Create fixture file"
8
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
8
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use Minitest::Spec DSL"
9
9
 
10
10
  check_class_collision :suffix => "Test"
11
11
 
@@ -1,7 +1,7 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>Test < MiniTest::Rails::Model
4
+ class <%= class_name %>Test < Minitest::Rails::Model
5
5
 
6
6
  def test_sanity
7
7
  flunk "Need real tests"
@@ -1,12 +1,12 @@
1
- require "generators/mini_test"
1
+ require "generators/minitest"
2
2
  require "rails/generators/resource_helpers"
3
3
 
4
- module MiniTest
4
+ module Minitest
5
5
  module Generators
6
6
  class ScaffoldGenerator < Base
7
7
  include ::Rails::Generators::ResourceHelpers
8
8
  argument :actions, :type => :array, :default => [], :banner => "action action"
9
- class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
9
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use Minitest::Spec DSL"
10
10
 
11
11
  check_class_collision :suffix => "ControllerTest"
12
12
 
@@ -1,7 +1,7 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  <% module_namespacing do -%>
4
- class <%= class_name %>ControllerTest < MiniTest::Rails::Controller
4
+ class <%= class_name %>ControllerTest < Minitest::Rails::Controller
5
5
  before do
6
6
  @<%= singular_table_name %> = <%= table_name %>(:one)
7
7
  end
@@ -1,13 +1,13 @@
1
1
  require "rails"
2
2
  require "minitest/unit"
3
3
 
4
- module MiniTest
4
+ module Minitest
5
5
  module Rails
6
- VERSION = "0.0.6"
6
+ VERSION = "0.0.7"
7
7
  class Railtie < ::Rails::Railtie
8
- # config.app_generators.integration_tool :mini_test
9
- config.app_generators.test_framework :mini_test
10
- config.app_generators.fallbacks[:mini_test] = :test_unit
8
+ # config.app_generators.integration_tool :minitest
9
+ config.app_generators.test_framework :minitest
10
+ config.app_generators.fallbacks[:minitest] = :test_unit
11
11
 
12
12
  rake_tasks do
13
13
  load "minitest/rails/tasks/minitest.rake"
@@ -2,4 +2,4 @@ require "minitest/rails/model"
2
2
  require "minitest/rails/controller"
3
3
  require "minitest/rails/helper"
4
4
  require "minitest/rails/mailer"
5
- require "minitest/rails/fixtures"
5
+ require "minitest/rails/fixtures" if defined?(ActiveRecord::Base)
@@ -1,15 +1,104 @@
1
1
  require "minitest/rails/spec"
2
2
  require "active_support/test_case"
3
+ require "action_controller"
3
4
  require "action_controller/test_case"
4
5
 
5
- module MiniTest
6
+ module Minitest
6
7
  module Rails
7
8
  class Controller < Spec
8
9
  include ActiveSupport::Testing::SetupAndTeardown
9
10
  include ActionController::TestCase::Behavior
11
+
10
12
  before do
11
- @routes = Rails.application.routes
13
+ @routes = ::Rails.application.routes
14
+ end
15
+
16
+ class << self
17
+
18
+ # Define a concrete anonymous controller class for testing.
19
+ #
20
+ # The purpose is to test abstract controllers and in particular
21
+ # ApplicationController. For the anonymous controller
22
+ # rendering of templates is disabled. During tests, the routes
23
+ # are redefined to
24
+ #
25
+ # resources :anonymous
26
+ #
27
+ # base_controller - superclass for the anonymous controller.
28
+ # If not given, the controller is take from the context.
29
+ # If that doesn't work either, ApplicationController is used.
30
+ #
31
+ # Examples
32
+ #
33
+ # describe ApplicationController do
34
+ # controller
35
+ #
36
+ # it "assigns the current_user" do
37
+ # get :index
38
+ # assigns(:current_user).wont_be_nil
39
+ # end
40
+ # end
41
+ #
42
+ #
43
+ def controller(base_controller = nil, &block)
44
+ anonymous = anonymous_controller_class(base_controller)
45
+ anonymous.class_eval(&block) if block_given?
46
+ setup_temporary_anonymous_routes
47
+ self.controller_class = anonymous
48
+ end
49
+
50
+ private
51
+
52
+ def anonymous_controller_class(base_controller = nil)
53
+ return @anonymous_controller_class if defined?(@anonymous_controller_class)
54
+
55
+ base_controller ||= described_controller
56
+
57
+ Class.new(base_controller) do
58
+ def index; end
59
+ def show; end
60
+ def new; end
61
+ def create; end
62
+ def edit; end
63
+ def update; end
64
+ def destroy; end
65
+
66
+ def render
67
+ # suppress rendering
68
+ end
69
+
70
+ def self.anonymous?
71
+ false
72
+ end
73
+
74
+ def self.name
75
+ 'anonymous'
76
+ end
77
+ end
78
+ end
79
+
80
+ def described_controller
81
+ if @desc.respond_to?(:<) && @desc <= ActionController::Base
82
+ @desc
83
+ else
84
+ ApplicationController
85
+ end
86
+ end
87
+
88
+ def setup_temporary_anonymous_routes
89
+ return if defined?(@orig_routes) # We've been here already.
90
+
91
+ before do
92
+ @orig_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
93
+ @routes.draw { resources :anonymous }
94
+ end
95
+
96
+ after do
97
+ @routes, @orig_routes = @orig_routes, nil
98
+ end
99
+ end
12
100
  end
101
+
13
102
  end
14
103
  end
15
104
  end
@@ -0,0 +1,14 @@
1
+ module Minitest
2
+ module Rails
3
+ module Fixtures
4
+ def self.included(klass)
5
+ klass.class_eval do
6
+ include ActiveSupport::Testing::SetupAndTeardown
7
+ include ActiveRecord::TestFixtures
8
+ self.fixture_path = File.join(::Rails.root, "test", "fixtures")
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -1,8 +1,30 @@
1
1
  require "minitest/rails/spec"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Rails
5
5
  class Helper < Spec
6
+ include ActiveSupport::Testing::SetupAndTeardown
7
+ include ActionView::TestCase::Behavior
8
+
9
+ def self.helper_class
10
+ # As of Rails 3.2.3, the original implementation breaks
11
+ # for nested contexts as it appends context names.
12
+ # We need to determine the name of the top-level context.
13
+
14
+ context_class = self
15
+ context_super = context_class.superclass
16
+
17
+ while context_super && context_super != Minitest::Rails::Helper
18
+ context_class = context_super
19
+ context_super = context_super.superclass
20
+ end
21
+
22
+ if context_class
23
+ @helper_class ||= determine_default_helper_class(context_class.name)
24
+ else
25
+ super
26
+ end
27
+ end
6
28
  end
7
29
  end
8
30
  end
@@ -1,6 +1,6 @@
1
1
  require "minitest/rails/spec"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Rails
5
5
  class Mailer < Spec
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "minitest/rails/spec"
2
2
 
3
- module MiniTest
3
+ module Minitest
4
4
  module Rails
5
5
  class Model < Spec
6
6
  end
@@ -2,9 +2,9 @@ require "minitest/unit"
2
2
  require "minitest/spec"
3
3
  require "minitest/mock"
4
4
 
5
- module MiniTest
5
+ module Minitest
6
6
  module Rails
7
- class Spec < ::MiniTest::Spec
7
+ class Spec < ::Minitest::Spec
8
8
  alias :method_name :__name__ if defined? :__name__
9
9
  class << self
10
10
  alias :context :describe
@@ -4,21 +4,21 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/controller/controller_generator"
7
+ require "generators/minitest/controller/controller_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestControllerGenerator < MiniTest::Unit::TestCase
11
+ class TestControllerGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_controller_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::ControllerGenerator.start ["user"]
16
+ Minitest::Generators::ControllerGenerator.start ["user"]
17
17
  end
18
18
  assert_match(/create test\/controllers\/user_controller_test.rb/m, text)
19
19
  assert File.exists? "test/controllers/user_controller_test.rb"
20
20
  contents = open("test/controllers/user_controller_test.rb").read
21
- assert_match(/class UserControllerTest < MiniTest::Rails::Controller/m, contents)
21
+ assert_match(/class UserControllerTest < Minitest::Rails::Controller/m, contents)
22
22
  assert_match(/def test_sanity/m, contents)
23
23
  ensure
24
24
  # TODO: Don"t write the files
@@ -28,7 +28,7 @@ class TestControllerGenerator < MiniTest::Unit::TestCase
28
28
 
29
29
  def test_controller_generator_spec
30
30
  text = capture(:stdout) do
31
- MiniTest::Generators::ControllerGenerator.start ["user", "--spec"]
31
+ Minitest::Generators::ControllerGenerator.start ["user", "--spec"]
32
32
  end
33
33
  assert_match(/create test\/controllers\/user_controller_test.rb/m, text)
34
34
  assert File.exists? "test/controllers/user_controller_test.rb"
@@ -4,21 +4,21 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/helper/helper_generator"
7
+ require "generators/minitest/helper/helper_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestHelperGenerator < MiniTest::Unit::TestCase
11
+ class TestHelperGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_helper_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::HelperGenerator.start ["user"]
16
+ Minitest::Generators::HelperGenerator.start ["user"]
17
17
  end
18
18
  assert_match(/create test\/helpers\/user_helper_test.rb/m, text)
19
19
  assert File.exists? "test/helpers/user_helper_test.rb"
20
20
  contents = open("test/helpers/user_helper_test.rb").read
21
- assert_match(/class UserHelperTest < MiniTest::Rails::Helper/m, contents)
21
+ assert_match(/class UserHelperTest < Minitest::Rails::Helper/m, contents)
22
22
  ensure
23
23
  # TODO: Don"t write the files
24
24
  # I agree, it would be better to mock the file getting written
@@ -27,7 +27,7 @@ class TestHelperGenerator < MiniTest::Unit::TestCase
27
27
 
28
28
  def test_helper_generator_spec
29
29
  text = capture(:stdout) do
30
- MiniTest::Generators::HelperGenerator.start ["user", "--spec"]
30
+ Minitest::Generators::HelperGenerator.start ["user", "--spec"]
31
31
  end
32
32
  assert_match(/create test\/helpers\/user_helper_test.rb/m, text)
33
33
  assert File.exists? "test/helpers/user_helper_test.rb"
@@ -4,30 +4,30 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/install/install_generator"
7
+ require "generators/minitest/install/install_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestInstallGenerator < MiniTest::Unit::TestCase
11
+ class TestInstallGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_install_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::InstallGenerator.start
16
+ Minitest::Generators::InstallGenerator.start
17
17
  end
18
18
  assert_match(/create test\/minitest_helper.rb/m, text)
19
19
  assert File.exists? "test/minitest_helper.rb"
20
20
  contents = open("test/minitest_helper.rb").read
21
- assert_match(/class MiniTest::Rails::Spec/m, contents)
22
- assert_match(/# include MiniTest::Rails::Fixtures/m, contents)
23
- assert_match(/class MiniTest::Rails::Model/m, contents)
24
- assert_match(/MiniTest::Spec.register_spec_type\(MiniTest::Rails::Model\) do/m, contents)
25
- assert_match(/class MiniTest::Rails::Controller/m, contents)
26
- assert_match(/MiniTest::Spec.register_spec_type\(\/Controller\$\/, MiniTest::Rails::Controller\)/m, contents)
27
- assert_match(/class MiniTest::Rails::Helper/m, contents)
28
- assert_match(/MiniTest::Spec.register_spec_type\(\/Helper\$\/, MiniTest::Rails::Helper\)/m, contents)
29
- assert_match(/class MiniTest::Rails::Mailer/m, contents)
30
- assert_match(/MiniTest::Spec.register_spec_type\(MiniTest::Rails::Mailer\) do/m, contents)
21
+ assert_match(/class Minitest::Rails::Spec/m, contents)
22
+ assert_match(/# include Minitest::Rails::Fixtures/m, contents)
23
+ assert_match(/class Minitest::Rails::Model/m, contents)
24
+ assert_match(/Minitest::Spec.register_spec_type\(Minitest::Rails::Model\) do/m, contents)
25
+ assert_match(/class Minitest::Rails::Controller/m, contents)
26
+ assert_match(/Minitest::Spec.register_spec_type\(\/Controller\$\/, Minitest::Rails::Controller\)/m, contents)
27
+ assert_match(/class Minitest::Rails::Helper/m, contents)
28
+ assert_match(/Minitest::Spec.register_spec_type\(\/Helper\$\/, Minitest::Rails::Helper\)/m, contents)
29
+ assert_match(/class Minitest::Rails::Mailer/m, contents)
30
+ assert_match(/Minitest::Spec.register_spec_type\(Minitest::Rails::Mailer\) do/m, contents)
31
31
  ensure
32
32
  # TODO: Don"t write the files
33
33
  # I agree, it would be better to mock the file getting written
@@ -4,21 +4,21 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/mailer/mailer_generator"
7
+ require "generators/minitest/mailer/mailer_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestMailerGenerator < MiniTest::Unit::TestCase
11
+ class TestMailerGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_mailer_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::MailerGenerator.start ["notification"]
16
+ Minitest::Generators::MailerGenerator.start ["notification"]
17
17
  end
18
18
  assert_match(/create test\/mailers\/notification_test.rb/m, text)
19
19
  assert File.exists? "test/mailers/notification_test.rb"
20
20
  contents = open("test/mailers/notification_test.rb").read
21
- assert_match(/class NotificationTest < MiniTest::Rails::Mailer/m, contents)
21
+ assert_match(/class NotificationTest < Minitest::Rails::Mailer/m, contents)
22
22
  ensure
23
23
  # TODO: Don"t write the files
24
24
  # I agree, it would be better to mock the file getting written
@@ -27,7 +27,7 @@ class TestMailerGenerator < MiniTest::Unit::TestCase
27
27
 
28
28
  def test_mailer_generator_spec
29
29
  text = capture(:stdout) do
30
- MiniTest::Generators::MailerGenerator.start ["notification", "welcome", "--spec"]
30
+ Minitest::Generators::MailerGenerator.start ["notification", "welcome", "--spec"]
31
31
  end
32
32
  assert_match(/create test\/mailers\/notification_test.rb/m, text)
33
33
  assert File.exists? "test/mailers/notification_test.rb"
@@ -1,8 +1,8 @@
1
1
  require "minitest/autorun"
2
2
  require "minitest-rails"
3
3
 
4
- class TestMiniTest < MiniTest::Unit::TestCase
4
+ class TestMinitest < Minitest::Unit::TestCase
5
5
  def test_sanity
6
- assert MiniTest::Rails::VERSION
6
+ assert Minitest::Rails::VERSION
7
7
  end
8
8
  end
@@ -4,21 +4,21 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/model/model_generator"
7
+ require "generators/minitest/model/model_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestModelGenerator < MiniTest::Unit::TestCase
11
+ class TestModelGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_model_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::ModelGenerator.start ["user"]
16
+ Minitest::Generators::ModelGenerator.start ["user"]
17
17
  end
18
18
  assert_match(/create test\/models\/user_test.rb/m, text)
19
19
  assert File.exists? "test/models/user_test.rb"
20
20
  contents = open("test/models/user_test.rb").read
21
- assert_match(/class UserTest < MiniTest::Rails::Model/m, contents)
21
+ assert_match(/class UserTest < Minitest::Rails::Model/m, contents)
22
22
  ensure
23
23
  # TODO: Don"t write the files
24
24
  # I agree, it would be better to mock the file getting written
@@ -27,7 +27,7 @@ class TestModelGenerator < MiniTest::Unit::TestCase
27
27
 
28
28
  def test_model_generator_spec
29
29
  text = capture(:stdout) do
30
- MiniTest::Generators::ModelGenerator.start ["user", "--spec"]
30
+ Minitest::Generators::ModelGenerator.start ["user", "--spec"]
31
31
  end
32
32
  assert_match(/create test\/models\/user_test.rb/m, text)
33
33
  assert File.exists? "test/models/user_test.rb"
@@ -4,21 +4,21 @@ require "minitest-rails"
4
4
  require "rails"
5
5
  require "rails/generators"
6
6
 
7
- require "generators/mini_test/scaffold/scaffold_generator"
7
+ require "generators/minitest/scaffold/scaffold_generator"
8
8
 
9
9
  require "fileutils"
10
10
 
11
- class TestScaffoldGenerator < MiniTest::Unit::TestCase
11
+ class TestScaffoldGenerator < Minitest::Unit::TestCase
12
12
  Rails::Generators.no_color!
13
13
 
14
14
  def test_scaffold_generator
15
15
  text = capture(:stdout) do
16
- MiniTest::Generators::ScaffoldGenerator.start ["user"]
16
+ Minitest::Generators::ScaffoldGenerator.start ["user"]
17
17
  end
18
18
  assert_match(/create test\/controllers\/user_controller_test.rb/m, text)
19
19
  assert File.exists? "test/controllers/user_controller_test.rb"
20
20
  contents = open("test/controllers/user_controller_test.rb").read
21
- assert_match(/class UserControllerTest < MiniTest::Rails::Controller/m, contents)
21
+ assert_match(/class UserControllerTest < Minitest::Rails::Controller/m, contents)
22
22
  assert_match(/def test_index/m, contents)
23
23
  ensure
24
24
  # TODO: Don"t write the files
@@ -28,7 +28,7 @@ class TestScaffoldGenerator < MiniTest::Unit::TestCase
28
28
 
29
29
  def test_scaffold_generator_spec
30
30
  text = capture(:stdout) do
31
- MiniTest::Generators::ScaffoldGenerator.start ["user", "--spec"]
31
+ Minitest::Generators::ScaffoldGenerator.start ["user", "--spec"]
32
32
  end
33
33
  assert_match(/create test\/controllers\/user_controller_test.rb/m, text)
34
34
  assert File.exists? "test/controllers/user_controller_test.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-14 00:00:00.000000000 Z
12
+ date: 2012-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &70095363735960 !ruby/object:Gem::Requirement
16
+ requirement: &70135710009180 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '2.11'
21
+ version: '2.12'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70095363735960
24
+ version_requirements: *70135710009180
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rails
27
- requirement: &70095363735520 !ruby/object:Gem::Requirement
27
+ requirement: &70135710008740 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70095363735520
35
+ version_requirements: *70135710008740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &70095363735080 !ruby/object:Gem::Requirement
38
+ requirement: &70135710008300 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,19 +43,19 @@ dependencies:
43
43
  version: '3.10'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70095363735080
46
+ version_requirements: *70135710008300
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hoe
49
- requirement: &70095363734640 !ruby/object:Gem::Requirement
49
+ requirement: &70135710007860 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '2.16'
54
+ version: '3.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70095363734640
58
- description: Adds MiniTest as the default testing library in Rails 3.
57
+ version_requirements: *70135710007860
58
+ description: Adds Minitest as the default testing library in Rails 3.
59
59
  email:
60
60
  - mike@blowmage.com
61
61
  executables: []
@@ -70,28 +70,29 @@ files:
70
70
  - Manifest.txt
71
71
  - README.rdoc
72
72
  - Rakefile
73
- - lib/generators/mini_test.rb
74
- - lib/generators/mini_test/controller/controller_generator.rb
75
- - lib/generators/mini_test/controller/templates/controller_spec.rb
76
- - lib/generators/mini_test/controller/templates/controller_test.rb
77
- - lib/generators/mini_test/helper/helper_generator.rb
78
- - lib/generators/mini_test/helper/templates/helper_spec.rb
79
- - lib/generators/mini_test/helper/templates/helper_test.rb
80
- - lib/generators/mini_test/install/install_generator.rb
81
- - lib/generators/mini_test/install/templates/test/minitest_helper.rb
82
- - lib/generators/mini_test/mailer/mailer_generator.rb
83
- - lib/generators/mini_test/mailer/templates/mailer_spec.rb
84
- - lib/generators/mini_test/mailer/templates/mailer_test.rb
85
- - lib/generators/mini_test/model/model_generator.rb
86
- - lib/generators/mini_test/model/templates/fixtures.yml
87
- - lib/generators/mini_test/model/templates/model_spec.rb
88
- - lib/generators/mini_test/model/templates/model_test.rb
89
- - lib/generators/mini_test/scaffold/scaffold_generator.rb
90
- - lib/generators/mini_test/scaffold/templates/controller_spec.rb
91
- - lib/generators/mini_test/scaffold/templates/controller_test.rb
73
+ - lib/generators/minitest.rb
74
+ - lib/generators/minitest/controller/controller_generator.rb
75
+ - lib/generators/minitest/controller/templates/controller_spec.rb
76
+ - lib/generators/minitest/controller/templates/controller_test.rb
77
+ - lib/generators/minitest/helper/helper_generator.rb
78
+ - lib/generators/minitest/helper/templates/helper_spec.rb
79
+ - lib/generators/minitest/helper/templates/helper_test.rb
80
+ - lib/generators/minitest/install/install_generator.rb
81
+ - lib/generators/minitest/install/templates/test/minitest_helper.rb
82
+ - lib/generators/minitest/mailer/mailer_generator.rb
83
+ - lib/generators/minitest/mailer/templates/mailer_spec.rb
84
+ - lib/generators/minitest/mailer/templates/mailer_test.rb
85
+ - lib/generators/minitest/model/model_generator.rb
86
+ - lib/generators/minitest/model/templates/fixtures.yml
87
+ - lib/generators/minitest/model/templates/model_spec.rb
88
+ - lib/generators/minitest/model/templates/model_test.rb
89
+ - lib/generators/minitest/scaffold/scaffold_generator.rb
90
+ - lib/generators/minitest/scaffold/templates/controller_spec.rb
91
+ - lib/generators/minitest/scaffold/templates/controller_test.rb
92
92
  - lib/minitest-rails.rb
93
93
  - lib/minitest/rails.rb
94
94
  - lib/minitest/rails/controller.rb
95
+ - lib/minitest/rails/fixtures.rb
95
96
  - lib/minitest/rails/helper.rb
96
97
  - lib/minitest/rails/mailer.rb
97
98
  - lib/minitest/rails/model.rb
@@ -130,7 +131,7 @@ rubyforge_project: minitest-rails
130
131
  rubygems_version: 1.8.16
131
132
  signing_key:
132
133
  specification_version: 3
133
- summary: MiniTest integration for Rails 3.
134
+ summary: Minitest integration for Rails 3.
134
135
  test_files:
135
136
  - test/test_controller_generator.rb
136
137
  - test/test_helper_generator.rb
@@ -1,61 +0,0 @@
1
- require "minitest/autorun"
2
- require "minitest/rails"
3
-
4
- # Uncomment if you want awesome colorful output
5
- # require "minitest/pride"
6
-
7
- ENV["RAILS_ENV"] = "test"
8
- require File.expand_path('../../config/environment', __FILE__)
9
-
10
- class MiniTest::Rails::Spec
11
- # Uncomment if you want to support fixtures for all specs
12
- # or
13
- # place within spec class you want to support fixtures for
14
- # include MiniTest::Rails::Fixtures
15
-
16
- # Add methods to be used by all specs here...
17
-
18
- end
19
-
20
- class MiniTest::Rails::Model
21
-
22
- # Add methods to be used by model specs here...
23
-
24
- end
25
-
26
- MiniTest::Spec.register_spec_type(MiniTest::Rails::Model) do |desc|
27
- desc.superclass == ActiveRecord::Base
28
- end
29
-
30
- class MiniTest::Rails::Controller
31
- include ActionController::TestCase::Behavior
32
- before do
33
- @request = ActionController::TestRequest.new
34
- @response = ActionController::TestResponse.new
35
- @routes = Rails.application.routes
36
- end
37
-
38
- # Add methods to be used by controller specs here...
39
-
40
- end
41
-
42
- MiniTest::Spec.register_spec_type(/Controller$/, MiniTest::Rails::Controller)
43
-
44
- class MiniTest::Rails::Helper
45
-
46
- # Add methods to be used by helper specs here...
47
-
48
- end
49
-
50
- MiniTest::Spec.register_spec_type(/Helper$/, MiniTest::Rails::Helper)
51
-
52
- class MiniTest::Rails::Mailer
53
-
54
- # Add methods to be used by mailer specs here...
55
-
56
- end
57
-
58
- MiniTest::Spec.register_spec_type(MiniTest::Rails::Mailer) do |desc|
59
- desc.superclass == ActionMailer::Base
60
- end
61
-