Permalink
Browse files

Merge pull request #1112 from FLOChip/turn

add test case for turn gem for testunit.
  • Loading branch information...
2 parents c2105d3 + da29e0b commit 2692d3278a7b15699491f8c86b4180eaad9ce196 @josevalim josevalim committed May 18, 2011
Showing with 31 additions and 2 deletions.
  1. +2 −2 railties/lib/rails/generators/app_base.rb
  2. +29 −0 railties/test/generators/app_generator_test.rb
View
4 railties/lib/rails/generators/app_base.rb
@@ -165,15 +165,15 @@ def gem_for_database
end
def gem_for_ruby_debugger
- if RUBY_VERSION < "1.9.2"
+ if RUBY_VERSION < "1.9"
"gem 'ruby-debug'"
else
"gem 'ruby-debug19', :require => 'ruby-debug'"
end
end
def gem_for_turn
- unless RUBY_VERSION < "1.9.2"
+ unless RUBY_VERSION < "1.9.2" || options[:skip_test_unit]
<<-GEMFILE.strip_heredoc
group :test do
# Pretty printed test output
View
29 railties/test/generators/app_generator_test.rb
@@ -202,6 +202,35 @@ def test_javascript_is_skipped_if_required
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_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|
+ 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"])

0 comments on commit 2692d32

Please sign in to comment.