diff --git a/lib/cucumber/cli/profile_loader.rb b/lib/cucumber/cli/profile_loader.rb index 5682cad04c..a84827a40d 100644 --- a/lib/cucumber/cli/profile_loader.rb +++ b/lib/cucumber/cli/profile_loader.rb @@ -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 diff --git a/spec/cucumber/cli/profile_loader_spec.rb b/spec/cucumber/cli/profile_loader_spec.rb index 54b5543fef..713a9d35da 100644 --- a/spec/cucumber/cli/profile_loader_spec.rb +++ b/spec/cucumber/cli/profile_loader_spec.rb @@ -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