1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
3 describe "should have_sym(*args)" do
4 it "should pass if #has_sym?(*args) returns true" do
5 {:a => "A"}.should have_key(:a)
8 it "should fail if #has_sym?(*args) returns false" do
10 {:b => "B"}.should have_key(:a)
11 }.should fail_with("expected #has_key?(:a) to return true, got false")
14 it "should fail if target does not respond to #has_sym?" do
16 Object.new.should have_key(:a)
17 }.should raise_error(NoMethodError)
21 describe "should_not have_sym(*args)" do
22 it "should pass if #has_sym?(*args) returns false" do
23 {:a => "A"}.should_not have_key(:b)
26 it "should fail if #has_sym?(*args) returns true" do
28 {:a => "A"}.should_not have_key(:a)
29 }.should fail_with("expected #has_key?(:a) to return false, got true")
32 it "should fail if target does not respond to #has_sym?" do
34 Object.new.should have_key(:a)
35 }.should raise_error(NoMethodError)