sock.rb:
class Sock
attr_accessor :colors
def initialize
@colors = [:teal, :olive, :green, :blue, :purple]
end
def machine_washable?
true
end
end
sock_spec.rb:
require "sock"
describe "Socks that Kevin would like" do
before :each do
@sock = Sock.new
end
it "should not have pink in it" do
@sock.colors.include?(:pink).should_not == true
end
it "should not have purple in it" do
@sock.colors.include?(:purple).should_not == true
end
it "should be machine washable" do
@sock.should be_machine_washable
end
it "should not have grey in it" do
@sock.colors.include?(:grey).should_not == true
end
it "should have multiple colors" do
@sock.colors.length.should > 1
end
end
No comments:
Post a Comment