From 5df9d0081bd9e624a143992c4f495bf80c96d7e5 Mon Sep 17 00:00:00 2001 From: siong1987 Date: Wed, 18 May 2011 09:54:24 +0800 Subject: add test case for turn gem for testunit. --- railties/test/generators/app_generator_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 9e1d47cd2f..8c89c06e02 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -202,6 +202,14 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_inclusion_of_turn_gem_in_gemfile + run_generator + assert_file "Gemfile" do |contents| + assert_match /gem 'turn'/, contents unless RUBY_VERSION < '1.9.2' + assert_no_match /gem 'turn'/, contents if RUBY_VERSION < '1.9.2' + end + end + def test_template_from_dir_pwd FileUtils.cd(Rails.root) assert_match /It works from file!/, run_generator([destination_root, "-m", "lib/template.rb"]) -- cgit v1.2.3 From ea306da4eb8943dca13197ad9880df18e45a13a4 Mon Sep 17 00:00:00 2001 From: Teng Siong Ong Date: Wed, 18 May 2011 10:08:34 +0800 Subject: add tests for ruby-debug gem in Gemfile and make sure that ruby-debug19 is used as long as RUBY_VERSION > '1.9'. --- railties/test/generators/app_generator_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 8c89c06e02..c1912c23b8 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -210,6 +210,20 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_inclusion_of_ruby_debug + run_generator + assert_file "Gemfile" do |contents| + assert_match /gem 'ruby-debug'/, contents if RUBY_VERSION < '1.9' + end + end + + def test_inclusion_of_ruby_debug19_if_ruby19 + run_generator + assert_file "Gemfile" do |contents| + assert_match /gem 'ruby-debug19', :require => 'ruby-debug'/, contents unless RUBY_VERSION < '1.9' + end + end + def test_template_from_dir_pwd FileUtils.cd(Rails.root) assert_match /It works from file!/, run_generator([destination_root, "-m", "lib/template.rb"]) -- cgit v1.2.3 From da29e0bfc2fa83efaf12c9ad31f4b5005178c8a5 Mon Sep 17 00:00:00 2001 From: Teng Siong Ong Date: Wed, 18 May 2011 10:21:45 +0800 Subject: don't include 'turn' gem in Gemfile if test unit is skipped. --- railties/test/generators/app_generator_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'railties/test') diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index c1912c23b8..80d9732343 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -210,6 +210,13 @@ class AppGeneratorTest < Rails::Generators::TestCase end end + def test_turn_gem_is_not_included_in_gemfile_if_skipping_test_unit + run_generator [destination_root, "--skip-test-unit"] + assert_file "Gemfile" do |contents| + assert_no_match /gem 'tuarn'/, contents unless RUBY_VERSION < '1.9.2' + end + end + def test_inclusion_of_ruby_debug run_generator assert_file "Gemfile" do |contents| -- cgit v1.2.3