Methods
- S
- T
-
- teardown,
- test_default_banner_should_not_show_rails_generator_namespace,
- test_default_banner_should_show_generator_namespace,
- test_developer_options_are_overwriten_by_user_options,
- test_fallbacks_for_generators_on_find_by_namespace,
- test_fallbacks_for_generators_on_find_by_namespace_with_context,
- test_fallbacks_for_generators_on_invoke,
- test_find_by_namespace,
- test_find_by_namespace_in_subfolder,
- test_find_by_namespace_with_base,
- test_find_by_namespace_with_context,
- test_find_by_namespace_with_duplicated_name,
- test_find_by_namespace_with_generator_on_root,
- test_find_by_namespace_without_base_or_context_looks_into_rails_namespace,
- test_help_when_a_generator_with_required_arguments_is_invoked_without_arguments,
- test_invoke_when_generator_is_not_found,
- test_invoke_with_config_values,
- test_invoke_with_default_values,
- test_invoke_with_nested_namespaces,
- test_nested_fallbacks_for_generators,
- test_no_color_sets_proper_shell,
- test_rails_generators_does_not_show_active_record_hooks,
- test_rails_generators_help_does_not_include_app_nor_plugin_new,
- test_rails_generators_help_with_builtin_information,
- test_rails_generators_with_others_information,
- test_rails_root_templates,
- test_should_give_higher_preference_to_rails_generators,
- test_simple_invoke,
- test_source_paths_for_not_namespaced_generators,
- test_usage_with_embedded_ruby
Included Modules
Instance Public methods
setup()
Link
teardown()
Link
test_developer_options_are_overwriten_by_user_options()
Link
# File railties/test/generators_test.rb, line 168 def test_developer_options_are_overwriten_by_user_options Rails::Generators.options[:with_options] = { :generate => false } self.class.class_eval <<-end_eval class WithOptionsGenerator < Rails::Generators::Base class_option :generate, :default => true end end_eval assert_equal false, WithOptionsGenerator.class_options[:generate].default ensure Rails::Generators.subclasses.delete(WithOptionsGenerator) end
test_fallbacks_for_generators_on_find_by_namespace()
Link
# File railties/test/generators_test.rb, line 142 def test_fallbacks_for_generators_on_find_by_namespace Rails::Generators.fallbacks[:remarkable] = :test_unit klass = Rails::Generators.find_by_namespace(:plugin, :remarkable) assert klass assert_equal "test_unit:plugin", klass.namespace end
test_fallbacks_for_generators_on_find_by_namespace_with_context()
Link
# File railties/test/generators_test.rb, line 149 def test_fallbacks_for_generators_on_find_by_namespace_with_context Rails::Generators.fallbacks[:remarkable] = :test_unit klass = Rails::Generators.find_by_namespace(:remarkable, :rails, :plugin) assert klass assert_equal "test_unit:plugin", klass.namespace end
test_fallbacks_for_generators_on_invoke()
Link
# File railties/test/generators_test.rb, line 156 def test_fallbacks_for_generators_on_invoke Rails::Generators.fallbacks[:shoulda] = :test_unit TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {}) Rails::Generators.invoke "shoulda:model", ["Account"] end
test_find_by_namespace()
Link
test_find_by_namespace_in_subfolder()
Link
test_find_by_namespace_with_base()
Link
test_find_by_namespace_with_context()
Link
test_find_by_namespace_with_duplicated_name()
Link
test_find_by_namespace_with_generator_on_root()
Link
test_find_by_namespace_without_base_or_context_looks_into_rails_namespace()
Link
test_help_when_a_generator_with_required_arguments_is_invoked_without_arguments()
Link
test_invoke_when_generator_is_not_found()
Link
test_invoke_with_config_values()
Link
test_invoke_with_default_values()
Link
test_invoke_with_nested_namespaces()
Link
# File railties/test/generators_test.rb, line 91 def test_invoke_with_nested_namespaces model_generator = mock('ModelGenerator') do expects(:start).with(["Account"], {}) end Rails::Generators.expects(:find_by_namespace).with('namespace', 'my:awesome').returns(model_generator) Rails::Generators.invoke 'my:awesome:namespace', ["Account"] end
test_nested_fallbacks_for_generators()
Link
# File railties/test/generators_test.rb, line 162 def test_nested_fallbacks_for_generators Rails::Generators.fallbacks[:super_shoulda] = :shoulda TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {}) Rails::Generators.invoke "super_shoulda:model", ["Account"] end
test_no_color_sets_proper_shell()
Link
test_rails_generators_does_not_show_active_record_hooks()
Link
test_rails_generators_help_does_not_include_app_nor_plugin_new()
Link
test_rails_generators_help_with_builtin_information()
Link
# File railties/test/generators_test.rb, line 99 def test_rails_generators_help_with_builtin_information output = capture(:stdout){ Rails::Generators.help } assert_match(/Rails:/, output) assert_match(/^ model$/, output) assert_match(/^ scaffold_controller$/, output) assert_no_match(/^ app$/, output) end
test_rails_generators_with_others_information()
Link
test_rails_root_templates()
Link
# File railties/test/generators_test.rb, line 182 def test_rails_root_templates template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb") # Create template mkdir_p(File.dirname(template)) File.open(template, 'w'){ |f| f.write "empty" } output = capture(:stdout) do Rails::Generators.invoke :model, ["user"], :destination_root => destination_root end assert_file "app/models/user.rb" do |content| assert_equal "empty", content end ensure rm_rf File.dirname(template) end
test_should_give_higher_preference_to_rails_generators()
Link
# File railties/test/generators_test.rb, line 34 def test_should_give_higher_preference_to_rails_generators assert File.exists?(File.join(@path, 'generators', 'model_generator.rb')) Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {}) warnings = capture(:stderr){ Rails::Generators.invoke :model, ["Account"] } assert warnings.empty? end
test_simple_invoke()
Link
# File railties/test/generators_test.rb, line 18 def test_simple_invoke assert File.exists?(File.join(@path, 'generators', 'model_generator.rb')) TestUnit::Generators::ModelGenerator.expects(:start).with(["Account"], {}) Rails::Generators.invoke("test_unit:model", ["Account"]) end
test_source_paths_for_not_namespaced_generators()
Link
test_usage_with_embedded_ruby()
Link
# File railties/test/generators_test.rb, line 205 def test_usage_with_embedded_ruby require File.expand_path("fixtures/lib/generators/usage_template/usage_template_generator", File.dirname(__FILE__)) output = capture(:stdout) { Rails::Generators.invoke :usage_template, ['--help'] } assert_match /:: 2 ::/, output end