Skip to content

Commit badff6f

Browse files
committed
Fixed a silly typo in the ObjectMask parser that was causing a crash and added test cases to cover it. Added the coveralls 'coverage' directory to gitignore
1 parent d554fa5 commit badff6f

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
log/
66
internal_examples/
77
doc/
8+
coverage/
89
Gemfile.lock

lib/softlayer/ObjectMaskParser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def parse(mask_string)
5858

5959
recognize_token(@tokenizer, :eos, "Extraneous text after object mask: ")
6060

61-
if property && (property.name != "mask" && propertyName != "filterMask")
61+
if property && (property.name != "mask" && property.name != "filterMask")
6262
raise ObjectMaskParserError, "Object Mask must begin with a 'mask' or 'filterMask' root property"
6363
end
6464

spec/ObjectMaskParser_spec.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,27 @@
5454
expect { result = subject.parse("mask[two,children], bob") }.to raise_error
5555
end
5656

57+
it "should parse a mask with fiterMask" do
58+
result = nil
59+
expect { result = subject.parse("filterMask.simple1") }.to_not raise_error
60+
61+
expect(result.name).to eq 'filterMask'
62+
expect(result.children[0].name).to eq 'simple1'
63+
end
64+
65+
it "should parse a mask set with fiterMask" do
66+
result = nil
67+
expect { result = subject.parse("[filterMask.simple1, filterMask.simple2]") }.to_not raise_error
68+
69+
expect(result.count).to eq 2
70+
expect(result[0].name).to eq 'filterMask'
71+
expect(result[0].children.count).to eq 1
72+
expect(result[0].children[0].name).to eq "simple1"
73+
74+
expect(result[1].name).to eq 'filterMask'
75+
expect(result[1].children.count).to eq 1
76+
expect(result[1].children[0].name).to eq "simple2"
77+
end
5778
end
5879

5980
describe SoftLayer::ObjectMaskParser, "#parse_property_set" do

0 commit comments

Comments
 (0)