-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from ryz310/feature/template_on_gist
The github-nippou will be able to use custom format.
- Loading branch information
Showing
8 changed files
with
289 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--require spec_helper | ||
--format documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
format: | ||
subject: '### %{subject}' | ||
line: '* [%{title}](%{url}) by %{user} %{status}' | ||
dictionary: | ||
status: | ||
merged: '**merged!**' | ||
closed: '**closed!**' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
require 'spec_helper' | ||
|
||
describe Github::Nippou::Commands do | ||
let(:commands) { described_class.new } | ||
|
||
describe '#settings' do | ||
subject(:execute) { commands.send(:settings) } | ||
|
||
let(:settings) do | ||
{ | ||
format: { | ||
subject: '### %{subject}', | ||
line: '* [%{title}](%{url}) by %{user} %{status}', | ||
}, | ||
} | ||
end | ||
|
||
let(:yaml) { settings.to_yaml } | ||
|
||
context "when ENV['GITHUB_NIPPOU_SETTINGS'] present" do | ||
before { ENV['GITHUB_NIPPOU_SETTINGS'] = yaml } | ||
|
||
context 'given valid YAML syntax' do | ||
it 'should set YAML value to @settings' do | ||
expect { execute } | ||
.to change { commands.instance_variable_get(:@settings) } | ||
.to settings | ||
end | ||
end | ||
|
||
context 'given invalid YAML syntax' do | ||
before do | ||
ENV['GITHUB_NIPPOU_SETTINGS'] = <<~INVALID_YAML | ||
format: | ||
**!!invalid!!** | ||
line: '* [%{title}](%{url}) by %{user} %{status}' | ||
INVALID_YAML | ||
end | ||
|
||
it 'should output YAML syntax error message' do | ||
expect { | ||
begin | ||
execute | ||
rescue SystemExit | ||
nil | ||
end | ||
}.to output(<<~ERROR).to_stdout | ||
** YAML syntax error. | ||
(<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 2 column 3 | ||
format: | ||
**!!invalid!!** | ||
line: '* [%{title}](%{url}) by %{user} %{status}' | ||
ERROR | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.