Created
December 1, 2011 15:57
-
-
Save jnunemaker/1417776 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserPresenterTest < Test::Unit::TestCase | |
def test_as_json | |
user = Factory(:user, { | |
:first_name => 'John', | |
:last_name => 'Nunemaker', | |
:email => 'john@doe.com', | |
}) | |
json = UserPresenter.new(user).as_json | |
urls = json['urls'] | |
assert { json['id'] == user.id } | |
assert { json['email'] == 'john@doe.com' } | |
assert { json['first_name'] == 'John' } | |
assert { json['last_name'] == 'Nunemaker' } | |
assert { json['name'] == 'John Nunemaker' } | |
assert { urls['self'] == "#{Gauges.api_url}/me" } | |
assert { urls['gauges'] == "#{Gauges.api_url}/gauges" } | |
assert { urls['clients'] == "#{Gauges.api_url}/clients" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment