confetti 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/confetti/config.rb +6 -1
- data/lib/confetti/version.rb +1 -1
- data/spec/config_spec.rb +6 -0
- data/spec/fixtures/bad_config.xml +21 -0
- metadata +6 -4
data/Gemfile.lock
CHANGED
data/lib/confetti/config.rb
CHANGED
@@ -35,7 +35,12 @@ module Confetti
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def populate_from_xml(xml_file)
|
38
|
-
|
38
|
+
begin
|
39
|
+
config_doc = REXML::Document.new(File.read(xml_file)).root
|
40
|
+
rescue REXML::ParseException
|
41
|
+
raise ArgumentError, "malformed config.xml"
|
42
|
+
end
|
43
|
+
|
39
44
|
fail "no doc parsed" unless config_doc
|
40
45
|
|
41
46
|
@package = config_doc.attributes["id"]
|
data/lib/confetti/version.rb
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -163,6 +163,12 @@ describe Confetti::Config do
|
|
163
163
|
}.should raise_error
|
164
164
|
end
|
165
165
|
|
166
|
+
it "should raise an error with malformed xml" do
|
167
|
+
lambda {
|
168
|
+
@config.populate_from_xml("#{ fixture_dir }/bad_config.xml")
|
169
|
+
}.should raise_error ArgumentError
|
170
|
+
end
|
171
|
+
|
166
172
|
describe "when setting attributes from config.xml" do
|
167
173
|
before do
|
168
174
|
@config.populate_from_xml(fixture_dir + "/config.xml")
|
@@ -0,0 +1,21 @@
|
|
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="icon.png" height="150" width="200" />
|
18
|
+
|
19
|
+
<feature name="http://api.phonegap.com/1.0/geolocation"/>
|
20
|
+
<feature name="http://api.phonegap.com/1.0/network"/>
|
21
|
+
</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:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
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-
|
18
|
+
date: 2011-03-03 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- spec/fixtures/android_strings_expected.xml
|
157
157
|
- spec/fixtures/android_strings_spec.xml
|
158
158
|
- spec/fixtures/appinfo_expected.json
|
159
|
+
- spec/fixtures/bad_config.xml
|
159
160
|
- spec/fixtures/blackberry_widget_config_expected.xml
|
160
161
|
- spec/fixtures/blackberry_widget_config_spec.xml
|
161
162
|
- spec/fixtures/config.xml
|
@@ -233,6 +234,7 @@ test_files:
|
|
233
234
|
- spec/fixtures/android_strings_expected.xml
|
234
235
|
- spec/fixtures/android_strings_spec.xml
|
235
236
|
- spec/fixtures/appinfo_expected.json
|
237
|
+
- spec/fixtures/bad_config.xml
|
236
238
|
- spec/fixtures/blackberry_widget_config_expected.xml
|
237
239
|
- spec/fixtures/blackberry_widget_config_spec.xml
|
238
240
|
- spec/fixtures/config.xml
|