Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
71983133
Commit
71983133
authored
Dec 18, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Specs] Clean up specs helpers.
parent
a6029d66
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
94 additions
and
176 deletions
+94
-176
install_spec.rb
spec/functional/command/install_spec.rb
+1
-1
list_spec.rb
spec/functional/command/list_spec.rb
+1
-1
outdated_spec.rb
spec/functional/command/outdated_spec.rb
+1
-1
push_spec.rb
spec/functional/command/push_spec.rb
+1
-1
repo_spec.rb
spec/functional/command/repo_spec.rb
+0
-1
search_spec.rb
spec/functional/command/search_spec.rb
+1
-1
setup_spec.rb
spec/functional/command/setup_spec.rb
+1
-1
spec_spec.rb
spec/functional/command/spec_spec.rb
+0
-5
update_spec.rb
spec/functional/command/update_spec.rb
+1
-1
integration_spec.rb
spec/integration_spec.rb
+0
-2
spec_helper.rb
spec/spec_helper.rb
+50
-45
command.rb
spec/spec_helper/command.rb
+0
-2
github.rb
spec/spec_helper/github.rb
+2
-0
temporary_directory.rb
spec/spec_helper/temporary_directory.rb
+0
-29
temporary_repos.rb
spec/spec_helper/temporary_repos.rb
+0
-5
user_interface.rb
spec/spec_helper/user_interface.rb
+3
-0
config_spec.rb
spec/unit/config_spec.rb
+0
-1
dummy_source_spec.rb
spec/unit/generator/dummy_source_spec.rb
+1
-9
prefix_header_spec.rb
spec/unit/generator/prefix_header_spec.rb
+1
-1
xcconfig_spec.rb
spec/unit/generator/xcconfig_spec.rb
+1
-1
target_installer_spec.rb
spec/unit/installer/target_installer_spec.rb
+0
-1
user_project_integrator_spec.rb
spec/unit/installer/user_project_integrator_spec.rb
+1
-1
installer_spec.rb
spec/unit/installer_spec.rb
+24
-60
local_pod_spec.rb
spec/unit/local_pod_spec.rb
+1
-1
sandbox_spec.rb
spec/unit/sandbox_spec.rb
+2
-2
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+0
-2
validator_spec.rb
spec/unit/validator_spec.rb
+1
-1
No files found.
spec/functional/command/install_spec.rb
View file @
71983133
...
...
@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Install
do
extend
SpecHelper
::
TemporaryDirectory
it
"tells the user that no Podfile or podspec was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'install'
,
'--no-update'
)
}.
should
.
raise
Informative
...
...
spec/functional/command/list_spec.rb
View file @
71983133
...
...
@@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
"Command::List"
do
extend
SpecHelper
::
TemporaryRepos
extend
SpecHelper
::
TemporaryDirectory
before
do
set_up_test_repo
...
...
spec/functional/command/outdated_spec.rb
View file @
71983133
...
...
@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Outdated
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"tells the user that no Podfile was found in the current working dir"
do
...
...
spec/functional/command/push_spec.rb
View file @
71983133
...
...
@@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Push
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
...
...
spec/functional/command/repo_spec.rb
View file @
71983133
...
...
@@ -4,7 +4,6 @@ module Pod
describe
Command
::
Repo
do
describe
"In general"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
...
...
spec/functional/command/search_spec.rb
View file @
71983133
...
...
@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Search
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
...
...
spec/functional/command/setup_spec.rb
View file @
71983133
...
...
@@ -3,7 +3,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Setup
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
...
...
spec/functional/command/spec_spec.rb
View file @
71983133
...
...
@@ -4,7 +4,6 @@ module Pod
describe
Command
::
Spec
do
describe
"In general"
do
extend
SpecHelper
::
TemporaryDirectory
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'spec'
)
}.
should
.
raise
CLAide
::
Help
...
...
@@ -20,7 +19,6 @@ module Pod
describe
"create subcommand"
do
extend
SpecHelper
::
Github
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"creates a new podspec stub file"
do
...
...
@@ -98,7 +96,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"lint subcommand"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"complains if it can't find any spec to lint"
do
...
...
@@ -149,8 +146,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"cat subcommand"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"complains it cant't find a spec to read"
do
...
...
spec/functional/command/update_spec.rb
View file @
71983133
...
...
@@ -2,7 +2,7 @@ require File.expand_path('../../../spec_helper', __FILE__)
module
Pod
describe
Command
::
Update
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"tells the user that no Podfile was found in the current working dir"
do
...
...
spec/integration_spec.rb
View file @
71983133
...
...
@@ -45,7 +45,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"Single platform"
do
extend
SpecHelper
::
TemporaryDirectory
# it "includes automatically inherited subspecs" do
# end
...
...
@@ -199,7 +198,6 @@ module Pod
[
:ios
,
:osx
].
each
do
|
test_platform
|
describe
"Multi-platform (
#{
test_platform
}
)"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
FileUtils
.
cp_r
(
fixture
(
'integration/.'
),
config
.
project_pods_root
)
...
...
spec/spec_helper.rb
View file @
71983133
require
'rubygems'
require
'bundler/setup'
require
'bacon'
require
'mocha-on-bacon'
Bacon
.
summary_at_exit
require
'pathname'
ROOT
=
Pathname
.
new
(
File
.
expand_path
(
'../../'
,
__FILE__
))
require
"active_support/core_ext/string/strip"
ROOT
=
Pathname
.
new
(
File
.
expand_path
(
'../../'
,
__FILE__
))
$:
.
unshift
((
ROOT
+
'lib'
).
to_s
)
$:
.
unshift
((
ROOT
+
'spec'
).
to_s
)
require
'cocoapods'
require
'claide'
$:
.
unshift
((
ROOT
+
'spec'
).
to_s
)
require
'spec_helper/bacon'
require
'spec_helper/command'
require
'spec_helper/fixture'
require
'spec_helper/github'
require
'spec_helper/temporary_directory'
require
'spec_helper/temporary_repos'
require
'spec_helper/user_interface'
require
'spec_helper/pre_flight'
require
'spec_helper/bacon'
# Prettifies the bacon output and adds support for `xit`.
require
'spec_helper/command'
# Allows to run Pod commands and returns their output.
require
'spec_helper/fixture'
# Provides access to the fixtures and unpacks them if needed.
require
'spec_helper/temporary_repos'
# Allows to create and modify temporary spec repositories.
require
'spec_helper/user_interface'
# Redirects UI to UI.output & UI.warnings.
require
'spec_helper/pre_flight'
# Cleans the temporary directory, the config & the UI.output before every test.
require
'spec_helper/github'
# Stubs Github API to return always the values (watchers).
#-----------------------------------------------------------------------------#
# README!
#
# Override {Specification#source} to return sources from fixtures and limit
# network connections.
#
module
Pod
class
Specification
alias
:original_source
:source
def
source
fixture
=
SpecHelper
.
fixture
(
"integration/
#{
name
}
"
)
result
=
super
if
fixture
.
exist?
# puts "Using fixture [#{name}]"
result
[
:git
]
=
fixture
.
to_s
else
# puts "MISSING fixture [#{name}]"
end
result
end
end
end
#-----------------------------------------------------------------------------#
ENV
[
'SKIP_SETUP'
]
=
'true'
if
ENV
[
'SKIP_XCODEBUILD'
].
nil?
&&
`which xcodebuild`
.
strip
.
empty?
ENV
[
'SKIP_XCODEBUILD'
]
=
'true'
end
require
'claide'
Bacon
.
summary_at_exit
module
Bacon
class
Context
include
Pod
::
Config
::
Mixin
include
SpecHelper
::
Fixture
include
SpecHelper
::
Command
def
skip_xcodebuild?
ENV
[
'SKIP_XCODEBUILD'
]
end
def
temporary_directory
SpecHelper
.
temporary_directory
end
end
end
config
=
Pod
::
Config
.
instance
config
.
silent
=
true
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
config
.
project_root
=
SpecHelper
.
temporary_directory
Pod
::
Specification
::
Set
::
Statistics
.
instance
.
cache_file
=
nil
require
'tmpdir'
module
SpecHelper
def
self
.
temporary_directory
ROOT
+
'tmp'
end
end
# TODO why is this no longer using SpecHelper::TemporaryDirectory ?
def
temporary_sandbox
Pod
::
Sandbox
.
new
(
Pathname
.
new
(
Dir
.
mktmpdir
+
"/Pods"
))
#Pod::Sandbox.new(temporary_directory + "Pods")
Pod
::
Sandbox
.
new
(
temporary_directory
+
"Pods"
)
end
def
fixture_spec
(
name
)
...
...
@@ -65,26 +91,5 @@ end
#-----------------------------------------------------------------------------#
# Override {Specification#source} to return sources from fixtures and limit
# network connections.
#
module
Pod
class
Specification
alias
:original_source
:source
def
source
fixture
=
SpecHelper
.
fixture
(
"integration/
#{
name
}
"
)
result
=
super
if
fixture
.
exist?
# puts "Using fixture [#{name}]"
result
[
:git
]
=
fixture
.
to_s
else
# puts "MISSING fixture [#{name}]"
end
result
end
end
end
SpecHelper
::
Fixture
.
fixture
(
'banana-lib'
)
# ensure it exists
require
"active_support/core_ext/string/strip"
spec/spec_helper/command.rb
View file @
71983133
require
'spec_helper/temporary_directory'
module
SpecHelper
module
Command
def
argv
(
*
argv
)
...
...
spec/spec_helper/github.rb
View file @
71983133
require
'octokit'
module
SpecHelper
module
Github
def
expect_github_repo_request
(
data
=
nil
)
...
...
spec/spec_helper/temporary_directory.rb
deleted
100644 → 0
View file @
a6029d66
require
'fileutils'
module
SpecHelper
def
self
.
temporary_directory
TemporaryDirectory
.
temporary_directory
end
module
TemporaryDirectory
def
temporary_directory
ROOT
+
'tmp'
end
module_function
:temporary_directory
def
setup_temporary_directory
temporary_directory
.
mkpath
end
def
teardown_temporary_directory
temporary_directory
.
rmtree
if
temporary_directory
.
exist?
end
def
self
.
extended
(
base
)
base
.
before
do
teardown_temporary_directory
setup_temporary_directory
end
end
end
end
spec/spec_helper/temporary_repos.rb
View file @
71983133
require
'spec_helper/temporary_directory'
# Important
# Include with temporary directory
module
SpecHelper
def
self
.
tmp_repos_path
TemporaryRepos
.
tmp_repos_path
...
...
spec/spec_helper/user_interface.rb
View file @
71983133
module
Pod
# @note as some outputs wraps strings
#
module
UI
@output
=
''
@warnings
=
''
...
...
spec/unit/config_spec.rb
View file @
71983133
...
...
@@ -18,7 +18,6 @@ module Pod
end
describe
"Concerning a user's project, which is expected in the current working directory"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
config
.
project_root
=
temporary_directory
...
...
spec/unit/generator/dummy_source_spec.rb
View file @
71983133
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Generator
::
DummySource
do
extend
SpecHelper
::
TemporaryDirectory
before
do
setup_temporary_directory
end
after
do
teardown_temporary_directory
end
it
"generates a dummy sourcefile with the appropriate class for the class name identifier"
do
generator
=
Pod
::
Generator
::
DummySource
.
new
(
'SomeIdentification'
)
...
...
spec/unit/generator/prefix_header_spec.rb
View file @
71983133
...
...
@@ -57,7 +57,7 @@ describe PrefixHeader = Pod::Generator::PrefixHeader do
@gen
.
generate
.
should
.
include?
(
'#import <Cocoa/Cocoa.h>'
)
end
extend
SpecHelper
::
TemporaryDirectory
it
"writes the prefix header file to the disk"
do
path
=
temporary_directory
+
'Test.pch'
...
...
spec/unit/generator/xcconfig_spec.rb
View file @
71983133
...
...
@@ -88,7 +88,7 @@ module Pod
#-----------------------------------------------------------------------#
extend
SpecHelper
::
TemporaryDirectory
it
"saves the xcconfig"
do
path
=
temporary_directory
+
'sample.xcconfig'
...
...
spec/unit/installer/target_installer_spec.rb
View file @
71983133
...
...
@@ -4,7 +4,6 @@ module Pod
describe
TargetInstaller
=
Installer
::
TargetInstaller
do
describe
"In General"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@podfile
=
Podfile
.
new
do
...
...
spec/unit/installer/user_project_integrator_spec.rb
View file @
71983133
...
...
@@ -4,7 +4,7 @@ module Pod
describe
Installer
::
UserProjectIntegrator
do
describe
"In general"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@sample_project_path
=
SpecHelper
.
create_sample_app_copy_from_fixture
(
'SampleProject'
)
sample_project_path
=
@sample_project_path
...
...
spec/unit/installer_spec.rb
View file @
71983133
...
...
@@ -20,12 +20,6 @@ def generate_podfile(pods = ['JSONKit'])
pods
.
each
{
|
name
|
pod
name
}
end
end
# it 'tells each pod to link its headers' do
# @pods[0].expects(:link_headers)
# do_install!
# end
module
Pod
describe
Installer
do
...
...
@@ -35,18 +29,22 @@ module Pod
# config.project_pods_root = @sandbox.root
# FileUtils.cp_r(fixture('integration/JSONKit'), @sandbox.root + 'JSONKit')
# end
#
describe
"Concerning pre-installation computations"
do
# @sandbox = temporary_sandbox
# config.project_pods_root = temporary_sandbox.root
# FileUtils.cp_r(fixture('integration/JSONKit'), @sandbox.root + 'JSONKit')
# resolver = Resolver.new(podfile, nil, @sandbox)
# @installer = Installer.new(resolver)
# target_installer = @installer.target_installers.first
# target_installer.install
# it 'tells each pod to link its headers' do
# @pods[0].expects(:link_headers)
# do_install!
# end
describe
"Concerning pre-installation computations"
do
# @sandbox = temporary_sandbox
# config.project_pods_root = temporary_sandbox.root
# FileUtils.cp_r(fixture('integration/JSONKit'), @sandbox.root + 'JSONKit')
# resolver = Resolver.new(podfile, nil, @sandbox)
# @installer = Installer.new(resolver)
# target_installer = @installer.target_installers.first
# target_installer.install
before
do
podfile
=
generate_podfile
...
...
@@ -56,23 +54,21 @@ module Pod
@installer
.
install!
end
# describe "#analyze" do
# it "doesn't affects creates changes in the file system" do
# end
# end
# <<<<<<< HEAD
it
"marks all pods as added if there is no lockfile"
do
true
.
should
.
be
.
true
# @installer.pods_added_from_the_lockfile.should == ['JSONKit']
# =======
# it "adds the files of the pod to the Pods project only once" do
# @installer.install!
# group = @installer.project.pods.groups.find { |g| g.name == 'Reachability' }
# group.files.map(&:name).sort.should == ["Reachability.h", "Reachability.m"]
# >>>>>>> core-extraction
end
# it "adds the files of the pod to the Pods project only once" do
# @installer.install!
# group = @installer.project.pods.groups.find { |g| g.name == 'Reachability' }
# group.files.map(&:name).sort.should == ["Reachability.h", "Reachability.m"]
# end
# it 'clears out its headers root when preparing for install' do
# @sandbox.prepare_for_install
# @sandbox.build_headers.root.should.not.exist
# end
end
# describe "by default" do
...
...
@@ -91,22 +87,7 @@ module Pod
# target_installer.generate_xcconfig([], @sandbox)
# @xcconfig = target_installer.xcconfig.to_hash
# end
# it "generates a BridgeSupport metadata file from all the pod headers" do
# podfile = Podfile.new do
# platform :osx
# pod 'ASIHTTPRequest'
# end
# FileUtils.cp_r(fixture('integration/ASIHTTPRequest'), @sandbox.root + 'ASIHTTPRequest')
# installer = Installer.new(@sandbox, podfile)
# pods = installer.specifications.map do |spec|
# LocalPod.new(spec, installer.sandbox, podfile.target_definitions[:default].platform)
# end
# expected = pods.map { |pod| pod.header_files }.flatten.map { |header| config.project_pods_root + header }
# expected.size.should > 0
# installer.target_installers.first.bridge_support_generator_for(pods, installer.sandbox).headers.should == expected
# end
#
# it "omits empty target definitions" do
# podfile = Podfile.new do
# platform :ios
...
...
@@ -118,16 +99,6 @@ module Pod
# installer.target_installers.map(&:target_definition).map(&:name).should == [:not_empty]
# end
# it "adds the user's build configurations" do
# path = fixture('SampleProject/SampleProject.xcodeproj')
# podfile = Podfile.new do
# platform :ios
# xcodeproj path, 'App Store' => :release
# end
# installer = Installer.new(@sandbox, podfile)
# installer.project.build_configurations.map(&:name).sort.should == ['App Store', 'Debug', 'Release', 'Test']
# end
# it "forces downloading of the `bleeding edge' version of a pod" do
# podfile = Podfile.new do
# platform :ios
...
...
@@ -142,8 +113,6 @@ module Pod
# end
# end
# describe "concerning multiple pods originating form the same spec" do
# extend SpecHelper::Fixture
...
...
@@ -223,8 +192,3 @@ module Pod
end
end
# it 'clears out its headers root when preparing for install' do
# @sandbox.prepare_for_install
# @sandbox.build_headers.root.should.not.exist
# end
spec/unit/local_pod_spec.rb
View file @
71983133
...
...
@@ -334,7 +334,7 @@ describe Pod::LocalPod do
end
describe
"concerning a Pod with a local source"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@local_path
=
temporary_directory
+
'localBanana'
...
...
spec/unit/sandbox_spec.rb
View file @
71983133
...
...
@@ -3,7 +3,7 @@ require File.expand_path('../../spec_helper', __FILE__)
module
Pod
describe
Sandbox
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@sandbox
=
Pod
::
Sandbox
.
new
(
temporary_directory
+
'Sandbox'
)
...
...
@@ -79,7 +79,7 @@ module Pod
#---------------------------------------------------------------------------#
describe
Sandbox
::
HeadersStore
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@sandbox
=
Pod
::
Sandbox
.
new
(
temporary_directory
+
'Sandbox'
)
...
...
spec/unit/sources_manager_spec.rb
View file @
71983133
...
...
@@ -34,7 +34,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"Updating Sources"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"update source backed by a git repository"
do
...
...
@@ -101,7 +100,6 @@ module Pod
#-------------------------------------------------------------------------#
describe
"Master repo"
do
extend
SpecHelper
::
TemporaryDirectory
it
"returns the master repo dir"
do
SourcesManager
.
master_repo_dir
.
to_s
.
should
.
match
/fixtures\/spec-repos\/master/
...
...
spec/unit/validator_spec.rb
View file @
71983133
...
...
@@ -2,7 +2,7 @@ require File.expand_path('../../spec_helper', __FILE__)
module
Pod
describe
Validator
do
extend
SpecHelper
::
TemporaryDirectory
# @return [void]
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment