spec/check_spec.rb in cocoapods-check-0.1.1.beta.1 vs spec/check_spec.rb in cocoapods-check-0.2.1.beta.1
- old
+ new
@@ -64,24 +64,27 @@
it 'handles development pods with changes' do
check = Pod::Command::Check.new(CLAide::ARGV.new([]))
config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
- # Make an actual file because 'check' needs the modified time
+ # Make an actual lockfile file because 'check' needs the modified time
lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
# Ensure development pod modified time is after lockfile modified time
sleep(1)
# Create a temp dir with a temp file and run the check in that context
Dir.mktmpdir('dev-pod-test-dir') do |dir|
+
+ # Create a source file
source_file = Tempfile.new('some-pod-file', dir)
+ # Write a podspec file pointing at the source file
File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = '#{File.basename(source_file)}' end")
- puts(File.read("#{dir}/foo.podspec"))
+ # Do the check
development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
results = check.find_differences(config, development_pods)
expect(results).to eq([ '~pod_two' ])
end
@@ -92,21 +95,24 @@
config = create_config({ :pod_one => '1.0', :pod_two => '1.0' }, { :pod_one => '1.0', :pod_two => '1.0' })
# Create a temp dir with a temp file and run the check in that context
Dir.mktmpdir('dev-pod-test-dir') do |dir|
+
+ # Create a source file
Tempfile.new('some-pod-file', dir)
+ # Write a podspec file pointing at the source file
+ File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = 'ack' end")
+
# Ensure lockfile modified time is after development pod modified time
sleep(1)
- # Make an actual file because 'check' needs the modified time
+ # Make an actual lockfile file because 'check' needs the modified time
lockfile_path = Tempfile.new('dev-pod-test-lockfile').path
allow(config.lockfile).to receive(:defined_in_file).and_return(lockfile_path)
- puts("#{dir}/foo.podspec")
- File.write("#{dir}/foo.podspec", "Pod::Spec.new do |s| s.source_files = 'ack' end")
-
+ # Do the check
development_pods = { :pod_two => { :path => "#{dir}/foo.podspec" } }
results = check.find_differences(config, development_pods)
expect(results).to eq([])
end