Skip to content

Commit

Permalink
Fix failing tests pertaining to Version and timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Aug 3, 2011
1 parent 44d952d commit 980fdfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
10 changes: 5 additions & 5 deletions test/functional/rubygems_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,15 @@ class RubygemsControllerTest < ActionController::TestCase
should "render info about the gem" do
assert page.has_content?(@rubygem.name)
assert page.has_content?(@latest_version.number)
assert page.has_content?(@latest_version.built_at.to_date.to_formatted_s(:long))
assert page.has_css?("small:contains('#{@latest_version.built_at.to_date.to_formatted_s(:long)}')")
assert page.has_content?("Links")
end
end

context "On GET to show with a gem that has multiple versions" do
setup do
@rubygem = Factory(:rubygem)
@older_version = Factory(:version, :number => "1.0.0", :rubygem => @rubygem, :created_at => 2.minutes.ago)
@older_version = Factory(:version, :number => "1.0.0", :rubygem => @rubygem, :created_at => 2.days.ago)
@latest_version = Factory(:version, :number => "2.0.0", :rubygem => @rubygem, :created_at => 1.minute.ago)
get :show, :id => @rubygem.to_param
end
Expand All @@ -289,11 +289,11 @@ class RubygemsControllerTest < ActionController::TestCase
should "render info about the gem" do
assert page.has_content?(@rubygem.name)
assert page.has_content?(@latest_version.number)
assert page.has_content?(@latest_version.built_at.to_date.to_formatted_s(:long))
assert page.has_css?("small:contains('#{@latest_version.built_at.to_date.to_formatted_s(:long)}')")

assert page.has_content?("Versions")
assert page.has_content?(@rubygem.versions.last.number)
assert page.has_content?(@rubygem.versions.last.built_at.to_date.to_formatted_s(:long))
assert page.has_content?(@older_version.number)
assert page.has_css?("small:contains('#{@older_version.built_at.to_date.to_formatted_s(:long)}')")
end
end

Expand Down
6 changes: 1 addition & 5 deletions test/unit/version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,7 @@ class VersionTest < ActiveSupport::TestCase
assert_equal @version.summary.blank?, spec.summary.blank?

date = @version.built_at
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
assert_equal Time.utc(date.year, date.month, date.day), spec.date
else
assert_equal Time.local(date.year, date.month, date.day), spec.date
end
assert_equal Time.utc(date.year, date.month, date.day), spec.date.utc
end

should "join multiple authors on gemspecs" do
Expand Down

0 comments on commit 980fdfd

Please sign in to comment.