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

Use rails integration tests by default in 'plugin new' generator

This commit is contained in:
Piotr Sarnacki 2010-11-02 14:05:11 +01:00
parent 4d108cb33d
commit 57fae9b2c7
7 changed files with 8 additions and 21 deletions

View file

@ -27,9 +27,6 @@ gem "memcache-client", ">= 1.8.5"
# AM # AM
gem "text-format", "~> 1.0.0" gem "text-format", "~> 1.0.0"
# for 'plugin new --full' generator
gem "capybara"
platforms :mri_18 do platforms :mri_18 do
gem "system_timer" gem "system_timer"
gem "ruby-debug", ">= 0.10.3" gem "ruby-debug", ">= 0.10.3"

View file

@ -39,7 +39,6 @@ module Rails
template "test/%name%_test.rb" template "test/%name%_test.rb"
if full? if full?
template "test/integration/navigation_test.rb" template "test/integration/navigation_test.rb"
template "test/support/integration_case.rb"
end end
end end

View file

@ -3,7 +3,6 @@ source "http://rubygems.org"
<%= rails_gemfile_entry -%> <%= rails_gemfile_entry -%>
<% if full? -%> <% if full? -%>
gem "capybara", ">= 0.3.9"
gem "sqlite3-ruby", :require => "sqlite3" gem "sqlite3-ruby", :require => "sqlite3"
<% end -%> <% end -%>

View file

@ -1,7 +1,11 @@
require 'test_helper' require 'test_helper'
class NagivationTest < ActiveSupport::IntegrationCase class NavigationTest < ActionDispatch::IntegrationTest
test "truth" do fixtures :all
assert_kind_of Dummy::Application, Rails.application
# Replace this with your real tests.
test "the truth" do
assert true
end end
end end

View file

@ -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 file

@ -7,11 +7,6 @@ require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers! Rails.backtrace_cleaner.remove_silencers!
<% if full? -%> <% if full? -%>
# Configure capybara for integration testing
require "capybara/rails"
Capybara.default_driver = :rack_test
Capybara.default_selector = :css
# Run any available migration from application # Run any available migration from application
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__) ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
# and from engine # and from engine

View file

@ -46,11 +46,9 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
def test_generating_test_files_in_full_mode def test_generating_test_files_in_full_mode
run_generator [destination_root, "--full"] run_generator [destination_root, "--full"]
assert_directory "test/support/"
assert_directory "test/integration/" assert_directory "test/integration/"
assert_file "test/integration/navigation_test.rb", /assert_kind_of Dummy::Application, Rails.application/ assert_file "test/integration/navigation_test.rb", /ActionDispatch::IntegrationTest/
assert_file "test/support/integration_case.rb", /class ActiveSupport::IntegrationCase/
end end
def test_ensure_that_plugin_options_are_not_passed_to_app_generator def test_ensure_that_plugin_options_are_not_passed_to_app_generator