Created
November 24, 2009 04:00
-
-
Save eedrummer/241617 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
context "when receiving a POST" do | |
should "not allow an incomplete request" do | |
post '/', {:type => 'extension'} | |
assert_equal 400, last_response.status | |
end | |
should "allow the registration of a new extension" do | |
post '/', {:type => 'extension', | |
:typeId => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy', | |
:requirement => 'mandatory'} | |
assert_equal 201, last_response.status | |
extension = Extension.first( | |
:type_id => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy') | |
assert extension | |
assert_equal 'mandatory', extension.requirement | |
end | |
should "not allow the registration of a duplicate extension" do | |
Extension.new( | |
:type_id => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy', | |
:requirement => 'mandatory').save | |
post '/', {:type => 'extension', | |
:typeId => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy', | |
:requirement => 'mandatory'} | |
assert_equal 409, last_response.status | |
end | |
should "allow the creation of a new section" do | |
Extension.new( | |
:type_id => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy', | |
:requirement => 'mandatory').save | |
post '/', {:type => 'section', | |
:typeId => | |
'http://projecthdata.org/hdata/schemas/2009/06/allergy', | |
:path => 'allergies', | |
:name => 'Allergies'} | |
assert_equal 201, last_response.status | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment