confetti 0.1.6 → 0.1.7

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.
@@ -65,5 +65,9 @@ module Confetti
65
65
  def icon
66
66
  @icon_set.first
67
67
  end
68
+
69
+ def biggest_icon
70
+ @icon_set.max { |a,b| a.width.to_i <=> b.width.to_i }
71
+ end
68
72
  end
69
73
  end
@@ -1,3 +1,3 @@
1
1
  module Confetti
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -221,6 +221,17 @@ describe Confetti::Config do
221
221
  it "should set the icon's width correctly" do
222
222
  @config.icon_set.first.width.should == "200"
223
223
  end
224
+
225
+ describe "with multiple icons" do
226
+ before do
227
+ @config = Confetti::Config.new
228
+ @config.populate_from_xml(fixture_dir + "/config-icons.xml")
229
+ end
230
+
231
+ it "should populate all of the icon_set" do
232
+ @config.icon_set.size.should be 2
233
+ end
234
+ end
224
235
  end
225
236
  end
226
237
  end
@@ -239,19 +250,43 @@ describe Confetti::Config do
239
250
  it_should_have_generate_and_write_methods_for :blackberry_widgets_config
240
251
  end
241
252
 
242
- describe "#icon helper" do
243
- it "should return nil if no icon has been set" do
244
- @config.icon.should be_nil
253
+ describe "icon helpers" do
254
+ describe "if no icon has been set" do
255
+ it "#icon should return nil" do
256
+ @config.icon.should be_nil
257
+ end
258
+
259
+ it "#biggest_icon should return nil" do
260
+ @config.biggest_icon.should be_nil
261
+ end
245
262
  end
246
263
 
247
- describe "when populated correctly" do
264
+ describe "with a single icon" do
248
265
  before do
249
266
  @config = Confetti::Config.new(fixture_dir + "/config.xml")
250
267
  end
251
268
 
252
- it "should return an icon" do
269
+ it "#icon should return an icon" do
253
270
  @config.icon.should be_a Confetti::Config::Icon
254
271
  end
272
+
273
+ it "#biggest_icon should return an icon" do
274
+ @config.biggest_icon.should be_a Confetti::Config::Icon
275
+ end
276
+ end
277
+
278
+ describe "with multiple icons" do
279
+ before do
280
+ @config.populate_from_xml(fixture_dir + "/config-icons.xml")
281
+ end
282
+
283
+ it "#icon should return a single icon" do
284
+ @config.icon.should be_a Confetti::Config::Icon
285
+ end
286
+
287
+ it "#biggest_icon should return the bigger of the two" do
288
+ @config.biggest_icon.src.should == "bigicon.png"
289
+ end
255
290
  end
256
291
  end
257
292
  end
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <widget xmlns = "http://www.w3.org/ns/widgets"
3
+ id = "com.alunny.confetti"
4
+ version = "1.0.0">
5
+
6
+ <name>Confetti Sample App</name>
7
+
8
+ <description>
9
+ This is a sample config.xml for integration testing with Confetti
10
+ </description>
11
+
12
+ <author href="http://alunny.github.com"
13
+ email="alunny@gmail.com">
14
+ Andrew Lunny
15
+ </author>
16
+
17
+ <icon src="smallicon.png" height="100" width="100" />
18
+ <icon src="bigicon.png" height="200" width="200" />
19
+
20
+ <feature name="http://api.phonegap.com/1.0/geolocation"/>
21
+ <feature name="http://api.phonegap.com/1.0/network"/>
22
+ </widget>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confetti
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Lunny
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-03 00:00:00 -08:00
18
+ date: 2011-03-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -159,6 +159,7 @@ files:
159
159
  - spec/fixtures/bad_config.xml
160
160
  - spec/fixtures/blackberry_widget_config_expected.xml
161
161
  - spec/fixtures/blackberry_widget_config_spec.xml
162
+ - spec/fixtures/config-icons.xml
162
163
  - spec/fixtures/config.xml
163
164
  - spec/fixtures/ios_info_expected.plist
164
165
  - spec/fixtures/ios_info_spec.plist
@@ -237,6 +238,7 @@ test_files:
237
238
  - spec/fixtures/bad_config.xml
238
239
  - spec/fixtures/blackberry_widget_config_expected.xml
239
240
  - spec/fixtures/blackberry_widget_config_spec.xml
241
+ - spec/fixtures/config-icons.xml
240
242
  - spec/fixtures/config.xml
241
243
  - spec/fixtures/ios_info_expected.plist
242
244
  - spec/fixtures/ios_info_spec.plist