minitest-spec-rails-orangejulius 5.0.3.pre.orangejulius
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +12 -0
- data/Appraisals +3 -0
- data/CHANGELOG.md +142 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +22 -0
- data/README.md +290 -0
- data/Rakefile +19 -0
- data/lib/minitest-spec-rails/dsl.rb +41 -0
- data/lib/minitest-spec-rails/init/action_controller.rb +26 -0
- data/lib/minitest-spec-rails/init/action_dispatch.rb +16 -0
- data/lib/minitest-spec-rails/init/action_mailer.rb +27 -0
- data/lib/minitest-spec-rails/init/action_view.rb +26 -0
- data/lib/minitest-spec-rails/init/active_support.rb +35 -0
- data/lib/minitest-spec-rails/init/mini_shoulda.rb +27 -0
- data/lib/minitest-spec-rails/railtie.rb +28 -0
- data/lib/minitest-spec-rails/version.rb +3 -0
- data/lib/minitest-spec-rails.rb +10 -0
- data/minitest-spec-rails.gemspec +24 -0
- data/test/cases/action_controller_test.rb +41 -0
- data/test/cases/action_dispatch_test.rb +50 -0
- data/test/cases/action_mailer_test.rb +42 -0
- data/test/cases/action_view_test.rb +44 -0
- data/test/cases/active_support_test.rb +68 -0
- data/test/cases/mini_shoulda_test.rb +38 -0
- data/test/dummy_app/app/controllers/application_controller.rb +7 -0
- data/test/dummy_app/app/controllers/users_controller.rb +12 -0
- data/test/dummy_app/app/helpers/application_helper.rb +3 -0
- data/test/dummy_app/app/helpers/foos_helper.rb +11 -0
- data/test/dummy_app/app/helpers/users_helper.rb +9 -0
- data/test/dummy_app/app/mailers/user_mailer.rb +10 -0
- data/test/dummy_app/app/models/post.rb +6 -0
- data/test/dummy_app/app/models/user.rb +6 -0
- data/test/dummy_app/app/views/users/index.html.erb +2 -0
- data/test/dummy_app/config/database.yml +6 -0
- data/test/dummy_app/config/routes.rb +4 -0
- data/test/dummy_app/init.rb +38 -0
- data/test/dummy_app/lib/library.rb +2 -0
- data/test/dummy_app/tmp/.gitkeep +0 -0
- data/test/dummy_tests/application_controller_test.rb +87 -0
- data/test/dummy_tests/foos_helper_test.rb +17 -0
- data/test/dummy_tests/integration_test.rb +49 -0
- data/test/dummy_tests/library_test.rb +15 -0
- data/test/dummy_tests/user_mailer_test.rb +85 -0
- data/test/dummy_tests/user_test.rb +76 -0
- data/test/dummy_tests/users_controller_test.rb +26 -0
- data/test/dummy_tests/users_helper_test.rb +77 -0
- data/test/support/shared_test_case_behavior.rb +31 -0
- data/test/test_helper.rb +11 -0
- data/test/test_helper_dummy.rb +9 -0
- metadata +196 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
module MiniTestSpecRails
|
2
|
+
module Init
|
3
|
+
module MiniShouldaBehavior
|
4
|
+
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
class << self
|
9
|
+
alias :context :describe
|
10
|
+
alias :should :it
|
11
|
+
end
|
12
|
+
extend ClassMethods
|
13
|
+
end
|
14
|
+
|
15
|
+
module ClassMethods
|
16
|
+
|
17
|
+
def should_eventually(desc)
|
18
|
+
it("should eventually #{desc}") { skip("Should eventually #{desc}") }
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
ActiveSupport::TestCase.send :include, MiniTestSpecRails::Init::MiniShouldaBehavior
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module MiniTestSpecRails
|
2
|
+
class Railtie < ::Rails::Railtie
|
3
|
+
|
4
|
+
config.minitest_spec_rails = ActiveSupport::OrderedOptions.new
|
5
|
+
config.minitest_spec_rails.mini_shoulda = false
|
6
|
+
|
7
|
+
config.before_initialize do |app|
|
8
|
+
require 'active_support'
|
9
|
+
require 'minitest-spec-rails/init/active_support'
|
10
|
+
ActiveSupport.on_load(:action_controller) do
|
11
|
+
require 'minitest-spec-rails/init/action_controller'
|
12
|
+
require 'minitest-spec-rails/init/action_dispatch'
|
13
|
+
end
|
14
|
+
ActiveSupport.on_load(:action_mailer) do
|
15
|
+
require 'minitest-spec-rails/init/action_mailer'
|
16
|
+
end
|
17
|
+
end if Rails.env.test?
|
18
|
+
|
19
|
+
initializer 'minitest-spec-rails.action_view', :after => 'action_view.setup_action_pack', :group => :all do |app|
|
20
|
+
require 'minitest-spec-rails/init/action_view'
|
21
|
+
end if Rails.env.test?
|
22
|
+
|
23
|
+
initializer 'minitest-spec-rails.mini_shoulda', :group => :all do |app|
|
24
|
+
require 'minitest-spec-rails/init/mini_shoulda' if app.config.minitest_spec_rails.mini_shoulda
|
25
|
+
end if Rails.env.test?
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "minitest-spec-rails/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = 'minitest-spec-rails-orangejulius'
|
7
|
+
gem.version = MiniTestSpecRails::VERSION
|
8
|
+
gem.platform = Gem::Platform::RUBY
|
9
|
+
gem.authors = ['Ken Collins']
|
10
|
+
gem.email = ['ken@metaskills.net']
|
11
|
+
gem.homepage = 'http://github.com/metaskills/minitest-spec-rails'
|
12
|
+
gem.summary = 'Make Rails Use MiniTest::Spec!'
|
13
|
+
gem.description = 'The minitest-spec-rails gem makes it easy to use the MiniTest::Spec DSL within your existing Rails 3 or 4 test suite.'
|
14
|
+
gem.license = 'MIT'
|
15
|
+
gem.files = `git ls-files`.split("\n")
|
16
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
gem.require_paths = ['lib']
|
19
|
+
gem.add_runtime_dependency 'minitest', '~> 5.0'
|
20
|
+
gem.add_runtime_dependency 'rails', '~> 4.1.0.rc2'
|
21
|
+
gem.add_development_dependency 'appraisal'
|
22
|
+
gem.add_development_dependency 'rake'
|
23
|
+
gem.add_development_dependency 'sqlite3'
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelsController < ApplicationController; end
|
4
|
+
|
5
|
+
class ActionControllerTest < MiniTestSpecRails::TestCase
|
6
|
+
|
7
|
+
it 'matches spec type for class constants' do
|
8
|
+
assert_controller MiniTest::Spec.spec_type(ApplicationController)
|
9
|
+
assert_controller MiniTest::Spec.spec_type(ModelsController)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'matches spec type for strings' do
|
13
|
+
assert_controller MiniTest::Spec.spec_type("WidgetController")
|
14
|
+
assert_controller MiniTest::Spec.spec_type("WidgetControllerTest")
|
15
|
+
assert_controller MiniTest::Spec.spec_type("Widget Controller Test")
|
16
|
+
# And is case sensitive
|
17
|
+
refute_controller MiniTest::Spec.spec_type("widgetcontroller")
|
18
|
+
refute_controller MiniTest::Spec.spec_type("widgetcontrollertest")
|
19
|
+
refute_controller MiniTest::Spec.spec_type("widget controller test")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'wont match spec type for non space characters' do
|
23
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\tTest")
|
24
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\rTest")
|
25
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\nTest")
|
26
|
+
refute_controller MiniTest::Spec.spec_type("Widget Controller\fTest")
|
27
|
+
refute_controller MiniTest::Spec.spec_type("Widget ControllerXTest")
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def assert_controller(actual)
|
34
|
+
assert_equal ActionController::TestCase, actual
|
35
|
+
end
|
36
|
+
|
37
|
+
def refute_controller(actual)
|
38
|
+
refute_equal ActionController::TestCase, actual
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ModelsController < ApplicationController; end
|
4
|
+
|
5
|
+
class ActionControllerTest < MiniTestSpecRails::TestCase
|
6
|
+
|
7
|
+
it 'resolves spec type for matching acceptance strings' do
|
8
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest")
|
9
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test")
|
10
|
+
# And is case sensitive
|
11
|
+
refute_dispatch MiniTest::Spec.spec_type("widgetacceptancetest")
|
12
|
+
refute_dispatch MiniTest::Spec.spec_type("widget acceptance test")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'wont match spec type for space characters in acceptance strings' do
|
16
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest")
|
17
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest")
|
18
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest")
|
19
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest")
|
20
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest")
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'resolves spec type for matching integration strings' do
|
24
|
+
assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest")
|
25
|
+
assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test")
|
26
|
+
# And is case sensitive
|
27
|
+
refute_dispatch MiniTest::Spec.spec_type("widgetintegrationtest")
|
28
|
+
refute_dispatch MiniTest::Spec.spec_type("widget integration test")
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'wont match spec type for space characters in integration strings' do
|
32
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\tTest")
|
33
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\rTest")
|
34
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\nTest")
|
35
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget Integration\fTest")
|
36
|
+
refute_dispatch MiniTest::Spec.spec_type("Widget IntegrationXTest")
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def assert_dispatch(actual)
|
43
|
+
assert_equal ActionDispatch::IntegrationTest, actual
|
44
|
+
end
|
45
|
+
|
46
|
+
def refute_dispatch(actual)
|
47
|
+
refute_equal ActionDispatch::IntegrationTest, actual
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NotificationMailer < ActionMailer::Base; end
|
4
|
+
class Notifications < ActionMailer::Base; end
|
5
|
+
|
6
|
+
class ActionMailerTest < MiniTestSpecRails::TestCase
|
7
|
+
|
8
|
+
it 'matches spec type for class constants' do
|
9
|
+
assert_mailer MiniTest::Spec.spec_type(NotificationMailer)
|
10
|
+
assert_mailer MiniTest::Spec.spec_type(Notifications)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'matches spec type for strings' do
|
14
|
+
assert_mailer MiniTest::Spec.spec_type("WidgetMailer")
|
15
|
+
assert_mailer MiniTest::Spec.spec_type("WidgetMailerTest")
|
16
|
+
assert_mailer MiniTest::Spec.spec_type("Widget Mailer Test")
|
17
|
+
# And is case sensitive
|
18
|
+
refute_mailer MiniTest::Spec.spec_type("widgetmailer")
|
19
|
+
refute_mailer MiniTest::Spec.spec_type("widgetmailertest")
|
20
|
+
refute_mailer MiniTest::Spec.spec_type("widget mailer test")
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'wont match spec type for non space characters' do
|
24
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\tTest")
|
25
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\rTest")
|
26
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\nTest")
|
27
|
+
refute_mailer MiniTest::Spec.spec_type("Widget Mailer\fTest")
|
28
|
+
refute_mailer MiniTest::Spec.spec_type("Widget MailerXTest")
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def assert_mailer(actual)
|
35
|
+
assert_equal ActionMailer::TestCase, actual
|
36
|
+
end
|
37
|
+
|
38
|
+
def refute_mailer(actual)
|
39
|
+
refute_equal ActionMailer::TestCase, actual
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ActionViewTest < MiniTestSpecRails::TestCase
|
4
|
+
|
5
|
+
it 'resolves spec type for matching helper strings' do
|
6
|
+
assert_view MiniTest::Spec.spec_type("WidgetHelper")
|
7
|
+
assert_view MiniTest::Spec.spec_type("WidgetHelperTest")
|
8
|
+
assert_view MiniTest::Spec.spec_type("Widget Helper Test")
|
9
|
+
# And is case sensitive
|
10
|
+
refute_view MiniTest::Spec.spec_type("widgethelper")
|
11
|
+
refute_view MiniTest::Spec.spec_type("widgethelpertest")
|
12
|
+
refute_view MiniTest::Spec.spec_type("widget helper test")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'resolves spec type for matching view strings' do
|
16
|
+
assert_view MiniTest::Spec.spec_type("WidgetView")
|
17
|
+
assert_view MiniTest::Spec.spec_type("WidgetViewTest")
|
18
|
+
assert_view MiniTest::Spec.spec_type("Widget View Test")
|
19
|
+
# And is case sensitive
|
20
|
+
refute_view MiniTest::Spec.spec_type("widgetview")
|
21
|
+
refute_view MiniTest::Spec.spec_type("widgetviewtest")
|
22
|
+
refute_view MiniTest::Spec.spec_type("widget view test")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'wont match spec type for non space characters' do
|
26
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\tTest")
|
27
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\rTest")
|
28
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\nTest")
|
29
|
+
refute_view MiniTest::Spec.spec_type("Widget Helper\fTest")
|
30
|
+
refute_view MiniTest::Spec.spec_type("Widget HelperXTest")
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def assert_view(actual)
|
37
|
+
assert_equal ActionView::TestCase, actual
|
38
|
+
end
|
39
|
+
|
40
|
+
def refute_view(actual)
|
41
|
+
refute_equal ActionView::TestCase, actual
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SomeRandomModel < ActiveRecord::Base; end
|
4
|
+
|
5
|
+
class ActiveSupportTest < MiniTestSpecRails::TestCase
|
6
|
+
|
7
|
+
it 'resolves spec type for active record constants' do
|
8
|
+
assert_support MiniTest::Spec.spec_type(SomeRandomModel)
|
9
|
+
assert_support MiniTest::Spec.spec_type(User)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'wont resolve spec type for random strings' do
|
13
|
+
assert_spec MiniTest::Spec.spec_type("Unmatched String")
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def assert_support(actual)
|
19
|
+
assert_equal ActiveSupport::TestCase, actual
|
20
|
+
end
|
21
|
+
|
22
|
+
def assert_spec(actual)
|
23
|
+
assert_equal MiniTest::Spec, actual
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class ActiveSupportCallbackTest < ActiveSupport::TestCase
|
29
|
+
|
30
|
+
setup :foo
|
31
|
+
setup :bar
|
32
|
+
|
33
|
+
it 'works' do
|
34
|
+
@foo.must_equal 'foo'
|
35
|
+
@bar.must_equal 'bar'
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def foo ; @foo = 'foo' ; end
|
41
|
+
def bar ; @bar = 'bar' ; end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
class ActiveSupportSpecTest < ActiveSupport::TestCase
|
46
|
+
|
47
|
+
it 'current spec name' do
|
48
|
+
Thread.current[:current_spec].must_equal self
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
class ActiveSupportDescribeNamesTest < ActiveSupport::TestCase
|
54
|
+
it 'class name' do
|
55
|
+
assert_equal 'ActiveSupportDescribeNamesTest', self.class.name
|
56
|
+
end
|
57
|
+
describe 'level1' do
|
58
|
+
it 'haz name' do
|
59
|
+
assert_equal 'ActiveSupportDescribeNamesTest::level1', self.class.name
|
60
|
+
end
|
61
|
+
describe 'level2' do
|
62
|
+
it 'haz name' do
|
63
|
+
assert_equal 'ActiveSupportDescribeNamesTest::level1::level2', self.class.name
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'test_helper_dummy'
|
2
|
+
|
3
|
+
class PostTests < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
i_suck_and_my_tests_are_order_dependent!
|
6
|
+
|
7
|
+
$teardown_ran = false
|
8
|
+
|
9
|
+
setup do
|
10
|
+
@post = user_post
|
11
|
+
end
|
12
|
+
|
13
|
+
teardown do
|
14
|
+
$teardown_ran = true
|
15
|
+
end
|
16
|
+
|
17
|
+
should 'setup correctly and $teardown_ran should still be false since this is the first test' do
|
18
|
+
@post.must_be_instance_of Post
|
19
|
+
$teardown_ran.must_equal false
|
20
|
+
end
|
21
|
+
|
22
|
+
should 'teardown correctly' do
|
23
|
+
$teardown_ran.must_equal true
|
24
|
+
end
|
25
|
+
|
26
|
+
should_eventually 'will be skipped' do
|
27
|
+
assert false
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'level 1' do
|
31
|
+
|
32
|
+
should 'work' do
|
33
|
+
@post.must_be_instance_of Post
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= "test"
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __FILE__)
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'rails/all'
|
5
|
+
Bundler.require(:default, Rails.env)
|
6
|
+
|
7
|
+
module Dummy
|
8
|
+
class Application < ::Rails::Application
|
9
|
+
|
10
|
+
# Basic Engine
|
11
|
+
config.root = File.join __FILE__, '..'
|
12
|
+
config.cache_store = :memory_store
|
13
|
+
config.assets.enabled = false if Rails.version > '3.1'
|
14
|
+
config.secret_token = '012345678901234567890123456789'
|
15
|
+
|
16
|
+
# Mimic Test Environment Config.
|
17
|
+
config.whiny_nils = true if Rails.version < '4.0'
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
config.action_dispatch.show_exceptions = false
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
config.action_mailer.delivery_method = :test
|
23
|
+
config.active_support.deprecation = :stderr
|
24
|
+
config.allow_concurrency = true
|
25
|
+
config.cache_classes = true
|
26
|
+
config.dependency_loading = true
|
27
|
+
config.preload_frameworks = true
|
28
|
+
config.eager_load = true
|
29
|
+
config.secret_key_base = '012345678901234567890123456789'
|
30
|
+
|
31
|
+
# Custom
|
32
|
+
config.minitest_spec_rails.mini_shoulda = true
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Dummy::Application.initialize!
|
38
|
+
require 'rails/test_help'
|
File without changes
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'test_helper_dummy'
|
2
|
+
|
3
|
+
module ApplicationControllerTests
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
|
7
|
+
before { get :index }
|
8
|
+
|
9
|
+
it 'works' do
|
10
|
+
get :index
|
11
|
+
response.body.must_equal 'Rendered MiniTest::Spec'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'allows custom assertions' do
|
15
|
+
assert_template :partial => false
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'can find the controller_class' do
|
19
|
+
self.class.controller_class.must_equal ApplicationController
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'can access the setup ivars' do
|
23
|
+
@controller.must_be_kind_of ApplicationController
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'nested 1' do
|
27
|
+
|
28
|
+
it('works') { skip }
|
29
|
+
|
30
|
+
it 'can find the controller_class' do
|
31
|
+
self.class.controller_class.must_equal ApplicationController
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'nested 2' do
|
35
|
+
|
36
|
+
it('works') { skip }
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class ApplicationControllerTest < ActionController::TestCase
|
46
|
+
include ApplicationControllerTests
|
47
|
+
it 'reflects' do
|
48
|
+
described_class.must_equal ApplicationController
|
49
|
+
self.class.described_class.must_equal ApplicationController
|
50
|
+
end
|
51
|
+
describe 'level 1' do
|
52
|
+
it 'reflects' do
|
53
|
+
described_class.must_equal ApplicationController
|
54
|
+
self.class.described_class.must_equal ApplicationController
|
55
|
+
end
|
56
|
+
describe 'level 2' do
|
57
|
+
it 'reflects' do
|
58
|
+
described_class.must_equal ApplicationController
|
59
|
+
self.class.described_class.must_equal ApplicationController
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe ApplicationController do
|
66
|
+
include ApplicationControllerTests
|
67
|
+
it 'class reflects' do
|
68
|
+
described_class.must_equal ApplicationController
|
69
|
+
self.class.described_class.must_equal ApplicationController
|
70
|
+
end
|
71
|
+
it 'reflects' do
|
72
|
+
described_class.must_equal ApplicationController
|
73
|
+
self.class.described_class.must_equal ApplicationController
|
74
|
+
end
|
75
|
+
describe 'level 1' do
|
76
|
+
it 'reflects' do
|
77
|
+
described_class.must_equal ApplicationController
|
78
|
+
self.class.described_class.must_equal ApplicationController
|
79
|
+
end
|
80
|
+
describe 'level 2' do
|
81
|
+
it 'reflects' do
|
82
|
+
described_class.must_equal ApplicationController
|
83
|
+
self.class.described_class.must_equal ApplicationController
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper_dummy'
|
2
|
+
|
3
|
+
class FoosHelperTest < ActionView::TestCase
|
4
|
+
|
5
|
+
it 'allows path and url helpers' do
|
6
|
+
users_path_helper.must_equal '/users'
|
7
|
+
users_url_helper.must_equal 'http://test.host/users'
|
8
|
+
end
|
9
|
+
|
10
|
+
describe 'level1' do
|
11
|
+
it 'works for helper method called in describe block' do
|
12
|
+
assert passes
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|