Permalink
Browse files

Merge pull request #846 from hron84/feature-erb-trim

Adding trim option to ERB, closes #840
  • Loading branch information...
2 parents f4cca6f + 0bcd11b commit b4303287493663a85b933301ac3007047e42bc16 @myronmarston myronmarston committed Mar 31, 2013
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/rspec/core/configuration_options.rb
  2. +10 −0 spec/rspec/core/configuration_options_spec.rb
@@ -116,7 +116,7 @@ def args_from_options_file(path)
end
def options_file_as_erb_string(path)
- ERB.new(File.read(path)).result(binding)
+ ERB.new(File.read(path), nil, '-').result(binding)
end
def custom_options_file
@@ -378,6 +378,16 @@
expect(parse_options[:formatters]).to eq([['local']])
end
+ it "parses options file correctly if erb code has trimming options" do
+ File.open("./.rspec", "w") do |f|
+ f << "<% if true -%>\n"
+ f << "--format local\n"
+ f << "<%- end %>\n"
+ end
+
+ expect(parse_options[:formatters]).to eq([['local']])
+ end
+
context "with custom options file" do
it "ignores project and global options files" do
File.open("./.rspec", "w") {|f| f << "--format project"}

0 comments on commit b430328

Please sign in to comment.