spec/cmds/sub_spec.rb in cmds-0.0.6 vs spec/cmds/sub_spec.rb in cmds-0.0.7
- old
+ new
@@ -109,10 +109,14 @@
}
it "should omit the missing subs" do
expect(Cmds.sub tpl, [], x: "ex", z: "zee").to eq "blah ex zee"
end
+
+ it "should omit a sub if it's value is false" do
+ expect(Cmds.sub "%{x?}", [], x: false).to eq ""
+ end
end
context "errors" do
it "should raise TypeError if subs in not an array or a hash" do
expect{Cmds.sub "a <%= b %> <%= c %>", "dee!"}.to raise_error TypeError
@@ -154,6 +158,6 @@
expect(
Cmds.sub "./test/echo_cmd.rb %<key>s", [], key: "hello world!"
).to eq './test/echo_cmd.rb hello\ world\!'
end
end # shortcuts
-end # ::sub
\ No newline at end of file
+end # ::sub