diff --git a/spec/config_spec.rb b/spec/config_spec.rb index dc50551..5faed56 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -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 @@ -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 diff --git a/spec/fixtures/config_versions.xml b/spec/fixtures/config_versions.xml new file mode 100644 index 0000000..f3e774e --- /dev/null +++ b/spec/fixtures/config_versions.xml @@ -0,0 +1,61 @@ + + + + Confetti Sample App + + + This is a sample config.xml for integration testing with Confetti + + + 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 "Software"), 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 "AS IS", 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. + + + Andrew Lunny + + + + + + + + + + + + + + + + + + + + + diff --git a/spec/templates/android_manifest_spec.rb b/spec/templates/android_manifest_spec.rb index 5aab6d5..decc554 100644 --- a/spec/templates/android_manifest_spec.rb +++ b/spec/templates/android_manifest_spec.rb @@ -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 @@ -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 diff --git a/spec/templates/ios_info_spec.rb b/spec/templates/ios_info_spec.rb index 8412c25..612ec4b 100644 --- a/spec/templates/ios_info_spec.rb +++ b/spec/templates/ios_info_spec.rb @@ -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 diff --git a/spec/templates/windows_phone8_manifest_spec.rb b/spec/templates/windows_phone8_manifest_spec.rb index 2d62030..caa3f63 100644 --- a/spec/templates/windows_phone8_manifest_spec.rb +++ b/spec/templates/windows_phone8_manifest_spec.rb @@ -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"