Skip to content

Commit

Permalink
Add spec for duplicate formatter on different output
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpeattie committed Dec 3, 2013
1 parent defc226 commit 751a07d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion spec/rspec/core/configuration_spec.rb
Expand Up @@ -814,6 +814,7 @@ def metadata_hash(*args)
end

describe "#add_formatter" do
let(:path) { File.join(Dir.tmpdir, 'output.txt') }

it "adds to the list of formatters" do
config.add_formatter :documentation
Expand Down Expand Up @@ -867,7 +868,6 @@ def metadata_hash(*args)

context "with a 2nd arg defining the output" do
it "creates a file at that path and sets it as the output" do
path = File.join(Dir.tmpdir, 'output.txt')
config.add_formatter('doc', path)
expect(config.formatters.first.output).to be_a(File)
expect(config.formatters.first.output.path).to eq(path)
Expand All @@ -882,6 +882,15 @@ def metadata_hash(*args)
}.not_to change { config.formatters.length }
end
end

context "when a duplicate formatter exists for a different output target" do
it "does not add the formatter" do
config.add_formatter :documentation, path
expect {
config.add_formatter :documentation
}.to change { config.formatters.length }
end
end
end

describe "#filter_run_including" do
Expand Down

0 comments on commit 751a07d

Please sign in to comment.