Skip to content

Commit

Permalink
spec fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
goya committed Jan 5, 2016
1 parent 8ab567a commit 77624e0
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,24 @@
it "should set the license to the empty string" do
@config.license.text.should == ""
end
end

describe "uses version overrides" do
before do
@config.populate_from_xml(fixture_dir + "/config_versions.xml")
end

it "should populate the app's android_versioncode when present" do
@config.android_versioncode.should == "5"
end

it "should populate the app's ios_cfbundleversion when present" do
@config.ios_cfbundleversion.should == "10"
end

it "should populate the app's windows_package_version when present" do
@config.windows_package_version.should == "15"
end

end

Expand Down Expand Up @@ -496,7 +514,7 @@

it "should set the source properties correctly" do
@child.source.should == "internal"
@push.source.should be_nil
@push.source.should == "pgb"
@fbconnect.source.should == "external"
end

Expand Down
61 changes: 61 additions & 0 deletions spec/fixtures/config_versions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
id = "com.alunny.confetti"
version = "1.0.0"
android-versionCode = "5"
ios-CFBundleVersion = "10"
windows-packageVersion = "15">

<name>Confetti Sample App</name>

<description>
This is a sample config.xml for integration testing with Confetti
</description>

<license href="http://www.opensource.org/licenses/mit-license.php">The MIT License

Copyright (c) 2011 Andrew Lunny

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the &quot;Software&quot;), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</license>

<author href="http://alunny.github.com"
email="[email protected]">
Andrew Lunny
</author>

<icon src="icon.png" height="150" width="200" />

<gap:splash src="mainsplash.png" height="480" width="360" />

<preference name="universal" value="true"/>
<preference name="phonegap-version" value="1.3.0"/>

<feature name="http://api.phonegap.com/1.0/geolocation" required="true"/>
<feature name="http://api.phonegap.com/1.0/camera" required="true"/>
<feature name="http://api.phonegap.com/1.0/notification" required="true"/>

<gap:platform name="ios" />
<gap:platform name="webos" />
<gap:platform name="android" />

<content src="not_index.html" />

<access origin="*" />
</widget>
11 changes: 11 additions & 0 deletions spec/templates/android_manifest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
@template.version.should == "0.0.1"
end

it "should use the default version code" do
@template.version_code.should == "1"
end

it "should render the correct AndroidManifest" do
@template.render.should == File.read("#{ fixture_dir }/android/android_manifest_spec.xml")
end
Expand Down Expand Up @@ -339,5 +343,12 @@
@config.version_code = "2.0.0"
@template.version_code.should == "2"
end

it "should allow override with android_versioncode" do
@config.version_code = "3"
@config.android_versioncode = "2"
@template.version_code.should == "2"
end

end
end
9 changes: 9 additions & 0 deletions spec/templates/ios_info_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@
@template.bundle_version.should == "1.0.0"
end

it "should allow override with ios_cfbundleversion" do
@config.ios_cfbundleversion = "2.0.0"
@template.bundle_version.should == "2.0.0"
end

it "should set bundle_version correctly" do
@template.short_bundle_version.should == "1.0.0"
end

it "should render the correct Info.plist" do
@template.render.should == File.read("#{ fixture_dir }/ios/ios_info_spec.plist")
end
Expand Down
5 changes: 5 additions & 0 deletions spec/templates/windows_phone8_manifest_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,11 @@
@template.version.should == "1.0.0.0"
end

it "should allow override with windows_package_version" do
@config.windows_package_version = "12"
@template.version.should == "12.0.0.0"
end

it "should ensure the non-initial numbers are one digit" do
# THIS IS STUPID
@config.version_string = "2012.05.20"
Expand Down

0 comments on commit 77624e0

Please sign in to comment.