diff --git a/lib/docs/core/doc.rb b/lib/docs/core/doc.rb index 88080328..b68d3e6c 100644 --- a/lib/docs/core/doc.rb +++ b/lib/docs/core/doc.rb @@ -203,6 +203,8 @@ module Docs [0, 1].each do |i| break if i >= scraper_parts.length or i >= latest_parts.length return 'Outdated major version' if i == 0 and latest_parts[i] > scraper_parts[i] + return 'Outdated major version' if i == 1 and latest_parts[i] > scraper_parts[i] and latest_parts[0] == 0 and scraper_parts[0] == 0 + return 'Outdated major version' if i == 1 and latest_parts[i] > scraper_parts[i] and latest_parts[0] == 1 and scraper_parts[0] == 1 return 'Outdated minor version' if i == 1 and latest_parts[i] > scraper_parts[i] return 'Up-to-date' if latest_parts[i] < scraper_parts[i] end diff --git a/test/lib/docs/core/doc_test.rb b/test/lib/docs/core/doc_test.rb index b188ff0d..3da1fcfc 100644 --- a/test/lib/docs/core/doc_test.rb +++ b/test/lib/docs/core/doc_test.rb @@ -390,12 +390,16 @@ class DocsDocTest < MiniTest::Spec it "compares versions" do instance = doc.versions.first.new + assert_equal "Up-to-date", instance.outdated_state('0.0.2', '0.0.3') + assert_equal "Outdated major version", instance.outdated_state('0.2', '0.3') assert_equal 'Up-to-date', instance.outdated_state('1', '1') assert_equal 'Up-to-date', instance.outdated_state('1.2', '1.2') assert_equal 'Up-to-date', instance.outdated_state('1.2.2', '1.2.2') assert_equal 'Up-to-date', instance.outdated_state('1.2.2', '1.2.3') assert_equal "Outdated major version", instance.outdated_state('1', '2') - assert_equal "Outdated minor version", instance.outdated_state('1.2', '1.3') + assert_equal "Up-to-date", instance.outdated_state('1.0.2', '1.0.3') + assert_equal "Outdated major version", instance.outdated_state('1.2', '1.3') + assert_equal "Outdated minor version", instance.outdated_state('2.2', '2.3') assert_equal "Outdated major version", instance.outdated_state('9', '10') assert_equal "Outdated major version", instance.outdated_state('99', '101') assert_equal 'Up-to-date', instance.outdated_state('2006-01-02', '2006-01-03')