minitest-rails 0.0.7 → 0.1.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +27 -25
- data/README.rdoc +6 -6
- data/Rakefile +3 -3
- data/lib/generators/{minitest.rb → mini_test.rb} +2 -2
- data/lib/generators/{minitest → mini_test}/controller/controller_generator.rb +3 -3
- data/lib/generators/{minitest/controller/templates/controller_test.rb → mini_test/controller/templates/controller_spec.rb} +6 -7
- data/lib/generators/mini_test/controller/templates/controller_test.rb +19 -0
- data/lib/generators/{minitest → mini_test}/helper/helper_generator.rb +3 -3
- data/lib/generators/{minitest → mini_test}/helper/templates/helper_spec.rb +0 -0
- data/lib/generators/{minitest → mini_test}/helper/templates/helper_test.rb +1 -1
- data/lib/generators/{minitest → mini_test}/install/install_generator.rb +1 -1
- data/lib/generators/mini_test/install/templates/test/minitest_helper.rb +15 -0
- data/lib/generators/mini_test/integration/integration_generator.rb +19 -0
- data/lib/generators/mini_test/integration/templates/integration_spec.rb +8 -0
- data/lib/generators/mini_test/integration/templates/integration_test.rb +7 -0
- data/lib/generators/{minitest → mini_test}/mailer/mailer_generator.rb +3 -3
- data/lib/generators/{minitest → mini_test}/mailer/templates/mailer_spec.rb +2 -2
- data/lib/generators/{minitest → mini_test}/mailer/templates/mailer_test.rb +5 -5
- data/lib/generators/{minitest → mini_test}/model/model_generator.rb +3 -3
- data/lib/generators/{minitest → mini_test}/model/templates/fixtures.yml +0 -0
- data/lib/generators/mini_test/model/templates/model_spec.rb +13 -0
- data/lib/generators/mini_test/model/templates/model_test.rb +9 -0
- data/lib/generators/{minitest → mini_test}/scaffold/scaffold_generator.rb +3 -3
- data/lib/generators/{minitest → mini_test}/scaffold/templates/controller_spec.rb +1 -5
- data/lib/generators/{minitest → mini_test}/scaffold/templates/controller_test.rb +3 -2
- data/lib/minitest-rails.rb +5 -5
- data/lib/minitest/rails.rb +40 -5
- data/lib/minitest/rails/action_controller.rb +17 -0
- data/lib/minitest/rails/action_dispatch.rb +21 -0
- data/lib/minitest/rails/action_mailer.rb +17 -0
- data/lib/minitest/rails/active_support.rb +62 -0
- data/lib/minitest/rails/tasks/minitest.rake +1 -1
- data/minitest-rails.gemspec +42 -0
- data/test/test_controller_generator.rb +5 -10
- data/test/test_helper_generator.rb +5 -5
- data/test/test_install_generator.rb +5 -13
- data/test/test_mailer_generator.rb +5 -6
- data/test/test_minitest.rb +2 -2
- data/test/test_model_generator.rb +5 -7
- data/test/test_scaffold_generator.rb +5 -8
- metadata +43 -41
- data/lib/generators/minitest/controller/templates/controller_spec.rb +0 -17
- data/lib/generators/minitest/install/templates/test/minitest_helper.rb +0 -61
- data/lib/generators/minitest/model/templates/model_spec.rb +0 -28
- data/lib/generators/minitest/model/templates/model_test.rb +0 -11
- data/lib/minitest/rails/controller.rb +0 -104
- data/lib/minitest/rails/fixtures.rb +0 -14
- data/lib/minitest/rails/helper.rb +0 -30
- data/lib/minitest/rails/mailer.rb +0 -8
- data/lib/minitest/rails/model.rb +0 -8
- data/lib/minitest/rails/spec.rb +0 -14
metadata
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.0.alpha
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mike Moore
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
requirement: &
|
16
|
+
requirement: &70157709898300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70157709898300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &70157709897860 !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: *
|
35
|
+
version_requirements: *70157709897860
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70157709897420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '3.10'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70157709897420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: hoe
|
49
|
-
requirement: &
|
49
|
+
requirement: &70157709896980 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,8 +54,8 @@ dependencies:
|
|
54
54
|
version: '3.0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
-
description: Adds
|
57
|
+
version_requirements: *70157709896980
|
58
|
+
description: Adds MiniTest as the default testing library in Rails 3.
|
59
59
|
email:
|
60
60
|
- mike@blowmage.com
|
61
61
|
executables: []
|
@@ -70,34 +70,36 @@ files:
|
|
70
70
|
- Manifest.txt
|
71
71
|
- README.rdoc
|
72
72
|
- Rakefile
|
73
|
-
- lib/generators/
|
74
|
-
- lib/generators/
|
75
|
-
- lib/generators/
|
76
|
-
- lib/generators/
|
77
|
-
- lib/generators/
|
78
|
-
- lib/generators/
|
79
|
-
- lib/generators/
|
80
|
-
- lib/generators/
|
81
|
-
- lib/generators/
|
82
|
-
- lib/generators/
|
83
|
-
- lib/generators/
|
84
|
-
- lib/generators/
|
85
|
-
- lib/generators/
|
86
|
-
- lib/generators/
|
87
|
-
- lib/generators/
|
88
|
-
- lib/generators/
|
89
|
-
- lib/generators/
|
90
|
-
- lib/generators/
|
91
|
-
- lib/generators/
|
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/integration/integration_generator.rb
|
83
|
+
- lib/generators/mini_test/integration/templates/integration_spec.rb
|
84
|
+
- lib/generators/mini_test/integration/templates/integration_test.rb
|
85
|
+
- lib/generators/mini_test/mailer/mailer_generator.rb
|
86
|
+
- lib/generators/mini_test/mailer/templates/mailer_spec.rb
|
87
|
+
- lib/generators/mini_test/mailer/templates/mailer_test.rb
|
88
|
+
- lib/generators/mini_test/model/model_generator.rb
|
89
|
+
- lib/generators/mini_test/model/templates/fixtures.yml
|
90
|
+
- lib/generators/mini_test/model/templates/model_spec.rb
|
91
|
+
- lib/generators/mini_test/model/templates/model_test.rb
|
92
|
+
- lib/generators/mini_test/scaffold/scaffold_generator.rb
|
93
|
+
- lib/generators/mini_test/scaffold/templates/controller_spec.rb
|
94
|
+
- lib/generators/mini_test/scaffold/templates/controller_test.rb
|
92
95
|
- lib/minitest-rails.rb
|
93
96
|
- lib/minitest/rails.rb
|
94
|
-
- lib/minitest/rails/
|
95
|
-
- lib/minitest/rails/
|
96
|
-
- lib/minitest/rails/
|
97
|
-
- lib/minitest/rails/
|
98
|
-
- lib/minitest/rails/model.rb
|
99
|
-
- lib/minitest/rails/spec.rb
|
97
|
+
- lib/minitest/rails/action_controller.rb
|
98
|
+
- lib/minitest/rails/action_dispatch.rb
|
99
|
+
- lib/minitest/rails/action_mailer.rb
|
100
|
+
- lib/minitest/rails/active_support.rb
|
100
101
|
- lib/minitest/rails/tasks/minitest.rake
|
102
|
+
- minitest-rails.gemspec
|
101
103
|
- test/test_controller_generator.rb
|
102
104
|
- test/test_helper_generator.rb
|
103
105
|
- test/test_install_generator.rb
|
@@ -123,15 +125,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
126
|
none: false
|
125
127
|
requirements:
|
126
|
-
- - ! '
|
128
|
+
- - ! '>'
|
127
129
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
130
|
+
version: 1.3.1
|
129
131
|
requirements: []
|
130
132
|
rubyforge_project: minitest-rails
|
131
133
|
rubygems_version: 1.8.16
|
132
134
|
signing_key:
|
133
135
|
specification_version: 3
|
134
|
-
summary:
|
136
|
+
summary: MiniTest integration for Rails 3.
|
135
137
|
test_files:
|
136
138
|
- test/test_controller_generator.rb
|
137
139
|
- test/test_helper_generator.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require "minitest_helper"
|
2
|
-
|
3
|
-
describe <%= class_name %>Controller do
|
4
|
-
|
5
|
-
subject { <%= class_name %>Controller }
|
6
|
-
|
7
|
-
# fixtures :all
|
8
|
-
|
9
|
-
before do
|
10
|
-
@controller = <%= class_name %>Controller.new
|
11
|
-
end
|
12
|
-
|
13
|
-
it "must be a real test" do
|
14
|
-
flunk "Need real tests"
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
@@ -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
|
-
# 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,28 +0,0 @@
|
|
1
|
-
require "minitest_helper"
|
2
|
-
|
3
|
-
describe <%= class_name %> do
|
4
|
-
|
5
|
-
subject { <%= class_name %>.new }
|
6
|
-
|
7
|
-
# fixtures :all
|
8
|
-
|
9
|
-
before do
|
10
|
-
@<%= file_name %> = <%= class_name %>.new
|
11
|
-
end
|
12
|
-
|
13
|
-
it "must be valid" do
|
14
|
-
@<%= file_name %>.valid?.must_equal true
|
15
|
-
end
|
16
|
-
|
17
|
-
it "must be a real test" do
|
18
|
-
flunk "Need real tests"
|
19
|
-
end
|
20
|
-
|
21
|
-
# describe "when doing its thing" do
|
22
|
-
# it "must be interesting" do
|
23
|
-
# @<%= file_name %>.blow_minds!
|
24
|
-
# @<%= file_name %>.interesting?.must_equal true
|
25
|
-
# end
|
26
|
-
# end
|
27
|
-
|
28
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require "minitest/rails/spec"
|
2
|
-
require "active_support/test_case"
|
3
|
-
require "action_controller"
|
4
|
-
require "action_controller/test_case"
|
5
|
-
|
6
|
-
module Minitest
|
7
|
-
module Rails
|
8
|
-
class Controller < Spec
|
9
|
-
include ActiveSupport::Testing::SetupAndTeardown
|
10
|
-
include ActionController::TestCase::Behavior
|
11
|
-
|
12
|
-
before do
|
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
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,14 +0,0 @@
|
|
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,30 +0,0 @@
|
|
1
|
-
require "minitest/rails/spec"
|
2
|
-
|
3
|
-
module Minitest
|
4
|
-
module Rails
|
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
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|