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
require 'delegate'
require "delegate"
module GitHubChangelogGenerator
class Options < SimpleDelegator
UnsupportedOptionError = Class.new(ArgumentError)
@ -48,12 +48,12 @@ module GitHubChangelogGenerator
:unreleased_only,
:user,
:usernames_as_github_logins,
:verbose,
:verbose
]
THESE_ARE_DIFFERENT = [
:tag1,
:tag2,
:tag2
]
def initialize(values)

View File

@ -217,7 +217,7 @@ module GitHubChangelogGenerator
http_cache: true,
cache_file: "/tmp/github-changelog-http-cache",
cache_log: "/tmp/github-changelog-logger.log"
)
)
end
# 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
it "raises an error" do
expect {
expect do
described_class.new(
git_remote: "origin",
strength: "super-strength",
wisdom: "deep"
)
}.to raise_error("[:strength, :wisdom]")
end.to raise_error("[:strength, :wisdom]")
end
end
end
@ -25,17 +25,17 @@ RSpec.describe GitHubChangelogGenerator::Options do
context "with known options" do
it "sets the option value" do
expect {
expect do
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
context "with unknown options" do
it "raises an error" do
expect {
expect do
options[:charisma] = 8
}.to raise_error(":charisma")
end.to raise_error(":charisma")
end
end
end