1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Remove use of mocha in the named base tests

This commit is contained in:
Semyon Pupkov 2015-04-28 18:16:43 +05:00
parent a66a64aa2a
commit 3ca5ae57b5

View file

@ -1,6 +1,6 @@
require 'generators/generators_test_helper'
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
require 'mocha/setup' # FIXME: stop using mocha
require 'minitest/mock'
class NamedBaseTest < Rails::Generators::TestCase
include GeneratorsTestHelper
@ -80,10 +80,13 @@ class NamedBaseTest < Rails::Generators::TestCase
def test_application_name
g = generator ['Admin::Foo']
Rails.stubs(:application).returns(Object.new)
assert_name g, "object", :application_name
Rails.stubs(:application).returns(nil)
assert_name g, "application", :application_name
Rails.stub(:application, Object.new) do
assert_name g, "object", :application_name
end
Rails.stub(:application, nil) do
assert_name g, "application", :application_name
end
end
def test_index_helper
@ -103,11 +106,11 @@ class NamedBaseTest < Rails::Generators::TestCase
def test_hide_namespace
g = generator ['Hidden']
g.class.stubs(:namespace).returns('hidden')
assert !Rails::Generators.hidden_namespaces.include?('hidden')
g.class.hide!
assert Rails::Generators.hidden_namespaces.include?('hidden')
g.class.stub(:namespace, 'hidden') do
assert !Rails::Generators.hidden_namespaces.include?('hidden')
g.class.hide!
assert Rails::Generators.hidden_namespaces.include?('hidden')
end
end
def test_scaffold_plural_names_with_model_name_option