Permalink
Browse files

Add unit test for response templating

  • Loading branch information...
1 parent 0f73fa3 commit 78a13104878c70c917b43f713b72c33ef07cb397 @knuton committed Jan 8, 2012
Showing with 13 additions and 7 deletions.
  1. +13 −7 test/test_response.rb
View
@@ -4,20 +4,26 @@
class TestResponse < Test::Unit::TestCase
- def setup
- @response = SecondMate::Response.new(
+ def test_yaml_frontmatter
+ response = SecondMate::Response.new(
"---\nstatus: 201\nheader:\n Foo: Baz\n---\nBody",
{},
200,
{'Foo' => 'Bar'}
- )
- end
-
- def test_yaml_frontmatter
- response = @response.finish
+ ).finish
assert_equal ['Body'], response.last.body
assert_equal 'Baz', response[1]['Foo']
end
+ def test_templating
+ response = SecondMate::Response.new(
+ "<%= params['foo'] %>",
+ {'foo' => 'Bar'},
+ 200,
+ {}
+ ).finish
+ assert_equal ['Bar'], response.last.body
+ end
+
end

0 comments on commit 78a1310

Please sign in to comment.