Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cucumber.yml to parse % erb code lines #755

Merged
merged 2 commits into from
Dec 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/cucumber/cli/profile_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def cucumber_yml
require 'erb'
require 'yaml'
begin
@cucumber_erb = ERB.new(IO.read(cucumber_file)).result(binding)
@cucumber_erb = ERB.new(IO.read(cucumber_file), nil, '%').result(binding)
rescue Exception => e
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$!.inspect}")
end
Expand Down
10 changes: 10 additions & 0 deletions spec/cucumber/cli/profile_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ def loader

expect(loader.args_from('default')).to eq ['--format','ugly','features/sync_imap_mailbox.feature:16:22']
end

it "treats percent sign as ERB code block after YAML directive" do
yml = <<-HERE
---
% x = '--format "pretty" features/sync_imap_mailbox.feature:16:22'
default: <%= x %>
HERE
given_cucumber_yml_defined_as yml
expect(loader.args_from('default')).to eq ['--format','pretty','features/sync_imap_mailbox.feature:16:22']
end
end
end
end