This commit is contained in:
Olle Jonsson 2016-10-05 23:31:19 +02:00
parent c1f6fce86c
commit e123466b82
3 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require 'delegate' require "delegate"
module GitHubChangelogGenerator module GitHubChangelogGenerator
class Options < SimpleDelegator class Options < SimpleDelegator
UnsupportedOptionError = Class.new(ArgumentError) UnsupportedOptionError = Class.new(ArgumentError)
@ -48,12 +48,12 @@ module GitHubChangelogGenerator
:unreleased_only, :unreleased_only,
:user, :user,
:usernames_as_github_logins, :usernames_as_github_logins,
:verbose, :verbose
] ]
THESE_ARE_DIFFERENT = [ THESE_ARE_DIFFERENT = [
:tag1, :tag1,
:tag2, :tag2
] ]
def initialize(values) def initialize(values)

View File

@ -217,7 +217,7 @@ module GitHubChangelogGenerator
http_cache: true, http_cache: true,
cache_file: "/tmp/github-changelog-http-cache", cache_file: "/tmp/github-changelog-http-cache",
cache_log: "/tmp/github-changelog-logger.log" cache_log: "/tmp/github-changelog-logger.log"
) )
end end
# If `:user` or `:project` not set in options, try setting them # If `:user` or `:project` not set in options, try setting them

View File

@ -9,13 +9,13 @@ RSpec.describe GitHubChangelogGenerator::Options do
context "with unknown options" do context "with unknown options" do
it "raises an error" do it "raises an error" do
expect { expect do
described_class.new( described_class.new(
git_remote: "origin", git_remote: "origin",
strength: "super-strength", strength: "super-strength",
wisdom: "deep" wisdom: "deep"
) )
}.to raise_error("[:strength, :wisdom]") end.to raise_error("[:strength, :wisdom]")
end end
end end
end end
@ -25,17 +25,17 @@ RSpec.describe GitHubChangelogGenerator::Options do
context "with known options" do context "with known options" do
it "sets the option value" do it "sets the option value" do
expect { expect do
options[:git_remote] = "in the cloud" options[:git_remote] = "in the cloud"
}.to change { options[:git_remote] }.to "in the cloud" end.to change { options[:git_remote] }.to "in the cloud"
end end
end end
context "with unknown options" do context "with unknown options" do
it "raises an error" do it "raises an error" do
expect { expect do
options[:charisma] = 8 options[:charisma] = 8
}.to raise_error(":charisma") end.to raise_error(":charisma")
end end
end end
end end