1 require File.dirname(__FILE__) + '/../../spec_helper'
5 describe Description, " constructed with a single String" do
6 before(:each) {@description = Description.new("abc")}
8 it "should provide that string as its name" do
9 @description.description.should == "abc"
11 it "should provide nil as its type" do
12 @description.described_type.should be_nil
14 it "should respond to []" do
15 @description[:key].should be_nil
17 it "should respond to []=" do
18 @description[:key] = :value
19 @description[:key].should == :value
21 it "should return for == when value matches description" do
22 @description.should == "abc"
24 it "should return for == when value is other description that matches description" do
25 @description.should == Description.new("abc")
29 describe Description, " constructed with a Type" do
30 before(:each) {@description = Description.new(Behaviour)}
32 it "should provide a String representation of that type (fully qualified) as its name" do
33 @description.description.should == "Spec::DSL::Behaviour"
35 it "should provide that type (fully qualified) as its type" do
36 @description.described_type.should == Spec::DSL::Behaviour
40 describe Description, " constructed with a Type and a String" do
41 before(:each) {@description = Description.new(Behaviour, " behaving")}
43 it "should include the type and second String in its name" do
44 @description.description.should == "Spec::DSL::Behaviour behaving"
46 it "should provide that type (fully qualified) as its type" do
47 @description.described_type.should == Spec::DSL::Behaviour
51 describe Description, "constructed with a Type and a String not starting with a space" do
52 before(:each) {@description = Description.new(Behaviour, "behaving")}
54 it "should include the type and second String with a space in its name" do
55 @description.description.should == "Spec::DSL::Behaviour behaving"
59 describe Description, "constructed with a Type and a String starting with a ." do
60 before(:each) {@description = Description.new(Behaviour, ".behaving")}
62 it "should include the type and second String with a space in its name" do
63 @description.description.should == "Spec::DSL::Behaviour.behaving"
67 describe Description, "constructed with a Type and a String starting with a #" do
68 before(:each) {@description = Description.new(Behaviour, "#behaving")}
70 it "should include the type and second String with a space in its name" do
71 @description.description.should == "Spec::DSL::Behaviour#behaving"
75 describe Description, " constructed with options" do before(:each) {@description = Description.new(Behaviour, :a => "b")}
76 it "should provide its options" do
77 @description[:a].should == "b"