Skip to content

Commit

Permalink
Changes how the sample file paths are handled
Browse files Browse the repository at this point in the history
  • Loading branch information
matiaskorhonen committed Mar 23, 2012
1 parent ce06de1 commit 9c629d5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions spec/monit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# -*- encoding: utf-8 -*-
require "spec_helper"

SMALLISH_STATUS_PATH = File.expand_path("../samples/smallish_status.xml", __FILE__)
LARGISH_STATUS_PATH = File.expand_path("../samples/largish_status.xml", __FILE__)

describe Monit do
context "Status" do
it "should be possible to instatiate it with no options" do
Expand Down Expand Up @@ -29,15 +32,15 @@

it "should parse XML into a Hash" do
status = Monit::Status.new
status.stub!(:xml).and_return(File.read("./spec/samples/smallish_status.xml"))
status.stub!(:xml).and_return(File.read(SMALLISH_STATUS_PATH))
status.parse(status.xml)
status.hash.should be_kind_of Hash
status.hash["monit"].should_not be_nil
status.hash["monit"]["server"].should_not be_nil
status.hash["monit"]["platform"].should_not be_nil
status.hash["monit"]["service"].should_not be_nil

status.stub!(:xml).and_return(File.read("./spec/samples/largish_status.xml"))
status.stub!(:xml).and_return(File.read(LARGISH_STATUS_PATH))
status.parse(status.xml)
status.hash.should be_kind_of Hash
status.hash["monit"].should_not be_nil
Expand All @@ -48,7 +51,7 @@

it "should parse XML into a Ruby representation" do
status = Monit::Status.new
status.stub!(:xml).and_return(File.read("./spec/samples/smallish_status.xml"))
status.stub!(:xml).and_return(File.read(SMALLISH_STATUS_PATH))
status.parse(status.xml)

status.server.should be_kind_of Monit::Server
Expand All @@ -58,7 +61,7 @@
status.services.first.should be_kind_of Monit::Service
status.services.first.should be_kind_of OpenStruct

status.stub!(:xml).and_return(File.read("./spec/samples/largish_status.xml"))
status.stub!(:xml).and_return(File.read(LARGISH_STATUS_PATH))
status.parse(status.xml)

status.server.should be_kind_of Monit::Server
Expand Down

0 comments on commit 9c629d5

Please sign in to comment.