diff --git a/spec/occi/occi_server_spec.rb b/spec/occi/occi_server_spec.rb index effc278..9187b79 100644 --- a/spec/occi/occi_server_spec.rb +++ b/spec/occi/occi_server_spec.rb @@ -1,20 +1,31 @@ require 'occi/occi-server' require 'rspec' require 'rack/test' +require 'logger' VERSION_NUMBER=0.5 -module OCCI - describe OCCIServer do - include Rack::Test::Methods - def app - OCCIServer - end +describe OCCIServer do + include Rack::Test::Methods - it "serves registered categories through discovery interface" do - get '/-/' - last_response.should be_ok - last_response.body.should include('Category') - end + def app + OCCIServer.new({:log_level => Logger::UNKNOWN}) end -end \ No newline at end of file + + it "serves registered categories through discovery interface" do + get '/-/' + last_response.should be_ok + last_response.body.should include('Category') + end + + it "creates new compute resource" do + headers = {:accept => "text/uri-list"} + body = %Q{Category: compute; scheme="http://schemas.ogf.org/occi/infrastructure#"; class="kind";} + body += %Q{\nX-OCCI-Attribute: occi.compute.cores=2} + body += %Q{\nX-OCCI-Attribute: occi.compute.hostname="mycompute.example.com"} + post '/compute/', body, headers + last_response.should be_ok + last_response.body.should include('Location') + end + +end