Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

coffee test: strip body in equal assertions #404

Merged
merged 1 commit into from

3 participants

@lest

I got errors running tests

  1) Failure:
test_passes_coffee_options_to_the_coffee_engine(CoffeeTest) [/Users/lest/code/sinatra/test/coffee_test.rb:74]:
<"alert('Aye!');"> expected but was
<"\nalert('Aye!');\n">.

  2) Failure:
test_passes_default_coffee_options_to_the_coffee_engine(CoffeeTest)     [/Users/lest/code/sinatra/test/coffee_test.rb:86]:
<"alert('Aye!');"> expected but was
<"\nalert('Aye!');\n">.

So I think it's good to use stripped body in assertion

@josh

CoffeeScript 1.1.3 has whitespace changes. Probably should use a regexp to test what you care about here.

@rkh
Owner
rkh commented

We have an assert_body helper for whitespace/newline insensitive matching.

@lest

Thanks, I've used assert_body.

@rkh rkh merged commit 84aac76 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 9, 2011
  1. @lest

    use assert body in coffee test

    lest authored
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 test/coffee_test.rb
View
4 test/coffee_test.rb
@@ -71,7 +71,7 @@ def coffee_app(options = {}, &block)
it "passes coffee options to the coffee engine" do
coffee_app { coffee "alert 'Aye!'\n", :no_wrap => true }
assert ok?
- assert_equal "alert('Aye!');", body
+ assert_body "alert('Aye!');"
end
it "passes default coffee options to the coffee engine" do
@@ -83,7 +83,7 @@ def coffee_app(options = {}, &block)
end
get '/'
assert ok?
- assert_equal "alert('Aye!');", body
+ assert_body "alert('Aye!');"
end
end
Something went wrong with that request. Please try again.