spec/changelog_spec.rb in danger-changelog-0.3.0 vs spec/changelog_spec.rb in danger-changelog-0.4.0
- old
+ new
@@ -1,14 +1,14 @@
-require File.expand_path('../spec_helper', __FILE__)
+require File.expand_path('spec_helper', __dir__)
describe Danger::Changelog do
it 'is a Danger plugin' do
expect(Danger::DangerChangelog.new(nil)).to be_a Danger::Plugin
end
describe 'with Dangerfile' do
- let(:filename) { File.expand_path('../fixtures/changelogs/minimal.md', __FILE__) }
+ let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
let(:dangerfile) { testing_dangerfile }
let(:changelog) do
dangerfile.changelog.filename = filename
dangerfile.changelog
end
@@ -106,21 +106,21 @@
Danger::Changelog.configure do |config|
config.placeholder_line = "* Nothing yet.\n"
end
end
- let(:filename) { File.expand_path('../fixtures/changelogs/customized.md', __FILE__) }
+ let(:filename) { File.expand_path('fixtures/changelogs/customized.md', __dir__) }
it 'is ok' do
expect(subject).to be true
expect(status_report[:errors]).to eq []
expect(status_report[:warnings]).to eq []
expect(status_report[:markdowns]).to eq []
end
end
context 'missing your contribution here' do
- let(:filename) { File.expand_path('../fixtures/changelogs/missing_your_contribution_here.md', __FILE__) }
+ let(:filename) { File.expand_path('fixtures/changelogs/missing_your_contribution_here.md', __dir__) }
context 'when placeholder line is customized' do
before do
Danger::Changelog.configure do |config|
config.placeholder_line = "* Nothing yet.\n"
@@ -159,11 +159,11 @@
end
end
end
context 'minimal example' do
- let(:filename) { File.expand_path('../fixtures/changelogs/minimal.md', __FILE__) }
+ let(:filename) { File.expand_path('fixtures/changelogs/minimal.md', __dir__) }
it 'is ok' do
expect(subject).to be true
expect(status_report[:errors]).to eq []
expect(status_report[:warnings]).to eq []
expect(status_report[:markdowns]).to eq []
@@ -176,23 +176,23 @@
end
end
it 'complains' do
expect(subject).to be false
- expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to periods and spaces."]
+ expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
expect(status_report[:warnings]).to eq []
expect(status_report[:markdowns].map(&:message)).to eq [
"```markdown\n* Your contribution here.\n```\n"
]
end
end
end
context 'with bad lines' do
- let(:filename) { File.expand_path('../fixtures/changelogs/with_bad_lines.md', __FILE__) }
+ let(:filename) { File.expand_path('fixtures/changelogs/with_bad_lines.md', __dir__) }
it 'complains' do
expect(subject).to be false
- expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to periods and spaces."]
+ expect(status_report[:errors]).to eq ["One of the lines below found in #{filename} doesn't match the expected format. Please make it look like the other lines, pay attention to version numbers, periods, spaces and date formats."]
expect(status_report[:warnings]).to eq []
expect(status_report[:markdowns].map(&:message)).to eq [
"```markdown\nMissing star - [@dblock](https://github.com/dblock).\n```\n",
"```markdown\n* [#1](https://github.com/dblock/danger-changelog/pull/1) - Not a colon - [@dblock](https://github.com/dblock).\n```\n",
"```markdown\n* [#1](https://github.com/dblock/danger-changelog/pull/1): No final period - [@dblock](https://github.com/dblock)\n```\n",