Created
December 4, 2008 22:52
-
-
Save paul/32131 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
require File.join(File.dirname(__FILE__), 'host_shared_specs') | |
describe 'POST SSMJ1 to /client/x/hosts', :type => 'service' do | |
request { |attributes| | |
post_ssmj1(hosts_by_client_url(attributes[:client] || Client::API), | |
host_ssmj1_json(attributes)) | |
} | |
should_be_created | |
should_require_pairs :name | |
should_ignore_pairs :href, :id, :_type, | |
:client_href, | |
:metrics_href | |
should_validate_pairs :name, | |
:valid => ['test', 'Test host', 'test.host'], | |
:invalid => ["t" * 65] | |
should_validate_pairs :comments, | |
:valid => ["Anything, really..."], | |
:invalid => ['t' * 1025] | |
should_allow_pairs :hostname => 'test.host', | |
:active? => false, | |
:comments => "Some comments about this host", | |
:tags => ['test', 'spec', 'etc...'] | |
should_require_privilege :view_client, :create_host | |
end |
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
require File.join(File.dirname(__FILE__), 'host_shared_specs') | |
describe 'GET SSmJ1 from /hosts/x', :type => 'service' do | |
subject { |attributes| | |
@host = Host.create({:hostname => 'test show', | |
:client => Client::API}.merge(attributes)) | |
} | |
request { |attributes| | |
get_ssmj1(host_url(subject(attributes))) | |
} | |
should_be_a_ssmj1_object_document | |
should_have_pairs {{ | |
:name => subject.hostname, | |
:tags => subject.tags, | |
:active? => subject.active?, | |
:client_href => client_url(subject.client), | |
:metrics_href => metrics_by_host_url(subject), | |
:created_at => subject.created_at.iso8601, | |
:updated_at => subject.updated_at.iso8601 | |
}} | |
should_require_privilege :view_host | |
should_specify_caching :max_age => 5.minutes, | |
:last_modified_field => :created_at | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment