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

Adding trim option to ERB, closes #840 #846

Merged
merged 4 commits into from Mar 31, 2013
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rspec/core/configuration_options.rb
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions spec/rspec/core/configuration_options_spec.rb
Expand Up @@ -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"}
Expand Down