Permalink
Browse files

Merged tests, removed now invalid tests.

  • Loading branch information...
2 parents 0b0d818 + 4266b2a commit 4e14bc13b674e51542d58131559fc0cdd2070b26 @technicalpickles committed Dec 27, 2008
Showing with 32 additions and 12 deletions.
  1. +3 −2 .gitignore
  2. +9 −2 lib/jeweler.rb
  3. +17 −3 test/jeweler_test.rb
  4. +0 −3 test/shoulda_macros/jeweler_macros.rb
  5. +3 −2 test/test_helper.rb
View
@@ -1,5 +1,6 @@
coverage
+pkg
+rdoc
+tags
test/tmp
test/version_tmp
-tags
-pkg
View
@@ -18,8 +18,10 @@ def initialize(gemspec, base_dir = '.')
raise(GemspecError, "Can't create a Jeweler with a nil gemspec") if gemspec.nil?
@gemspec = gemspec
@base_dir = base_dir
-
- @gemspec.files ||= FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
+
+ if @gemspec.files.nil? || @gemspec.files.empty?
+ @gemspec.files = FileList["[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"]
+ end
if File.exists?(File.join(base_dir, '.git'))
@repo = Git.open(base_dir)
@@ -216,5 +218,10 @@ def any_pending_changes?
end
!(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
end
+
+ protected
+ def any_pending_changes?
+ !(@repo.status.added.empty? && @repo.status.deleted.empty? && @repo.status.changed.empty?)
+ end
end
View
@@ -12,23 +12,22 @@ def teardown
FileUtils.rm_rf("#{File.dirname(__FILE__)}/tmp")
end
-
context "A jeweler without a VERSION.yml" do
setup do
FileUtils.mkdir_p(tmp_dir)
@jeweler = Jeweler.new(build_spec, tmp_dir)
end
should "not have VERSION.yml" do
- assert ! File.exists?(File.join(tmp_dir, 'bar.gemspec'))
+ assert ! File.exists?(File.join(tmp_dir, 'VERSION.yml'))
end
end
context "A Jeweler with a VERSION.yml" do
setup do
FileUtils.cp_r(fixture_dir, tmp_dir)
-
+
@jeweler = Jeweler.new(build_spec, tmp_dir)
end
@@ -60,6 +59,21 @@ def teardown
should_bump_version 2, 0, 0
end
+ should "should find files" do
+ assert ! @jeweler.gemspec.files.empty?
+ end
+
+ context "with standard 'files' specified" do
+ setup do
+ @alt_jeweler = Jeweler.new(build_spec("[A-Z]*.*", "{bin,generators,lib,test,spec}/**/*"), tmp_dir)
+ end
+
+ should "have the same files as when no 'files' are specified" do
+ assert_equal @jeweler.gemspec.files, @alt_jeweler.gemspec.files
+ end
+ end
+
+
context "writing the gemspec" do
setup do
@output = catch_out { @jeweler.write_gemspec }
@@ -30,9 +30,6 @@ def should_bump_version(major, minor, patch)
should_have_minor_version minor
should_have_patch_version patch
should_be_version version
- should "output the new version, #{version}" do
- assert_match version, @output
- end
end
end
end
View
@@ -27,6 +27,7 @@
# Fake out FileList from Rake
class FileList
def self.[](*args)
+ TMP_DIR.entries - ['.','..','.DS_STORE']
end
end
@@ -48,15 +49,15 @@ def tmp_dir
File.join(File.dirname(__FILE__), 'tmp')
end
- def build_spec
+ def build_spec(*files)
Gem::Specification.new do |s|
s.name = "bar"
s.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
s.email = "josh@technicalpickles.com"
s.homepage = "http://github.com/technicalpickles/jeweler"
s.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
s.authors = ["Josh Nichols", "Dan Croak"]
- s.files = FileList["[A-Z]*", "{generators,lib,test}/**/*"]
+ s.files = FileList[*files] unless files.empty?
end
end
end

0 comments on commit 4e14bc1

Please sign in to comment.