Skip to content

Commit

Permalink
Add unit test for response templating
Browse files Browse the repository at this point in the history
  • Loading branch information
knuton committed Jan 8, 2012
1 parent 0f73fa3 commit 78a1310
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions test/test_response.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@


class TestResponse < Test::Unit::TestCase class TestResponse < Test::Unit::TestCase


def setup def test_yaml_frontmatter
@response = SecondMate::Response.new( response = SecondMate::Response.new(
"---\nstatus: 201\nheader:\n Foo: Baz\n---\nBody", "---\nstatus: 201\nheader:\n Foo: Baz\n---\nBody",
{}, {},
200, 200,
{'Foo' => 'Bar'} {'Foo' => 'Bar'}
) ).finish
end

def test_yaml_frontmatter
response = @response.finish
assert_equal ['Body'], response.last.body assert_equal ['Body'], response.last.body
assert_equal 'Baz', response[1]['Foo'] assert_equal 'Baz', response[1]['Foo']
end end


def test_templating
response = SecondMate::Response.new(
"<%= params['foo'] %>",
{'foo' => 'Bar'},
200,
{}
).finish
assert_equal ['Bar'], response.last.body
end

end end


0 comments on commit 78a1310

Please sign in to comment.