james-ruminant 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README +1 -1
- data/lib/design.rb +29 -1
- data/spec/design_spec.rb +55 -0
- data/spec/product_spec.rb +4 -0
- metadata +2 -2
data/README
CHANGED
data/lib/design.rb
CHANGED
@@ -47,7 +47,7 @@ module Moo
|
|
47
47
|
}
|
48
48
|
if !product_type.eql?("sticker")
|
49
49
|
xml.text_collection {
|
50
|
-
xml.tag!
|
50
|
+
xml.tag!(product_type) {
|
51
51
|
lines.each_with_index do |line, index|
|
52
52
|
xml.text_line {
|
53
53
|
xml.id index+1
|
@@ -80,6 +80,34 @@ module Moo
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
class Postcard < Design
|
84
|
+
disable_attributes [:font_size, :italic]
|
85
|
+
|
86
|
+
def product_type
|
87
|
+
"postcard"
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
class Notecard < Design
|
93
|
+
disable_attributes [:font_size, :italic]
|
94
|
+
|
95
|
+
def product_type
|
96
|
+
"notecard"
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
class Greetingcard < Design
|
102
|
+
disable_attributes [:font_size, :italic]
|
103
|
+
|
104
|
+
def product_type
|
105
|
+
"greetingcard"
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
|
83
111
|
class Sticker < Design
|
84
112
|
|
85
113
|
disable_attributes [:font, :font_size, :colour, :align, :bold, :string, :italic]
|
data/spec/design_spec.rb
CHANGED
@@ -62,4 +62,59 @@ describe "a sticker" do
|
|
62
62
|
it "should not support lines" do
|
63
63
|
lambda{@design.line(1)}.should raise_error(NoMethodError)
|
64
64
|
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "a postcard" do
|
68
|
+
before(:each) do
|
69
|
+
@design = Moo::Postcard.new(:url => "")
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should have postcard as the type" do
|
73
|
+
@design.product_type.should == "postcard"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should not support size" do
|
77
|
+
lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should not support italic" do
|
81
|
+
lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe "a notecard" do
|
86
|
+
before(:each) do
|
87
|
+
@design = Moo::Notecard.new(:url => "")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should have notecard as the type" do
|
91
|
+
@design.product_type.should == "notecard"
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should not support size" do
|
95
|
+
lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should not support italic" do
|
99
|
+
lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "a greetingcard" do
|
104
|
+
|
105
|
+
before(:each) do
|
106
|
+
@design = Moo::Greetingcard.new(:url => "")
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should have greetingcard as the type" do
|
110
|
+
@design.product_type.should == "greetingcard"
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should not support size" do
|
114
|
+
lambda{@design.font_size = 0.5}.should raise_error(Moo::DisabledAttributeError)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should not support italic" do
|
118
|
+
lambda{@design.italic = true}.should raise_error(Moo::DisabledAttributeError)
|
119
|
+
end
|
65
120
|
end
|
data/spec/product_spec.rb
CHANGED
@@ -30,6 +30,10 @@ describe "The Design base class" do
|
|
30
30
|
it "should have a text_collection element when converted to xml" do
|
31
31
|
@design.to_xml.should include("<text_collection>")
|
32
32
|
end
|
33
|
+
|
34
|
+
it "should have a text_line element when converted to xml" do
|
35
|
+
@design.to_xml.should include("<text_line>")
|
36
|
+
end
|
33
37
|
end
|
34
38
|
|
35
39
|
describe "The Sticker subclass" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: james-ruminant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Darling
|
@@ -46,7 +46,7 @@ files:
|
|
46
46
|
- lib/core_ext/options_struct.rb
|
47
47
|
- README
|
48
48
|
has_rdoc: false
|
49
|
-
homepage: http://github.com/
|
49
|
+
homepage: http://github.com/james/ruminant/tree/master
|
50
50
|
post_install_message:
|
51
51
|
rdoc_options: []
|
52
52
|
|