Skip to content

Commit

Permalink
Avoid including VersionSorter as mixin
Browse files Browse the repository at this point in the history
Tests should use the module as it's meant to be used in the wild.
  • Loading branch information
mislav committed Feb 4, 2015
1 parent 602697e commit 1a82ab1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/version_sorter_test.rb
Expand Up @@ -2,18 +2,16 @@
require 'version_sorter'

class VersionSorterTest < Test::Unit::TestCase
include VersionSorter

def test_sorts_versions_correctly
versions = %w(1.0.9 1.0.10 2.0 3.1.4.2 1.0.9a)
sorted_versions = %w( 1.0.9 1.0.9a 1.0.10 2.0 3.1.4.2 )

assert_equal sorted_versions, sort(versions)
assert_equal sorted_versions, VersionSorter.sort(versions)
end

def test_returns_same_object
versions = %w( 2.0 1.0 0.5 )
sorted = sort(versions)
sorted = VersionSorter.sort(versions)

assert_equal versions[2].object_id, sorted[0].object_id
end
Expand All @@ -22,6 +20,6 @@ def test_reverse_sorts_versions_correctly
versions = %w(1.0.9 1.0.10 2.0 3.1.4.2 1.0.9a)
sorted_versions = %w( 3.1.4.2 2.0 1.0.10 1.0.9a 1.0.9 )

assert_equal sorted_versions, rsort(versions)
assert_equal sorted_versions, VersionSorter.rsort(versions)
end
end

0 comments on commit 1a82ab1

Please sign in to comment.