Skip to content

Commit

Permalink
fix(publish): accept pact file paths using windows separator
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Nov 9, 2017
1 parent dcba2d6 commit 5ee9dd7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pact_broker/client/cli/broker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def publish_pacts pact_files
end

def file_list pact_files
Rake::FileList[pact_files].collect do | path |
correctly_separated_pact_files = pact_files.collect{ |path| path.gsub(/\\+/, '/') }
Rake::FileList[correctly_separated_pact_files].collect do | path |
if File.directory?(path)
Rake::FileList[File.join(path, "*.json")]
else
Expand Down
15 changes: 15 additions & 0 deletions spec/lib/pact_broker/client/cli/broker_publish_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ module PactBroker::Client::CLI
end
end

context "with a windows directory specified" do
let(:file_list) { ['spec\\support\cli_test_pacts'] }

it "invokes the PublishPacts command with the list of files in the directory" do
expect(PactBroker::Client::PublishPacts).to receive(:call).with(
anything,
["spec/support/cli_test_pacts/bar.json", "spec/support/cli_test_pacts/foo.json"],
anything,
anything,
anything
)
invoke_broker
end
end

context "with a tag" do
before do
subject.options = OpenStruct.new(minimum_valid_options.merge(tag: ['foo']))
Expand Down

0 comments on commit 5ee9dd7

Please sign in to comment.