Skip to content
Browse files

Merge pull request #1298 from flippingbits/add_test_files_to_gemspec

Add test files to engine's gemspec
  • Loading branch information...
2 parents 41eac9b + 22be5ca commit 903f1f90358f736f6a520df8bdc4fbea86f4b0a6 @josevalim josevalim committed May 25, 2011
View
3 railties/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec
@@ -5,5 +5,8 @@ Gem::Specification.new do |s|
s.summary = "Insert <%= camelized %> summary."
s.description = "Insert <%= camelized %> description."
s.files = Dir["{app,config,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
+<% unless options.skip_test_unit? -%>
+ s.test_files = Dir["test/**/*"]
+<% end -%>
s.version = "0.0.1"
end
View
11 railties/test/generators/plugin_new_generator_test.rb
@@ -173,6 +173,7 @@ def test_creating_gemspec
run_generator
assert_file "bukkits.gemspec", /s.name = "bukkits"/
assert_file "bukkits.gemspec", /s.files = Dir\["\{app,config,lib\}\/\*\*\/\*"\]/
+ assert_file "bukkits.gemspec", /s.test_files = Dir\["test\/\*\*\/\*"\]/
assert_file "bukkits.gemspec", /s.version = "0.0.1"/
end
@@ -187,14 +188,22 @@ def test_passing_dummy_path_as_a_parameter
assert_file "spec/dummy/config/application.rb"
assert_no_file "test/dummy"
end
-
+
def test_creating_dummy_without_tests_but_with_dummy_path
run_generator [destination_root, "--dummy_path", "spec/dummy", "--skip-test-unit"]
assert_file "spec/dummy"
assert_file "spec/dummy/config/application.rb"
assert_no_file "test"
end
+ def test_skipping_test_unit
+ run_generator [destination_root, "--skip-test-unit"]
+ assert_no_file "test"
+ assert_file "bukkits.gemspec" do |contents|
+ assert_no_match /s.test_files = Dir\["test\/\*\*\/\*"\]/, contents
+ end
+ end
+
def test_skipping_gemspec
run_generator [destination_root, "--skip-gemspec"]
assert_no_file "bukkits.gemspec"

0 comments on commit 903f1f9

Please sign in to comment.
Something went wrong with that request. Please try again.