Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foobar(options)
- if !options.is_a?(Hash) || options[:pdf].nil?
- return "fail"
- else
- return "pass"
- end
- end
- describe "testing options" do
- it "should fail with nil" do
- a = foobar(nil)
- a.should == "fail"
- end
- it "should fail with hash" do
- a = foobar({})
- a.should == "fail"
- end
- it "should fail with nil key" do
- a = foobar({:pdf => nil})
- a.should == "fail"
- end
- it "should pass with not-nil key" do
- a = foobar({:pdf => "not-nil"})
- a.should == "pass"
- end
- end
Add Comment
Please, Sign In to add comment