X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddd5b4cf19a92582fd114914be5bd5a04d3522a7..3f607d565bc0e2c7b1b738301c11c16d069913d5:/vendor/gems/rspec-1.1.2/spec/spec/matchers/has_spec.rb?ds=sidebyside diff --git a/vendor/gems/rspec-1.1.2/spec/spec/matchers/has_spec.rb b/vendor/gems/rspec-1.1.2/spec/spec/matchers/has_spec.rb new file mode 100644 index 000000000..47f048ebf --- /dev/null +++ b/vendor/gems/rspec-1.1.2/spec/spec/matchers/has_spec.rb @@ -0,0 +1,37 @@ +require File.dirname(__FILE__) + '/../../spec_helper.rb' + +describe "should have_sym(*args)" do + it "should pass if #has_sym?(*args) returns true" do + {:a => "A"}.should have_key(:a) + end + + it "should fail if #has_sym?(*args) returns false" do + lambda { + {:b => "B"}.should have_key(:a) + }.should fail_with("expected #has_key?(:a) to return true, got false") + end + + it "should fail if target does not respond to #has_sym?" do + lambda { + Object.new.should have_key(:a) + }.should raise_error(NoMethodError) + end +end + +describe "should_not have_sym(*args)" do + it "should pass if #has_sym?(*args) returns false" do + {:a => "A"}.should_not have_key(:b) + end + + it "should fail if #has_sym?(*args) returns true" do + lambda { + {:a => "A"}.should_not have_key(:a) + }.should fail_with("expected #has_key?(:a) to return false, got true") + end + + it "should fail if target does not respond to #has_sym?" do + lambda { + Object.new.should have_key(:a) + }.should raise_error(NoMethodError) + end +end