Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rspec"
- require "color"
- describe Color do
- it "should stand alone" do
- r = Color.new("red")
- r.color.should == "red"
- r.next.should == nil
- r.previous.should == nil
- end
- it "should link between two colors" do
- r = Color.new("red")
- o = Color.new("orange")
- r.link_to(o)
- r.next.should == o
- r.previous.should == nil
- o.previous.should == r
- o.next.should == nil
- end
- it "should link a whole rainbow" do
- r = Color.new("red")
- o = Color.new("orange")
- y = Color.new("yellow")
- g = Color.new("green")
- b = Color.new("blue")
- i = Color.new("indigo")
- v = Color.new("violet")
- r.link_to(o).link_to(y).link_to(g).link_to(b).link_to(i).link_to(v)
- r.next.next.next.next.next.next.color.should match /violet/
- v.previous.previous.previous.previous.previous.previous.color.should match /red/
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement