Sha256: 4bf31aecc39178c52a34dc8922e078dc638449bb77b135d02783c119c4aa15e3
Contents?: true
Size: 1.36 KB
Versions: 5
Compression:
Stored size: 1.36 KB
Contents
shared_examples_for :json_response do before (:each) do @ret = JSON.parse(last_response.body) end subject { @ret } it { should be_a_kind_of Hash } it { should have_key "result" } it { should have_key "object" } let (:obj) { subject["object"] } context :object do # subject { obj } it { obj.should be_a_kind_of Array } it { obj.each { |x| x.should be_a_kind_of Hash } } context :data_keys do it do obj.each do |x| x.should have_key "data" x.should have_key "result" x.should have_key "messages" [true, false].should include x["result"] end end end end end shared_examples_for :json_success_response do before (:each) do @ret = JSON.parse(last_response.body) end subject { @ret } end shared_examples_for :write_to_nagios_cmd_file do before (:all) do File.delete $nagios[:commands].path rescue nil end let (:cmd) { $nagios[:commands].path } it "writes to nagios.cmd file" do File.should exist(cmd) File.read(cmd).should =~ /^\[\d+\] PROCESS_(SERVICE|HOST)_CHECK_RESULT;#{host}/ end after (:each) do File.delete $nagios[:commands].path rescue nil end end shared_examples_for :put_status do it_should_behave_like :json_response it_should_behave_like :write_to_nagios_cmd_file end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
nagira-0.3.3 | spec/put/support.rb |
nagira-0.3.2 | spec/put/support.rb |
nagira-0.3.1 | spec/put/support.rb |
nagira-0.3.0 | spec/put/support.rb |
nagira-0.2.12 | spec/put/support.rb |