Skip to content

Commit

Permalink
Remove use of mocha in the named base tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artofhuman committed Apr 28, 2015
1 parent a66a64a commit 3ca5ae5
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions railties/test/generators/named_base_test.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -80,10 +80,13 @@ def test_scaffold_plural_names_as_ruby

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
Expand All @@ -103,11 +106,11 @@ def test_index_helper_with_uncountable

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
Expand Down

0 comments on commit 3ca5ae5

Please sign in to comment.