Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expanded the Eye.seen? spec to consider all types.

  • Loading branch information...
commit 7d2aa36258448741e8fe395e19e99da6d9248058 1 parent e7e63a5
@runpaint authored
Showing with 16 additions and 10 deletions.
  1. +16 −10 spec/eye/seen_spec.rb
View
26 spec/eye/seen_spec.rb
@@ -1,29 +1,36 @@
describe "Eye.seen?" do
before(:each) do
- @eye = Eye.new
+ @eyes = [:array, :hash, :bloom_filter].map{|t| Eye.new(:type => t)}
end
it "is a method" do
- @eye.should.respond_to? :seen?
+ @eyes.each do |eye|
+ eye.should.respond_to? :seen?
+ end
end
it "takes a single argument" do
- lambda{@eye.seen?("string")}.should_not raise_error
+ @eyes.each do |eye|
+ lambda{eye.seen?("string")}.should_not raise_error
+ end
end
it "raises an ArgumentError if called without arguments" do
- lambda{@eye.seen?}.should raise_error(ArgumentError)
+ @eyes.each do |eye|
+ lambda{eye.seen?}.should raise_error(ArgumentError)
+ end
end
it "raises an ArgumentError if called with more than one argument" do
- lambda{@eye.seen?(1,2)}.should raise_error(ArgumentError)
- lambda{@eye.seen?("string",['glark'],"bar")}.should raise_error(ArgumentError)
+ @eyes.each do |eye|
+ lambda{eye.seen?(1,2)}.should raise_error(ArgumentError)
+ lambda{eye.seen?("str",['g'],"bar")}.should raise_error(ArgumentError)
+ end
end
it "returns true if .see(obj) has been called previously" do
- [:array, :hash, :bloom_filter].each do |type|
- eye = Eye.new(:type => type)
+ @eyes.each do |eye|
['Kim', 'http://example.com/'].each do |obj|
eye.see obj
eye.seen?(obj).should == true
@@ -33,8 +40,7 @@
end
it "returns false unless .see(obj) has been called previously" do
- [:array, :hash, :bloom_filter].each do |type|
- eye = Eye.new(:type => type)
+ @eyes.each do |eye|
['The Tao of Pooh', 29, 30.3].each do |obj|
eye.seen?(obj).should == false
end
Please sign in to comment.
Something went wrong with that request. Please try again.