spec/ragios-client_spec.rb in ragios-client-0.2.0 vs spec/ragios-client_spec.rb in ragios-client-0.2.1
- old
+ new
@@ -7,11 +7,11 @@
def generate_json(str)
JSON.generate(str)
end
admin = 'admin'
-password = 'ragios'
+password = 'trusted'
describe "Ragios Client" do
before(:each) do
#@ragios = Ragios::Client.new(username: admin, password: password)
@ragios = Ragios::Client.new
@@ -21,29 +21,29 @@
monitor = {
monitor: "Google",
url: "http://google.com",
every: "5m",
contact: "admin@mail.com",
- via: ["gmail_notifier","twitter_notifier"],
+ via: ["ses","log_notifier"],
plugin: plugin
}
@query_monitor_id = @ragios.create(monitor)[:_id]
end
describe "#events" do
it "returns all events by monitor" do
sleep 2
events = @ragios.events(@query_monitor_id, "1980","2040")
events.should_not == 0
- first_id = events.first[:monitor][:_id]
+ first_id = events.first[:monitor_id]
@query_monitor_id.should == first_id
@ragios.events(@query_monitor_id, "1980","2040", 1).count.should == 1
end
end
describe "#events_by_state" do
it "returns a monitor's events by specified state" do
sleep 1
- @ragios.events_by_state(@query_monitor_id, "passed", "1980","2040",1).count.should == 1
+ @ragios.events_by_state(@query_monitor_id, "create", "1980","2040",1).count.should == 1
end
end
describe "more events API" do
it "returns all events" do
event = @ragios.all_events(1).first
@@ -62,11 +62,11 @@
monitor = {
monitor: "Google",
url: "http://google.com",
every: "5m",
contact: "admin@mail.com",
- via: ["gmail_notifier","twitter_notifier"],
+ via: ["ses","log_notifier"],
plugin: plugin
}
returned_monitor = @ragios.create(monitor)
returned_monitor.should include(monitor)
@@ -80,11 +80,11 @@
monitor = {
monitor: "Google",
url: "http://google.com",
every: "5m",
contact: "admin@mail.com",
- via: "gmail_notifier"
+ via: "ses"
}
begin
@ragios.create monitor
rescue => e
e.should be_an_instance_of Ragios::ClientException
@@ -118,11 +118,11 @@
@monitor = {
monitor: @unique_name,
url: "http://google.com",
every: "5m",
contact: "admin@mail.com",
- via: ["gmail_notifier"],
+ via: ["ses"],
plugin: plugin,
tag: "test"
}
returned_monitor = @ragios.create(@monitor)
@@ -148,17 +148,17 @@
@ragios.where(options).should == []
end
end
describe "#update" do
it "should update a monitor" do
- update_options = {every: "10m", via: ["twitter_notifier"]}
+ update_options = {every: "10m", via: ["log_notifier"]}
@ragios.update(@monitor_id, update_options).should == {ok: true}
end
it "cannot update a monitor with bad data" do
expect { @ragios.update(@monitor_id,"bad data") }.to raise_error(Ragios::ClientException)
end
it "cannot update a monitor that don't exist" do
- update_options = {every: "5m", via: ["twitter_notifier"]}
+ update_options = {every: "5m", via: ["log_notifier"]}
expect { @ragios.update("dont_exist", update_options) }.to raise_error(Ragios::ClientException, generate_json(error: "No monitor found with id = dont_exist"))
end
end
describe "#test" do
it "tests a monitor" do