diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-31 14:03:55 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-12-31 14:03:55 -0300 |
commit | b22c527e65a41da59dbfcb078968069c6fae5086 (patch) | |
tree | fd50b9a5b79cf2e3cd508032aec320c0280b5b99 /actionpack/test | |
parent | 5e5107430bccc0a536e0b264c951793d8fe62235 (diff) | |
parent | cf4afc4d11556609802f640135cc7715e4a6a9fe (diff) | |
download | rails-b22c527e65a41da59dbfcb078968069c6fae5086.tar.gz rails-b22c527e65a41da59dbfcb078968069c6fae5086.tar.bz2 rails-b22c527e65a41da59dbfcb078968069c6fae5086.zip |
Merge branch 'minitest_cleanup'
Diffstat (limited to 'actionpack/test')
21 files changed, 28 insertions, 409 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index 95bff0a204..bbcd289886 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -15,7 +15,7 @@ silence_warnings do Encoding.default_external = "UTF-8" end -require 'minitest/autorun' +require 'active_support/testing/autorun' require 'abstract_controller' require 'action_controller' require 'action_view' diff --git a/actionpack/test/controller/http_token_authentication_test.rb b/actionpack/test/controller/http_token_authentication_test.rb index faf923e929..ebf6d224aa 100644 --- a/actionpack/test/controller/http_token_authentication_test.rb +++ b/actionpack/test/controller/http_token_authentication_test.rb @@ -111,21 +111,21 @@ class HttpTokenAuthenticationTest < ActionController::TestCase assert_equal(expected, actual) end - test "token_and_options returns correct token" do + test "token_and_options returns correct token with value after the equal sign" do token = 'rcHu+=HzSFw89Ypyhn/896A==f34' actual = ActionController::HttpAuthentication::Token.token_and_options(sample_request(token)).first expected = token assert_equal(expected, actual) end - test "token_and_options returns correct token" do + test "token_and_options returns correct token with slashes" do token = 'rcHu+\\\\"/896A' actual = ActionController::HttpAuthentication::Token.token_and_options(sample_request(token)).first expected = token assert_equal(expected, actual) end - test "token_and_options returns correct token" do + test "token_and_options returns correct token with quotes" do token = '\"quote\" pretty' actual = ActionController::HttpAuthentication::Token.token_and_options(sample_request(token)).first expected = token diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb index 20e433d1ec..3b1a07d7af 100644 --- a/actionpack/test/controller/live_stream_test.rb +++ b/actionpack/test/controller/live_stream_test.rb @@ -40,7 +40,7 @@ module ActionController def thread_locals tc.assert_equal 'aaron', Thread.current[:setting] - tc.refute_equal Thread.current.object_id, Thread.current[:originating_thread] + tc.assert_not_equal Thread.current.object_id, Thread.current[:originating_thread] response.headers['Content-Type'] = 'text/event-stream' %w{ hello world }.each do |word| diff --git a/actionpack/test/controller/spec_style_test.rb b/actionpack/test/controller/spec_style_test.rb deleted file mode 100644 index e118c584ca..0000000000 --- a/actionpack/test/controller/spec_style_test.rb +++ /dev/null @@ -1,208 +0,0 @@ -require "abstract_unit" - -class ApplicationController < ActionController::Base; end -class ModelsController < ApplicationController; end -module Admin - class WidgetsController < ApplicationController; end -end - -# ApplicationController -describe ApplicationController do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -describe ApplicationController, :index do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -describe ApplicationController, "unauthenticated user" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -describe "ApplicationControllerTest" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -describe "ApplicationControllerTest", :index do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -describe "ApplicationControllerTest", "unauthenticated user" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ApplicationController, @controller - end - end - end -end - -# ModelsController -describe ModelsController do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -describe ModelsController, :index do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -describe ModelsController, "unauthenticated user" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -describe "ModelsControllerTest" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -describe "ModelsControllerTest", :index do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -describe "ModelsControllerTest", "unauthenticated user" do - describe "nested" do - describe "even deeper" do - it "exists" do - assert_kind_of ModelsController, @controller - end - end - end -end - -# Nested Admin::WidgetsControllerTest -module Admin - class WidgetsControllerTest < ActionController::TestCase - test "exists" do - assert_kind_of Admin::WidgetsController, @controller - end - end - - describe WidgetsController do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end - end - - describe WidgetsController, "unauthenticated users" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end - end -end - -class Admin::WidgetsControllerTest < ActionController::TestCase - test "exists here too" do - assert_kind_of Admin::WidgetsController, @controller - end -end - -describe Admin::WidgetsController do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end - -describe Admin::WidgetsController, "unauthenticated users" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end - -describe "Admin::WidgetsController" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end - -describe "Admin::WidgetsControllerTest" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end - -describe "Admin::WidgetsController", "unauthenticated users" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end - -describe "Admin::WidgetsControllerTest", "unauthenticated users" do - describe "index" do - it "respond successful" do - assert_kind_of Admin::WidgetsController, @controller - end - end -end diff --git a/actionpack/test/controller/spec_type_test.rb b/actionpack/test/controller/spec_type_test.rb deleted file mode 100644 index 13be8a3405..0000000000 --- a/actionpack/test/controller/spec_type_test.rb +++ /dev/null @@ -1,37 +0,0 @@ -require "abstract_unit" - -class ApplicationController < ActionController::Base; end -class ModelsController < ApplicationController; end - -class ActionControllerSpecTypeTest < ActiveSupport::TestCase - def assert_controller actual - assert_equal ActionController::TestCase, actual - end - - def refute_controller actual - refute_equal ActionController::TestCase, actual - end - - def test_spec_type_resolves_for_class_constants - assert_controller MiniTest::Spec.spec_type(ApplicationController) - assert_controller MiniTest::Spec.spec_type(ModelsController) - end - - def test_spec_type_resolves_for_matching_strings - assert_controller MiniTest::Spec.spec_type("WidgetController") - assert_controller MiniTest::Spec.spec_type("WidgetControllerTest") - assert_controller MiniTest::Spec.spec_type("Widget Controller Test") - # And is not case sensitive - assert_controller MiniTest::Spec.spec_type("widgetcontroller") - assert_controller MiniTest::Spec.spec_type("widgetcontrollertest") - assert_controller MiniTest::Spec.spec_type("widget controller test") - end - - def test_spec_type_wont_match_non_space_characters - refute_controller MiniTest::Spec.spec_type("Widget Controller\tTest") - refute_controller MiniTest::Spec.spec_type("Widget Controller\rTest") - refute_controller MiniTest::Spec.spec_type("Widget Controller\nTest") - refute_controller MiniTest::Spec.spec_type("Widget Controller\fTest") - refute_controller MiniTest::Spec.spec_type("Widget ControllerXTest") - end -end diff --git a/actionpack/test/dispatch/live_response_test.rb b/actionpack/test/dispatch/live_response_test.rb index e16f23914b..e0cfb73acf 100644 --- a/actionpack/test/dispatch/live_response_test.rb +++ b/actionpack/test/dispatch/live_response_test.rb @@ -11,7 +11,7 @@ module ActionController def test_header_merge header = @response.header.merge('Foo' => 'Bar') assert_kind_of(ActionController::Live::Response::Header, header) - refute_equal header, @response.header + assert_not_equal header, @response.header end def test_initialize_with_default_headers diff --git a/actionpack/test/dispatch/request/session_test.rb b/actionpack/test/dispatch/request/session_test.rb index 3f36d4f1a9..1517f96fdc 100644 --- a/actionpack/test/dispatch/request/session_test.rb +++ b/actionpack/test/dispatch/request/session_test.rb @@ -24,7 +24,7 @@ module ActionDispatch s['foo'] = 'bar' s1 = Session.create(store, env, {}) - refute_equal s, s1 + assert_not_equal s, s1 assert_equal 'bar', s1['foo'] end diff --git a/actionpack/test/dispatch/routing/inspector_test.rb b/actionpack/test/dispatch/routing/inspector_test.rb index a3034ce001..c058bd4909 100644 --- a/actionpack/test/dispatch/routing/inspector_test.rb +++ b/actionpack/test/dispatch/routing/inspector_test.rb @@ -1,4 +1,4 @@ -require 'minitest/autorun' +require 'active_support/testing/autorun' require 'action_controller' require 'rails/engine' require 'action_dispatch/routing/inspector' diff --git a/actionpack/test/dispatch/session/abstract_store_test.rb b/actionpack/test/dispatch/session/abstract_store_test.rb index 8daf3d3f5e..fe1a7b4f86 100644 --- a/actionpack/test/dispatch/session/abstract_store_test.rb +++ b/actionpack/test/dispatch/session/abstract_store_test.rb @@ -42,7 +42,7 @@ module ActionDispatch as.call(@env) session1 = Request::Session.find @env - refute_equal session, session1 + assert_not_equal session, session1 assert_equal session.to_hash, session1.to_hash end diff --git a/actionpack/test/dispatch/spec_type_test.rb b/actionpack/test/dispatch/spec_type_test.rb deleted file mode 100644 index 6cd19fd333..0000000000 --- a/actionpack/test/dispatch/spec_type_test.rb +++ /dev/null @@ -1,41 +0,0 @@ -require "abstract_unit" - -class SpecTypeTest < ActiveSupport::TestCase - def assert_dispatch actual - assert_equal ActionDispatch::IntegrationTest, actual - end - - def refute_dispatch actual - refute_equal ActionDispatch::IntegrationTest, actual - end - - def test_spec_type_resolves_for_matching_acceptance_strings - assert_dispatch MiniTest::Spec.spec_type("WidgetAcceptanceTest") - assert_dispatch MiniTest::Spec.spec_type("Widget Acceptance Test") - assert_dispatch MiniTest::Spec.spec_type("widgetacceptancetest") - assert_dispatch MiniTest::Spec.spec_type("widget acceptance test") - end - - def test_spec_type_wont_match_non_space_characters_acceptance - refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\tTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\rTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\nTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Acceptance\fTest") - refute_dispatch MiniTest::Spec.spec_type("Widget AcceptanceXTest") - end - - def test_spec_type_resolves_for_matching_integration_strings - assert_dispatch MiniTest::Spec.spec_type("WidgetIntegrationTest") - assert_dispatch MiniTest::Spec.spec_type("Widget Integration Test") - assert_dispatch MiniTest::Spec.spec_type("widgetintegrationtest") - assert_dispatch MiniTest::Spec.spec_type("widget integration test") - end - - def test_spec_type_wont_match_non_space_characters_integration - refute_dispatch MiniTest::Spec.spec_type("Widget Integration\tTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Integration\rTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Integration\nTest") - refute_dispatch MiniTest::Spec.spec_type("Widget Integration\fTest") - refute_dispatch MiniTest::Spec.spec_type("Widget IntegrationXTest") - end -end diff --git a/actionpack/test/dispatch/ssl_test.rb b/actionpack/test/dispatch/ssl_test.rb index 6f075a9074..b4a39219bf 100644 --- a/actionpack/test/dispatch/ssl_test.rb +++ b/actionpack/test/dispatch/ssl_test.rb @@ -47,7 +47,7 @@ class SSLTest < ActionDispatch::IntegrationTest def test_disable_hsts_header self.app = ActionDispatch::SSL.new(default_app, :hsts => false) get "https://example.org/" - refute response.headers['Strict-Transport-Security'] + assert_not response.headers['Strict-Transport-Security'] end def test_hsts_expires diff --git a/actionpack/test/journey/gtg/transition_table_test.rb b/actionpack/test/journey/gtg/transition_table_test.rb index 6d81b72c41..133c9abe13 100644 --- a/actionpack/test/journey/gtg/transition_table_test.rb +++ b/actionpack/test/journey/gtg/transition_table_test.rb @@ -29,7 +29,7 @@ module ActionDispatch } svg = table.to_svg assert svg - refute_match(/DOCTYPE/, svg) + assert_no_match(/DOCTYPE/, svg) end end @@ -53,7 +53,7 @@ module ActionDispatch sim = simulator_for ['/foo(/bar)'] assert_match sim, '/foo' assert_match sim, '/foo/bar' - refute_match sim, '/foo/' + assert_no_match sim, '/foo/' end def test_match_data diff --git a/actionpack/test/journey/nfa/simulator_test.rb b/actionpack/test/journey/nfa/simulator_test.rb index 9f89329b57..f4fd6ec048 100644 --- a/actionpack/test/journey/nfa/simulator_test.rb +++ b/actionpack/test/journey/nfa/simulator_test.rb @@ -11,17 +11,17 @@ module ActionDispatch def test_simulate_simple_no_match sim = simulator_for ['/foo'] - refute_match sim, 'foo' + assert_no_match sim, 'foo' end def test_simulate_simple_no_match_too_long sim = simulator_for ['/foo'] - refute_match sim, '/foo/bar' + assert_no_match sim, '/foo/bar' end def test_simulate_simple_no_match_wrong_string sim = simulator_for ['/foo'] - refute_match sim, '/bar' + assert_no_match sim, '/bar' end def test_simulate_regex @@ -34,14 +34,14 @@ module ActionDispatch sim = simulator_for ['/foo', '/bar'] assert_match sim, '/bar' assert_match sim, '/foo' - refute_match sim, '/baz' + assert_no_match sim, '/baz' end def test_simulate_optional sim = simulator_for ['/foo(/bar)'] assert_match sim, '/foo' assert_match sim, '/foo/bar' - refute_match sim, '/foo/' + assert_no_match sim, '/foo/' end def test_matchdata_has_memos diff --git a/actionpack/test/journey/nodes/symbol_test.rb b/actionpack/test/journey/nodes/symbol_test.rb index f53840274a..caf797c4c6 100644 --- a/actionpack/test/journey/nodes/symbol_test.rb +++ b/actionpack/test/journey/nodes/symbol_test.rb @@ -9,7 +9,7 @@ module ActionDispatch assert sym.default_regexp? sym.regexp = nil - refute sym.default_regexp? + assert_not sym.default_regexp? end end end diff --git a/actionpack/test/journey/path/pattern_test.rb b/actionpack/test/journey/path/pattern_test.rb index 0f2d0d44c0..a42a29b4ee 100644 --- a/actionpack/test/journey/path/pattern_test.rb +++ b/actionpack/test/journey/path/pattern_test.rb @@ -88,7 +88,7 @@ module ActionDispatch path = Pattern.new strexp assert_match(path, '/page/tender') assert_match(path, '/page/love') - refute_match(path, '/page/loving') + assert_no_match(path, '/page/loving') end def test_optional_names @@ -110,7 +110,7 @@ module ActionDispatch ) path = Pattern.new strexp assert_match(path, '/123') - refute_match(path, '/') + assert_no_match(path, '/') end def test_to_regexp_with_group @@ -122,7 +122,7 @@ module ActionDispatch path = Pattern.new strexp assert_match(path, '/page/tender') assert_match(path, '/page/love') - refute_match(path, '/page/loving') + assert_no_match(path, '/page/loving') end def test_ast_sets_regular_expressions @@ -189,7 +189,7 @@ module ActionDispatch path = Pattern.new strexp assert_match(path, '/page/TENDER/aaron') assert_match(path, '/page/loVE/aaron') - refute_match(path, '/page/loVE/AAron') + assert_no_match(path, '/page/loVE/AAron') end def test_to_regexp_with_strexp @@ -210,7 +210,7 @@ module ActionDispatch path = Pattern.new '/:controller(/:action(/:id(.:format)))' uri = 'content' - refute path =~ uri + assert_not path =~ uri end def test_match_controller diff --git a/actionpack/test/journey/route_test.rb b/actionpack/test/journey/route_test.rb index b205db5fbc..79895e1aaf 100644 --- a/actionpack/test/journey/route_test.rb +++ b/actionpack/test/journey/route_test.rb @@ -92,7 +92,7 @@ module ActionDispatch routes = [specific, generic] - refute_equal specific.score(knowledge), generic.score(knowledge) + assert_not_equal specific.score(knowledge), generic.score(knowledge) found = routes.sort_by { |r| r.score(knowledge) }.last diff --git a/actionpack/test/journey/router_test.rb b/actionpack/test/journey/router_test.rb index 1b64600ba8..e43d415e3f 100644 --- a/actionpack/test/journey/router_test.rb +++ b/actionpack/test/journey/router_test.rb @@ -277,7 +277,7 @@ module ActionDispatch @router.recognize(env) do |*whatever| yielded = true end - refute yielded + assert_not yielded end def test_required_part_in_recall diff --git a/actionpack/test/journey/routes_test.rb b/actionpack/test/journey/routes_test.rb index 3b17bd53b7..017c0eaee6 100644 --- a/actionpack/test/journey/routes_test.rb +++ b/actionpack/test/journey/routes_test.rb @@ -23,7 +23,7 @@ module ActionDispatch routes.add_route nil, path, {}, {}, {} ast = routes.ast routes.add_route nil, path, {}, {}, {} - refute_equal ast, routes.ast + assert_not_equal ast, routes.ast end def test_simulator_changes @@ -33,7 +33,7 @@ module ActionDispatch routes.add_route nil, path, {}, {}, {} sim = routes.simulator routes.add_route nil, path, {}, {}, {} - refute_equal sim, routes.simulator + assert_not_equal sim, routes.simulator end def test_first_name_wins diff --git a/actionpack/test/template/spec_type_test.rb b/actionpack/test/template/spec_type_test.rb deleted file mode 100644 index 08a7bdf81d..0000000000 --- a/actionpack/test/template/spec_type_test.rb +++ /dev/null @@ -1,39 +0,0 @@ -require 'abstract_unit' - -class ActionViewSpecTypeTest < ActiveSupport::TestCase - def assert_view actual - assert_equal ActionView::TestCase, actual - end - - def refute_view actual - refute_equal ActionView::TestCase, actual - end - - def test_spec_type_resolves_for_matching_helper_strings - assert_view MiniTest::Spec.spec_type("WidgetHelper") - assert_view MiniTest::Spec.spec_type("WidgetHelperTest") - assert_view MiniTest::Spec.spec_type("Widget Helper Test") - # And is not case sensitive - assert_view MiniTest::Spec.spec_type("widgethelper") - assert_view MiniTest::Spec.spec_type("widgethelpertest") - assert_view MiniTest::Spec.spec_type("widget helper test") - end - - def test_spec_type_resolves_for_matching_view_strings - assert_view MiniTest::Spec.spec_type("WidgetView") - assert_view MiniTest::Spec.spec_type("WidgetViewTest") - assert_view MiniTest::Spec.spec_type("Widget View Test") - # And is not case sensitive - assert_view MiniTest::Spec.spec_type("widgetview") - assert_view MiniTest::Spec.spec_type("widgetviewtest") - assert_view MiniTest::Spec.spec_type("widget view test") - end - - def test_spec_type_wont_match_non_space_characters - refute_view MiniTest::Spec.spec_type("Widget Helper\tTest") - refute_view MiniTest::Spec.spec_type("Widget Helper\rTest") - refute_view MiniTest::Spec.spec_type("Widget Helper\nTest") - refute_view MiniTest::Spec.spec_type("Widget Helper\fTest") - refute_view MiniTest::Spec.spec_type("Widget HelperXTest") - end -end diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb index e843a1deb4..108a674d95 100644 --- a/actionpack/test/template/test_test.rb +++ b/actionpack/test/template/test_test.rb @@ -78,59 +78,3 @@ class CrazyStringHelperTest < ActionView::TestCase assert_equal PeopleHelper, self.class.helper_class end end - -describe PeopleHelper do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end -end - -describe PeopleHelper, :helper_class do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end -end - -describe PeopleHelper do - describe "even while nested" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end - end -end - -describe PeopleHelper, :helper_class do - describe "even while nested" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end - end -end - -describe "PeopleHelper" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end -end - -describe "PeopleHelperTest" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end -end - -describe "PeopleHelper" do - describe "even while nested" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end - end -end - -describe "PeopleHelperTest" do - describe "even while nested" do - it "resolves the right helper_class" do - assert_equal PeopleHelper, self.class.helper_class - end - end -end diff --git a/actionpack/test/ts_isolated.rb b/actionpack/test/ts_isolated.rb index c44c5d8968..55620abe84 100644 --- a/actionpack/test/ts_isolated.rb +++ b/actionpack/test/ts_isolated.rb @@ -1,4 +1,4 @@ -require 'minitest/autorun' +require 'active_support/testing/autorun' require 'rbconfig' require 'abstract_unit' |