Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove integration tests and ActionModel/ActiveRecord calls from 'rak…

…e plugin new' generator, it shouldn't be available as default option
  • Loading branch information...
commit 68295bc69349fc4fd4f8fa2023cf369b70039848 1 parent ac8f927
@drogus drogus authored
View
5 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
@@ -215,8 +215,9 @@ def valid_const?
def application_definition
@application_definition ||= begin
- unless options[:pretend]
- contents = File.read(File.expand_path("#{dummy_path}/config/application.rb", destination_root))
+ dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
+ unless options[:pretend] || !File.exists?(dummy_application_path)
+ contents = File.read(dummy_application_path)
contents[(contents.index("module Dummy"))..-1]
end
end
View
3  railties/lib/rails/generators/rails/plugin_new/templates/Gemfile
@@ -2,9 +2,6 @@ source "http://rubygems.org"
<%= rails_gemfile_entry -%>
-gem "capybara", ">= 0.3.9"
-gem "sqlite3-ruby", :require => "sqlite3"
-
if RUBY_VERSION < '1.9'
gem "ruby-debug", ">= 0.10.3"
end
View
6 railties/lib/rails/generators/rails/plugin_new/templates/rails/application.rb
@@ -1,10 +1,6 @@
require File.expand_path('../boot', __FILE__)
-require "active_model/railtie"
-require "active_record/railtie"
-require "action_controller/railtie"
-require "action_view/railtie"
-require "action_mailer/railtie"
+require 'rails/all'
Bundler.require
require "<%= name %>"
View
7 ...es/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb.tt
@@ -1,7 +0,0 @@
-require 'test_helper'
-
-class NagivationTest < ActiveSupport::IntegrationCase
- test "truth" do
- assert_kind_of Dummy::Application, Rails.application
- end
-end
View
5 railties/lib/rails/generators/rails/plugin_new/templates/test/support/integration_case.rb
@@ -1,5 +0,0 @@
-# Define a bare test case to use with Capybara
-class ActiveSupport::IntegrationCase < ActiveSupport::TestCase
- include Capybara
- include Rails.application.routes.url_helpers
-end
View
14 railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb
@@ -4,19 +4,7 @@
require File.expand_path("../dummy/config/environment.rb", __FILE__)
require "rails/test_help"
-ActionMailer::Base.delivery_method = :test
-ActionMailer::Base.perform_deliveries = true
-ActionMailer::Base.default_url_options[:host] = "test.com"
-
Rails.backtrace_cleaner.remove_silencers!
-# Configure capybara for integration testing
-require "capybara/rails"
-Capybara.default_driver = :rack_test
-Capybara.default_selector = :css
-
-# Run any available migration
-ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
-
# Load support files
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
+Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
View
2  railties/test/generators/app_generator_test.rb
@@ -145,7 +145,7 @@ def test_prototype_and_test_unit_are_added_by_default
def test_test_unit_is_skipped_if_required
run_generator [destination_root, "--skip-test-unit"]
- assert_no_file "test"
+ assert_no_file "test"
end
def test_javascript_is_skipped_if_required
View
8 railties/test/generators/plugin_new_generator_test.rb
@@ -13,8 +13,6 @@
lib/bukkits.rb
script/rails
test/bukkits_test.rb
- test/integration/navigation_test.rb
- test/support/integration_case.rb
test/test_helper.rb
test/dummy
)
@@ -43,12 +41,8 @@ def test_invalid_plugin_name_is_fixed
def test_generating_test_files
run_generator
assert_file "test/test_helper.rb"
- assert_directory "test/support/"
- assert_directory "test/integration/"
assert_file "test/bukkits_test.rb", /assert_kind_of Module, Bukkits/
- assert_file "test/integration/navigation_test.rb", /assert_kind_of Dummy::Application, Rails.application/
- assert_file "test/support/integration_case.rb", /class ActiveSupport::IntegrationCase/
end
def test_ensure_that_plugin_options_are_not_passed_app_generator
@@ -66,7 +60,7 @@ def test_ensure_that_tests_works
run_generator
FileUtils.cd destination_root
`bundle install`
- assert_match /2 tests, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test`
+ assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, `bundle exec rake test`
end
protected
Please sign in to comment.
Something went wrong with that request. Please try again.