Options: a class to wrap Hash-accessing options choices

- protects against bad names
This commit is contained in:
Olle Jonsson
2016-10-05 19:35:55 +00:00
parent d41a818676
commit 43a6e49055
5 changed files with 97 additions and 6 deletions

16
spec/unit/options_spec.rb Normal file
View File

@@ -0,0 +1,16 @@
# frozen_string_literal: true
describe GitHubChangelogGenerator::Options do
it 'can be instantiated with defaults' do
expect(described_class.new(user: 'olle')[:user]).to eq('olle')
end
it 'disallows unknown option names' do
expect {
described_class.new(
git_remote: 'origin',
strength: 'super-strength',
wisdom: 'deep'
)
}.to raise_error(ArgumentError, "Unsupported options [:strength, :wisdom]")
end
end

View File

@@ -85,10 +85,6 @@ describe GitHubChangelogGenerator::Reader do
context "angular.js.md" do
it { is_expected.to be_an(Array) }
it { is_expected.not_to be_empty }
it do
pending("Implement heading_level for parser.")
expect(subject.count).to eq(134)
end
# it do
# pending('Implement heading_level for parser.')
# expect(subject.first).to include('version' => '1.4.0-beta.6 cookie-liberation')