Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow review_version to be nil, which means that I don't care about the version #592

Merged
merged 3 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/review/configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ def [](key)
end

def check_version(version)
if self["review_version"].blank?
unless self.key?("review_version")
raise ReVIEW::ConfigError, "configuration file has no review_version property."
end

if self["review_version"].blank?
# do nothing
elsif self["review_version"].to_i != version.to_i ## major version
raise ReVIEW::ConfigError, "major version of configuration file is different."
elsif self["review_version"].to_f > version.to_f ## minor version
Expand Down
9 changes: 8 additions & 1 deletion test/test_configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,16 @@ def test_configure_with_invalidmaker
assert_equal true, @config["epubmaker"]["flattocindent"]
end

def test_check_version_nosetting
@config.delete("review_version")
assert_raise ReVIEW::ConfigError do
@config.check_version("2.0.0")
end
end

def test_check_version_noversion
@config["review_version"] = nil
assert_raise ReVIEW::ConfigError do
assert_nothing_raised ReVIEW::ConfigError do
@config.check_version("2.0.0")
end
end
Expand Down