Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
add a bit more coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
zsprackett committed Dec 14, 2013
1 parent 31d7d38 commit 989ec5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/cloudwatchtographite/exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class ArgumentTypeError < ArgumentError; end
# Raised when too many dimensions are specified
class TooManyDimensionError < Exception; end

# Raised when parsing fails
class ParseError < Exception; end

# Raised when an unknown protocol is used to try to send to graphite
class ProtocolError < Exception; end
end
3 changes: 3 additions & 0 deletions spec/metricdefinition_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
it "should be a MetricDefinition" do
@definition.should be_an_instance_of CloudwatchToGraphite::MetricDefinition
end
it "should require valid arguments" do
expect { CloudwatchToGraphite::MetricDefinition.create_and_fill({'namespace' => 'blah'}) }.to raise_error(CloudwatchToGraphite::ParseError)
end
end

describe ".new" do
Expand Down
10 changes: 10 additions & 0 deletions spec/metricdimension_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
end
end

describe ".create_and_fill" do
it "should return a MetricDimension" do
d= CloudwatchToGraphite::MetricDimension.create_and_fill({'name' => 'a', 'value' => 'b'})
d.should be_an_instance_of CloudwatchToGraphite::MetricDimension
end
it "should require valid arguments" do
expect { CloudwatchToGraphite::MetricDefinition.create_and_fill({'name' => 'blah'}) }.to raise_error(CloudwatchToGraphite::ParseError)
end
end

describe ".Name" do
it "returns the correct name" do
@dimension.Name.should eql 'testname'
Expand Down

0 comments on commit 989ec5f

Please sign in to comment.