Commit 14821f68 authored by Will Pragnell's avatar Will Pragnell

Improved Plist Acknowledgements unit testing some more

parent 73f7f8c8
...@@ -2,15 +2,11 @@ require File.expand_path("../../../../spec_helper", __FILE__) ...@@ -2,15 +2,11 @@ require File.expand_path("../../../../spec_helper", __FILE__)
describe Pod::Generator::Plist do describe Pod::Generator::Plist do
before do before do
@podfile = Pod::Podfile.new do
platform :ios
xcodeproj "dummy"
end
@target_definition = @podfile.target_definitions[:default]
@sandbox = temporary_sandbox @sandbox = temporary_sandbox
@pods = [Pod::LocalPod.new(fixture_spec("banana-lib/BananaLib.podspec"), @sandbox, Pod::Platform.ios)] @target_definition = mock()
copy_fixture_to_pod("banana-lib", @pods[0]) @pods = [mock()]
@pods[0].expects(:license_text).returns("LICENSE_TEXT").at_least_once
@pods[0].expects(:name).returns("POD_NAME").at_least_once
@plist = Pod::Generator::Plist.new(@target_definition, @pods) @plist = Pod::Generator::Plist.new(@target_definition, @pods)
end end
...@@ -18,15 +14,21 @@ describe Pod::Generator::Plist do ...@@ -18,15 +14,21 @@ describe Pod::Generator::Plist do
@plist.licenses.count.should == 3 @plist.licenses.count.should == 3
end end
# TODO Test with a pod that has no licence
it "returns a correctly formed license hash for each pod" do it "returns a correctly formed license hash for each pod" do
@plist.hash_for_pod(@pods[0]).should == { @plist.hash_for_pod(@pods[0]).should == {
:Type => "PSGroupSpecifier", :Type => "PSGroupSpecifier",
:Title => "BananaLib", :Title => "POD_NAME",
:FooterText => "Permission is hereby granted ..." :FooterText => "LICENSE_TEXT"
} }
end end
it "returns nil for a pod with no license text" do
@pods[0].unstub(:license_text)
@pods[0].unstub(:name)
@pods[0].expects(:license_text).returns(nil)
@plist.hash_for_pod(@pods[0]).should.be.nil
end
it "returns a plist containg the licenses" do it "returns a plist containg the licenses" do
@plist.plist.should == { @plist.plist.should == {
:Title => "Acknowledgements", :Title => "Acknowledgements",
...@@ -36,7 +38,7 @@ describe Pod::Generator::Plist do ...@@ -36,7 +38,7 @@ describe Pod::Generator::Plist do
end end
it "writes a plist to disk at the given path" do it "writes a plist to disk at the given path" do
path = @sandbox.root + "#{@target_definition.label}-Acknowledgements.plist" path = @sandbox.root + "Pods-Acknowledgements.plist"
Xcodeproj.expects(:write_plist).with(equals(@plist.plist), equals(path)) Xcodeproj.expects(:write_plist).with(equals(@plist.plist), equals(path))
@plist.save_as(path) @plist.save_as(path)
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment