public
Fork of james/ruminant
Description: A ruby library to regurgitate MOO products
Homepage:
Clone URL: git://github.com/infovore/ruminant.git
ruminant / spec / design_spec.rb
100644 120 lines (92 sloc) 3.249 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
require File.join(File.dirname(__FILE__), *%w[spec_helper])
 
describe "a minicard" do
  before :each do
    @design = Moo::MiniCard.new(:url => "http://farm3.static.flickr.com/2300/2179038972_23d2a1ff40_o.jpg")
  end
  
  it "should have minicard as the type" do
    @design.product_type.should == "minicard"
  end
  
  it "should not support size" do
    lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support italic" do
    lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
  end
end
 
describe "a sticker" do
  before(:each) do
    @design = Moo::Sticker.new(:url => "")
  end
  
  it "should have sticker as the type" do
    @design.product_type.should == "sticker"
  end
  
  it "should not support font size" do
    lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support italic" do
    lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support string" do
    lambda{@design.string = "foo"}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support bold" do
    lambda{@design.bold = true}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support align" do
    lambda{@design.align = "centre"}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support font" do
    lambda{@design.font = "Normal"}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support colour" do
    lambda{@design.colour = "#ccc"}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support any text" do
    lambda{@design.text = "testing!"}.should raise_error(NoMethodError)
  end
  
  it "should not support lines" do
    lambda{@design.line(1)}.should raise_error(NoMethodError)
  end
end
 
describe "a postcard" do
  before(:each) do
    @design = Moo::Postcard.new(:url => "")
  end
  
  it "should have postcard as the type" do
    @design.product_type.should == "postcard"
  end
  
  it "should not support size" do
    lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support italic" do
    lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
  end
end
 
describe "a notecard" do
  before(:each) do
    @design = Moo::Notecard.new(:url => "")
  end
  
  it "should have notecard as the type" do
    @design.product_type.should == "notecard"
  end
  
  it "should not support size" do
    lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
  end
  
  it "should not support italic" do
    lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
  end
end
 
describe "a greetingcard" do
 
  before(:each) do
    @design = Moo::Greetingcard.new(:url => "")
  end
 
  it "should have greetingcard as the type" do
    @design.product_type.should == "greetingcard"
  end
 
  it "should not support size" do
    lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
  end
 
  it "should not support italic" do
    lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
  end
end