Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Raise an ArgumentError if given a non-schema input

Change-Id: Ifbf0f30ba4254a20af77b03ae06ec4d22ba46716
  • Loading branch information...
commit a284ea799e4b7336414667e6663e66b9c9be7834 1 parent 82c5231
mpage authored
Showing with 8 additions and 1 deletion.
  1. +3 −1 lib/membrane/schema_parser.rb
  2. +5 −0 spec/schema_parser_spec.rb
View
4 lib/membrane/schema_parser.rb
@@ -81,7 +81,9 @@ def deparse(schema)
schema.inspect
end
else
- schema.inspect
+ emsg = "Expected instance of Membrane::Schema::Base, given instance of" \
+ + " #{schema.class}"
+ raise ArgumentError.new(emsg)
end
end
View
5 spec/schema_parser_spec.rb
@@ -99,6 +99,11 @@
parser.deparse(enum_schema).should == 'tuple(String, Integer, "test")'
end
+ it "should raise an error if given a non-schema" do
+ expect do
+ parser.deparse({})
+ end.to raise_error(ArgumentError, /Expected instance/)
+ end
end
describe "#parse" do
Please sign in to comment.
Something went wrong with that request. Please try again.