Commit c9092041 authored by Marius Rackwitz's avatar Marius Rackwitz

[Spec Command::Update] Reuse Podfile setup

parent 3f214a9b
...@@ -2,8 +2,6 @@ require File.expand_path('../../../spec_helper', __FILE__) ...@@ -2,8 +2,6 @@ require File.expand_path('../../../spec_helper', __FILE__)
module Pod module Pod
describe Command::Update do describe Command::Update do
extend SpecHelper::TemporaryRepos
it 'tells the user that no Podfile was found in the project dir' do it 'tells the user that no Podfile was found in the project dir' do
exception = lambda { run_command('update', '--no-repo-update') }.should.raise Informative exception = lambda { run_command('update', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile' found in the project directory." exception.message.should.include "No `Podfile' found in the project directory."
...@@ -23,19 +21,7 @@ module Pod ...@@ -23,19 +21,7 @@ module Pod
end end
end end
it 'tells the user that no Lockfile was found in the project dir' do describe 'with Podfile' do
file = temporary_directory + 'Podfile'
File.open(file, 'w') do |f|
f.puts('platform :ios')
f.puts('pod "Reachability"')
end
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', '--no-repo-update') }.should.raise Informative
exception.message.should.include "No `Podfile.lock' found in the project directory"
end
end
describe 'tells the user that the Pods cannot be updated unless they are installed' do
extend SpecHelper::TemporaryRepos extend SpecHelper::TemporaryRepos
before do before do
...@@ -44,32 +30,39 @@ module Pod ...@@ -44,32 +30,39 @@ module Pod
f.puts('platform :ios') f.puts('platform :ios')
f.puts('pod "BananaLib", "1.0"') f.puts('pod "BananaLib", "1.0"')
end end
end
podfile = Podfile.new do it 'tells the user that no Lockfile was found in the project dir' do
platform :ios exception = lambda { run_command('update', 'BananaLib', '--no-repo-update') }.should.raise Informative
pod 'BananaLib', '1.0' exception.message.should.include "No `Podfile.lock' found in the project directory"
end
specs = [
Specification.new do |s|
s.name = 'BananaLib'
s.version = '1.0'
end,
]
external_sources = {}
Lockfile.generate(podfile, specs, external_sources).write_to_disk(temporary_directory + 'Podfile.lock')
end end
it 'for a single missing Pod' do describe 'tells the user that the Pods cannot be updated unless they are installed' do
Dir.chdir(temporary_directory) do extend SpecHelper::TemporaryRepos
before do
podfile = Podfile.new do
platform :ios
pod 'BananaLib', '1.0'
end
specs = [
Specification.new do |s|
s.name = 'BananaLib'
s.version = '1.0'
end,
]
external_sources = {}
Lockfile.generate(podfile, specs, external_sources).write_to_disk(temporary_directory + 'Podfile.lock')
end
it 'for a single missing Pod' do
should.raise Informative do should.raise Informative do
run_command('update', 'Reachability', '--no-repo-update') run_command('update', 'Reachability', '--no-repo-update')
end.message.should.include 'The `Reachability` Pod is not ' \ end.message.should.include 'The `Reachability` Pod is not ' \
'installed and cannot be updated' 'installed and cannot be updated'
end end
end
it 'for multiple missing Pods' do it 'for multiple missing Pods' do
Dir.chdir(temporary_directory) do
exception = lambda { run_command('update', 'Reachability', 'BananaLib2', '--no-repo-update') }.should.raise Informative exception = lambda { run_command('update', 'Reachability', 'BananaLib2', '--no-repo-update') }.should.raise Informative
exception.message.should.include 'Pods `Reachability`, `BananaLib2` are not installed and cannot be updated' exception.message.should.include 'Pods `Reachability`, `BananaLib2` are not installed and cannot be updated'
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