Commit 83a5d347 authored by Samuel E. Giddins's avatar Samuel E. Giddins Committed by Samuel Giddins

Start migrating to rspec

parent a4581388
--format documentation
--color
......@@ -27,15 +27,11 @@ group :development do
gem 'cocoapods-dependencies'
gem 'bacon'
gem 'mocha'
gem 'mocha-on-bacon'
gem 'prettybacon'
gem 'rspec'
gem 'webmock'
gem 'inch'
# Integration tests
gem 'diffy'
gem 'clintegracon'
gem 'rubocop'
end
......
......@@ -119,6 +119,7 @@ GEM
colored (1.2)
crack (0.4.2)
safe_yaml (~> 1.0.0)
diff-lcs (1.2.5)
diffy (3.0.7)
escape (0.0.4)
ffi (1.9.6)
......@@ -137,21 +138,14 @@ GEM
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
metaclass (0.0.4)
method_source (0.8.2)
minitest (5.8.1)
mocha (1.1.0)
metaclass (~> 0.0.1)
mocha-on-bacon (0.2.2)
mocha (>= 0.13.0)
nap (1.0.0)
netrc (0.7.8)
notify (0.5.2)
parser (2.2.2.6)
ast (>= 1.1, < 3.0)
powerpack (0.1.1)
prettybacon (0.0.2)
bacon (~> 1.2)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
......@@ -163,6 +157,19 @@ GEM
ffi (>= 0.5.0)
rb-kqueue (0.2.3)
ffi (>= 0.5.0)
rspec (3.3.0)
rspec-core (~> 3.3.0)
rspec-expectations (~> 3.3.0)
rspec-mocks (~> 3.3.0)
rspec-core (3.3.2)
rspec-support (~> 3.3.0)
rspec-expectations (3.3.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-mocks (3.3.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.3.0)
rspec-support (3.3.0)
rubocop (0.34.2)
astrolabe (~> 1.3)
parser (>= 2.2.2.5, < 3.0)
......@@ -190,7 +197,7 @@ PLATFORMS
DEPENDENCIES
awesome_print
bacon
bacon (~> 1.1)
bundler (~> 1.3)
claide!
clintegracon
......@@ -203,16 +210,13 @@ DEPENDENCIES
cocoapods-stats!
cocoapods-trunk!
cocoapods-try!
diffy
inch
json (= 1.7.7)
kicker
mocha
mocha-on-bacon
molinillo!
prettybacon
rake (~> 10.0)
rb-fsevent
rspec
rubocop
ruby-prof
webmock
......
......@@ -131,10 +131,10 @@ begin
puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
title 'Running the specs'
sh "bundle exec bacon #{specs('**/*')}"
sh "bundle exec rspec #{specs('**/*')}"
title 'Running Integration tests'
sh 'bundle exec bacon spec/integration.rb'
sh 'bundle exec rspec spec/integration.rb'
title 'Running examples'
Rake::Task['examples:build'].invoke
......
......@@ -2,8 +2,8 @@ require File.expand_path('../../../../spec_helper', __FILE__)
module Pod
describe Command::Cache::Clean do
extend SpecHelper::Command
extend SpecHelper::TemporaryCache
include SpecHelper::Command
include SpecHelper::TemporaryCache
before do
SpecHelper::TemporaryCache.set_up_test_cache
......
......@@ -78,7 +78,7 @@ module Pod
out.should.match /target_definitions:/
out.should.match /platform: ios/
out.should.match /- SSZipArchive:/
out.should.end_with?("\n\r\n")
out.should.end_with("\n\r\n")
end
end
......
......@@ -14,7 +14,7 @@ module Pod
[/BananaLib/,
/JSONKit/,
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
].each { |regex| out.should.match regex }
end
it 'presents the known pods with versions' do
......@@ -25,7 +25,7 @@ module Pod
[/BananaLib 1.0/,
/JSONKit #{jsonkit_set.versions.first}/,
/\d+ pods were found/,
].each { |regex| out.should =~ regex }
].each { |regex| out.should.match regex }
end
end
end
......@@ -212,68 +212,72 @@ module Pod
#-------------------------------------------------------------------------#
def it_should_check_for_existence(command)
it "errors if a given podspec doesn't exist" do
e = lambda { command('spec', command, 'some_pod_that_doesnt_exist').run }.should.raise Informative
e.message.should.match /Unable to find a pod with/
module CommandHelpers
def it_should_check_for_existence(command)
it "errors if a given podspec doesn't exist" do
e = lambda { command('spec', command, 'some_pod_that_doesnt_exist').run }.should.raise Informative
e.message.should.match /Unable to find a pod with/
end
end
end
def it_should_check_for_ambiguity(command)
it 'complains provided spec name is ambigious' do
e = lambda { command('spec', command, 'AF').run }.should.raise Informative
e.message.should.match /More than one/
def it_should_check_for_ambiguity(command)
it 'complains provided spec name is ambigious' do
e = lambda { command('spec', command, 'AF').run }.should.raise Informative
e.message.should.match /More than one/
end
end
end
def describe_regex_support(command, raise_class = nil)
describe 'RegEx support' do
before do
@test_source = Source.new(fixture('spec-repos/test_repo'))
Source::Aggregate.any_instance.stubs(:sources).returns([@test_source])
SourcesManager.updated_search_index = nil
yield if block_given?
end
def describe_regex_support(command, raise_class = nil)
describe 'RegEx support' do
before do
@test_source = Source.new(fixture('spec-repos/test_repo'))
Source::Aggregate.any_instance.stubs(:sources).returns([@test_source])
SourcesManager.updated_search_index = nil
yield if block_given?
end
it 'raise when using an invalid regex' do
lambda { run_command('spec', command, '--regex', '+') }.should.raise CLAide::Help
end
it 'raise when using an invalid regex' do
lambda { run_command('spec', command, '--regex', '+') }.should.raise CLAide::Help
end
it 'does not try to validate the query as a regex with plain-text mode' do
l = lambda { run_command('spec', command, '+') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise CLAide::Help
it 'does not try to validate the query as a regex with plain-text mode' do
l = lambda { run_command('spec', command, '+') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise CLAide::Help
end
end
end
it 'uses regex search when asked for regex mode' do
l = lambda { run_command('spec', command, '--regex', 'Ba(na)+Lib') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise
it 'uses regex search when asked for regex mode' do
l = lambda { run_command('spec', command, '--regex', 'Ba(na)+Lib') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise
end
UI.output.should.include? 'BananaLib'
UI.output.should.not.include? 'Pod+With+Plus+Signs'
UI.output.should.not.include? 'JSONKit'
end
UI.output.should.include? 'BananaLib'
UI.output.should.not.include? 'Pod+With+Plus+Signs'
UI.output.should.not.include? 'JSONKit'
end
it 'uses plain-text search when not asked for regex mode' do
l = lambda { run_command('spec', command, 'Pod+With+Plus+Signs') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise
it 'uses plain-text search when not asked for regex mode' do
l = lambda { run_command('spec', command, 'Pod+With+Plus+Signs') }
if raise_class
l.should.raise raise_class
else
l.should.not.raise
end
UI.output.should.include? 'Pod+With+Plus+Signs'
UI.output.should.not.include? 'BananaLib'
end
UI.output.should.include? 'Pod+With+Plus+Signs'
UI.output.should.not.include? 'BananaLib'
end
end
end
describe Command::Spec::Which do
extend CommandHelpers
it_should_check_for_existence('which')
it_should_check_for_ambiguity('which')
......@@ -289,6 +293,8 @@ module Pod
#-------------------------------------------------------------------------#
describe Command::Spec::Cat do
extend CommandHelpers
it_should_check_for_existence('cat')
it_should_check_for_ambiguity('cat')
......@@ -309,6 +315,8 @@ module Pod
#-------------------------------------------------------------------------#
describe Command::Spec::Edit do
extend CommandHelpers
before do
@path_saved = ENV['PATH']
end
......
......@@ -150,29 +150,29 @@ describe_cli 'pod' do
# Test subspecs inheritance
describe 'Integrates a project with CocoaPods' do
behaves_like cli_spec 'install_new',
it_behaves_like cli_spec 'install_new',
'install --no-repo-update'
end
describe 'Adds a Pod to an existing installation' do
behaves_like cli_spec 'install_add_pod',
it_behaves_like cli_spec 'install_add_pod',
'install --no-repo-update'
end
describe 'Removes a Pod from an existing installation' do
behaves_like cli_spec 'install_remove_pod',
it_behaves_like cli_spec 'install_remove_pod',
'install --no-repo-update'
end
describe 'Creates an installation with multiple target definitions' do
behaves_like cli_spec 'install_multiple_targets',
it_behaves_like cli_spec 'install_multiple_targets',
'install --no-repo-update'
end
description = 'Installs a Pod with different subspecs activated across different targets'
if has_mercurial
describe description do
behaves_like cli_spec 'install_subspecs',
it_behaves_like cli_spec 'install_subspecs',
'install --no-repo-update'
end
else
......@@ -180,19 +180,19 @@ describe_cli 'pod' do
end
describe 'Installs a Pod with subspecs and does not duplicate the prefix header' do
behaves_like cli_spec 'install_subspecs_no_duplicate_prefix',
it_behaves_like cli_spec 'install_subspecs_no_duplicate_prefix',
'install --no-repo-update'
end
describe 'Installs a Pod with a local source' do
behaves_like cli_spec 'install_local_source',
it_behaves_like cli_spec 'install_local_source',
'install --no-repo-update'
end
description = 'Installs a Pod with an external source'
if has_mercurial
describe description do
behaves_like cli_spec 'install_external_source',
it_behaves_like cli_spec 'install_external_source',
'install --no-repo-update'
end
else
......@@ -200,47 +200,47 @@ describe_cli 'pod' do
end
describe 'Installs a Pod given the podspec' do
behaves_like cli_spec 'install_podspec',
it_behaves_like cli_spec 'install_podspec',
'install --no-repo-update'
end
describe 'Installs a Pod with a custom module map' do
behaves_like cli_spec 'install_custom_module_map',
it_behaves_like cli_spec 'install_custom_module_map',
'install --no-repo-update'
end
describe 'Installs a Pod with a custom module name' do
behaves_like cli_spec 'install_custom_module_name',
it_behaves_like cli_spec 'install_custom_module_name',
'install --no-repo-update'
end
describe 'Performs an installation using a custom workspace' do
behaves_like cli_spec 'install_custom_workspace',
it_behaves_like cli_spec 'install_custom_workspace',
'install --no-repo-update'
end
describe 'Integrates a target with custom build settings' do
behaves_like cli_spec 'install_custom_build_configuration',
it_behaves_like cli_spec 'install_custom_build_configuration',
'install --no-repo-update'
end
describe 'Integrates a Pod with resources' do
behaves_like cli_spec 'install_resources',
it_behaves_like cli_spec 'install_resources',
'install --no-repo-update'
end
describe 'Integrates a Pod without source files but with resources' do
behaves_like cli_spec 'install_resources_no_source_files',
it_behaves_like cli_spec 'install_resources_no_source_files',
'install --no-repo-update'
end
describe 'Integrates a Pod using frameworks with resources' do
behaves_like cli_spec 'install_framework_resources',
it_behaves_like cli_spec 'install_framework_resources',
'install --no-repo-update'
end
describe 'Integrates a Pod using non Objective-C source files' do
behaves_like cli_spec 'install_non_objective_c_files',
it_behaves_like cli_spec 'install_non_objective_c_files',
'install --no-repo-update'
end
......@@ -254,12 +254,12 @@ describe_cli 'pod' do
# @todo add tests for all the hooks API
#
describe 'Runs the Podfile callbacks' do
behaves_like cli_spec 'install_podfile_callbacks',
it_behaves_like cli_spec 'install_podfile_callbacks',
'install --no-repo-update'
end
describe 'Uses Lockfile checkout options' do
behaves_like cli_spec 'install_using_checkout_options',
it_behaves_like cli_spec 'install_using_checkout_options',
'install --no-repo-update'
end
end
......@@ -268,12 +268,12 @@ describe_cli 'pod' do
describe 'Pod update' do
describe 'Updates an existing installation' do
behaves_like cli_spec 'update_all',
it_behaves_like cli_spec 'update_all',
'update --no-repo-update'
end
describe 'Updates a selected Pod in an existing installation' do
behaves_like cli_spec 'update_selected',
it_behaves_like cli_spec 'update_selected',
'update Reachability --no-repo-update'
end
end
......@@ -284,13 +284,13 @@ describe_cli 'pod' do
describe 'Lints a Pod from source with a prepare_command' do
# We have to disable verbose mode by adding --no-verbose here,
# otherwise xcodebuild output is included in execution output.
behaves_like cli_spec 'lib_lint_with_prepare_command',
it_behaves_like cli_spec 'lib_lint_with_prepare_command',
'lib lint',
'--no-verbose'
end
describe 'Lints a Pod' do
behaves_like cli_spec 'spec_lint',
it_behaves_like cli_spec 'spec_lint',
'spec lint --quick'
end
end
......@@ -299,7 +299,7 @@ describe_cli 'pod' do
describe 'Pod init' do
describe 'Initializes a Podfile with a single platform' do
behaves_like cli_spec 'init_single_platform',
it_behaves_like cli_spec 'init_single_platform',
'init'
end
end
......
......@@ -20,11 +20,6 @@
# Set up
#-----------------------------------------------------------------------------#
require 'rubygems'
require 'bundler/setup'
require 'bacon'
require 'mocha-on-bacon'
require 'pretty_bacon'
require 'pathname'
require 'active_support/core_ext/string/strip'
......@@ -74,25 +69,94 @@ if ENV['SKIP_XCODEBUILD'].nil? && Pod::Executable.which('xcodebuild').nil?
ENV['SKIP_XCODEBUILD'] = 'true'
end
Bacon.summary_at_exit
RSpec.configure do |config|
config.include SpecHelper::Fixture
config.include SpecHelper::Command
config.include Pod::Config::Mixin
def skip_xcodebuild?
ENV['SKIP_XCODEBUILD']
end
module Bacon
class Context
include Pod::Config::Mixin
include SpecHelper::Fixture
include SpecHelper::Command
def temporary_directory
SpecHelper.temporary_directory
end
def skip_xcodebuild?
ENV['SKIP_XCODEBUILD']
config.mock_with :rspec do |mocks|
mocks.syntax = :should
::Object.send(:define_method, :stubs) { |*args, &blk| stub(*args, &blk) }
::Object.send(:define_method, :expects) { |*args, &blk| should_receive(*args, &blk) }
::RSpec::Mocks::MessageExpectation.send(:define_method, :returns) { |*args, &blk| and_return(*args, &blk) }
::RSpec::Mocks::AnyInstance::StubChain.send(:define_method, :returns) { |*args, &blk| and_return(*args, &blk) }
::RSpec::Mocks::AnyInstance::PositiveExpectationChain.send(:define_method, :returns) { |*args, &blk| and_return(*args, &blk) }
::RSpec::Matchers::BuiltIn::OperatorMatcher.send(:define_method, :raise) do |*args, &blk|
matcher = ::RSpec::Matchers::BuiltIn::RaiseError.new(*args, &blk)
method = is_a?(::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher) ? :should_not : :should
@actual.send(method, matcher)
matcher.instance_variable_get(:@actual_error)
end
::RSpec::Matchers::BuiltIn::OperatorMatcher.send(:define_method, :not) { ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(@actual) }
::RSpec::Matchers::BuiltIn::OperatorMatcher.send(:include, ::RSpec::Matchers)
class BeShim
include ::RSpec::Matchers
def initialize(actual, should_method)
@actual = actual
@should_method = should_method
end
def method_missing(m, *args, &blk)
m = m.to_s.chomp('?').to_sym
matcher = case m
when :true
be_truthy
when :false
be_falsey
when :nil
be_nil
when :kind_of
be_a_kind_of(*args)
else
::RSpec::Matchers::BuiltIn::BePredicate.new(:"be_#{m}", *args, &blk)
end
@actual.send(@should_method, matcher)
end
end
def temporary_directory
SpecHelper.temporary_directory
::RSpec::Matchers::BuiltIn::OperatorMatcher.send(:define_method, :be) do
method = is_a?(::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher) ? :should_not : :should
BeShim.new(@actual, method)
end
class ::RSpec::Matchers::BuiltIn::OperatorMatcher
alias_method :cp_method_missing, :method_missing
def method_missing(m, *args, &blk)
wo = m.to_s.chomp('?').to_sym
if wo == m
cp_method_missing(m, *args, &blk)
else
send(wo, *args, &blk)
end
end
end
::RSpec::Core::ExampleGroup.send(:define_method, :stub) { |*args, &blk| double(*args, &blk) }
::RSpec::Core::ExampleGroup.send(:define_method, :mock) { |*args, &blk| double(*args, &blk) }
::RSpec::Core::ExampleGroup.send(:define_method, :should) do |*args, &blk|
d = double()
def d.raise(*args, &blk);
matcher = ::RSpec::Matchers::BuiltIn::RaiseError.new(*args)
method = @not ? :should_not : :should
blk.send(method, matcher)
matcher.instance_variable_get(:@actual_error)
end
def d.not
@not = true
self
end
d
end
end
end
Mocha::Configuration.prevent(:stubbing_non_existent_method)
config.expect_with(:rspec) { |c| c.syntax = :should }
end
module SpecHelper
def self.temporary_directory
......
# Restores the config to the default state before each requirement
module Bacon
class Context
old_run_requirement = instance_method(:run_requirement)
RSpec.configure do |config|
config.before(:each) do
::Pod::Config.instance = nil
::Pod::Config.instance.tap do |c|
c.verbose = false
c.silent = true
c.repos_dir = fixture('spec-repos')
c.installation_root = SpecHelper.temporary_directory
c.skip_repo_update = true
c.cache_root = SpecHelper.temporary_directory + 'Cache'
end
define_method(:run_requirement) do |description, spec|
::Pod::Config.instance = nil
::Pod::Config.instance.tap do |c|
c.verbose = false
c.silent = true
c.repos_dir = fixture('spec-repos')
c.installation_root = SpecHelper.temporary_directory
c.skip_repo_update = true
c.cache_root = SpecHelper.temporary_directory + 'Cache'
end
::Pod::UI.output = ''
::Pod::UI.warnings = ''
::Pod::UI.next_input = ''
# The following prevents a nasty behaviour where the increments are not
# balanced when testing informative which might lead to sections not
# being printed to the output as they are too nested.
::Pod::UI.indentation_level = 0
::Pod::UI.title_level = 0
::Pod::UI.output = ''
::Pod::UI.warnings = ''
::Pod::UI.next_input = ''
# The following prevents a nasty behaviour where the increments are not
# balanced when testing informative which might lead to sections not
# being printed to the output as they are too nested.
::Pod::UI.indentation_level = 0
::Pod::UI.title_level = 0
SpecHelper.temporary_directory.rmtree if SpecHelper.temporary_directory.exist?
SpecHelper.temporary_directory.mkpath
SpecHelper.temporary_directory.rmtree if SpecHelper.temporary_directory.exist?
SpecHelper.temporary_directory.mkpath
SpecHelper.tmp_repos_path.mkpath unless SpecHelper.tmp_repos_path.exist?
# TODO
::Pod::SourcesManager.stubs(:search_index_path).returns(temporary_directory + 'search_index.yaml')
# TODO
::Pod::SourcesManager.stubs(:search_index_path).returns(temporary_directory + 'search_index.yaml')
end
old_run_requirement.bind(self).call(description, spec)
end
require 'webmock'
config.after(:each) do
WebMock.reset!
end
end
......@@ -82,7 +82,8 @@ module SpecHelper
module_function :tmp_repos_path
def self.extended(base)
base.before do
base.send(:include, self)
base.before(:each) do
tmp_repos_path.mkpath
end
end
......
......@@ -161,7 +161,7 @@ module Pod
end
it 'returns the search index file' do
@config.search_index_file.to_s.should.end_with?('search_index.yaml')
@config.search_index_file.to_s.should.end_with('search_index.yaml')
end
end
......
......@@ -84,7 +84,7 @@ module Pod
end
describe 'when the cache is incomplete' do
shared 'it falls back to download the pod' do
shared_examples 'it falls back to download the pod' do
describe 'when downloading a released pod' do
it 'does download the source' do
Downloader::Git.any_instance.expects(:download).never
......@@ -125,7 +125,7 @@ module Pod
end
describe 'because the spec is missing' do
behaves_like 'it falls back to download the pod'
it_behaves_like 'it falls back to download the pod'
end
describe 'because the spec is invalid' do
......@@ -137,7 +137,7 @@ module Pod
end
end
behaves_like 'it falls back to download the pod'
it_behaves_like 'it falls back to download the pod'
end
end
......
......@@ -22,7 +22,7 @@ module Pod
@subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox)
path = config.sandbox.specifications_root + 'Reachability.podspec.json'
path.should.exist?
path.should.exist
end
it 'returns the description' do
......@@ -47,22 +47,22 @@ module Pod
should.raise Informative do
@subject.fetch(config.sandbox)
end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
end
it 'marks a pod as relative' do
@subject.stubs(:params).returns(:path => './Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.false
end
it 'marks a pod as relative' do
@subject.stubs(:params).returns(:path => './Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.false
end
it 'marks a pod as absolute' do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.true
end
it 'marks a pod as absolute' do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
Pathname.any_instance.stubs(:exist?).returns(true)
config.sandbox.stubs(:store_podspec)
@subject.fetch(config.sandbox)
config.sandbox.local_path_was_absolute?('Reachability').should.be.true
end
describe '#podspec_path' do
......
......@@ -9,7 +9,7 @@ module Pod
headers = %w(/some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h).map { |h| Pathname.new(h) }
generator = Generator::BridgeSupport.new(headers)
expected = ['-c', "-I '/some/dir' -I '/some/other/dir'", '-o', '/path/to/Pods.bridgesupport', *headers]
generator.expects(:gen_bridge_metadata).with { |*command| command.map(&:to_s) == expected.map(&:to_s) }
generator.expects(:gen_bridge_metadata) { |*command| command.map(&:to_s).should == expected.map(&:to_s) }
generator.save_as(Pathname.new('/path/to/Pods.bridgesupport'))
end
end
......
......@@ -23,19 +23,16 @@ module Pod
@target.target_definition.whitelist_pod_for_configuration(@spec.name, 'Release')
@podfile = @target.target_definition.podfile
@generator = AggregateXCConfig.new(@target, 'Release')
@xcconfig = @generator.generate
end
shared 'AggregateXCConfig' do
shared_examples 'AggregateXCConfig' do
it 'returns the path of the pods root relative to the user project' do
@generator.target.relative_pods_root.should == '${SRCROOT}/Pods'
end
#--------------------------------------------------------------------#
before do
@xcconfig = @generator.generate
end
it 'generates the xcconfig' do
@xcconfig.class.should == Xcodeproj::Config
end
......@@ -98,7 +95,7 @@ module Pod
fixture_spec('banana-lib/BananaLib.podspec')
end
behaves_like 'AggregateXCConfig'
it_behaves_like 'AggregateXCConfig'
it 'configures the project to load all members that implement Objective-c classes or categories' do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-ObjC'
......@@ -146,7 +143,7 @@ module Pod
Target.any_instance.stubs(:requires_frameworks?).returns(true)
end
behaves_like 'AggregateXCConfig'
it_behaves_like 'AggregateXCConfig'
it "doesn't configure the project to load all members that implement Objective-c classes or categories" do
@xcconfig.to_hash['OTHER_LDFLAGS'].should.not.include '-ObjC'
......
......@@ -571,7 +571,7 @@ module Pod
it 'returns that an update is required when there is no sandbox manifest' do
@analyzer.sandbox.stubs(:manifest).returns(nil)
@analyzer.should.send(:checkout_requires_update?, @dependency)
@analyzer.send(:checkout_requires_update?, @dependency).should.be.true
end
before do
......
......@@ -135,7 +135,7 @@ module Pod
@installer.install!
support_files_dir = config.sandbox.target_support_files_dir('Pods')
script = support_files_dir + 'Pods-resources.sh'
script.read.should.not.include?('logo-sidebar.png')
script.read.should.not.include('logo-sidebar.png')
end
xit 'adds the resources bundles to the copy resources script' do
......
......@@ -53,7 +53,7 @@ module Pod
end
describe '#warn_about_xcconfig_overrides' do
shared 'warn_about_xcconfig_overrides' do
def warn_about_xcconfig_overrides
target_config = stub(:name => 'Release', :build_settings => @user_target_build_settings)
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@target.stubs(:user_targets).returns([user_target])
......@@ -61,32 +61,31 @@ module Pod
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
end
it 'check that the integrated target does not override the CocoaPods build settings' do
@user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] }
behaves_like 'warn_about_xcconfig_overrides'
warn_about_xcconfig_overrides
UI.warnings.should.include 'The `SampleProject [Release]` target ' \
'overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting'
end
it 'allows the use of the alternate form of the inherited flag' do
@user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] }
behaves_like 'warn_about_xcconfig_overrides'
warn_about_xcconfig_overrides
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS'
end
it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do
@user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] }
behaves_like 'warn_about_xcconfig_overrides'
warn_about_xcconfig_overrides
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS'
end
it "ignores certain build settings which don't inherit the settings form the CocoaPods xcconfig" do
@user_target_build_settings = { 'CODE_SIGN_IDENTITY' => 'Mac Developer' }
behaves_like 'warn_about_xcconfig_overrides'
warn_about_xcconfig_overrides
UI.warnings.should.not.include 'CODE_SIGN_IDENTITY'
end
end
......
......@@ -43,7 +43,7 @@ module Pod
'subspec does not exist in all versions' do
@resolver.instance_variable_set(:@cached_sets, {})
possibilities = @resolver.search_for(Dependency.new('SDWebImage/Core'))
possibilities.should.not.include? nil
possibilities.should.not.include nil
end
end
......@@ -566,7 +566,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.3.4)']
end
......@@ -578,7 +578,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
end
......@@ -590,7 +590,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (0.10.1)']
end
......@@ -602,7 +602,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.0)']
end
......@@ -614,7 +614,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
......@@ -626,7 +626,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
......@@ -638,7 +638,7 @@ module Pod
resolver = Resolver.new(config.sandbox, @podfile, empty_graph, SourcesManager.all)
specs = resolver.resolve.values.flatten.map(&:to_s).sort
specs.should != ['AFNetworking (1.0RC3)']
specs.should.not == ['AFNetworking (1.0RC3)']
specs.should == ['AFNetworking (1.2.1)']
end
......
......@@ -115,7 +115,7 @@ module Pod
end
it 'includes folders in the resources' do
@accessor.resources.should.include?(@root + 'Resources/sub_dir')
@accessor.resources.should.include(@root + 'Resources/sub_dir')
end
it 'returns the preserve paths' do
......@@ -126,11 +126,11 @@ module Pod
it 'includes folders in the preserve paths' do
@spec_consumer.stubs(:preserve_paths).returns(['Resources'])
@accessor.preserve_paths.should.include?(@root + 'Resources')
@accessor.preserve_paths.should.include(@root + 'Resources')
end
it 'returns the paths of the framework bundles' do
@accessor.vendored_frameworks.should.include?(@root + 'Bananalib.framework')
@accessor.vendored_frameworks.should.include(@root + 'Bananalib.framework')
end
it 'returns the paths of the framework headers' do
......@@ -146,7 +146,7 @@ module Pod
end
it 'returns the paths of the library files' do
@accessor.vendored_libraries.should.include?(@root + 'libBananalib.a')
@accessor.vendored_libraries.should.include(@root + 'libBananalib.a')
end
it 'returns the resource bundles of the pod' do
......@@ -207,13 +207,14 @@ module Pod
it 'when false returns all source files as non-arc' do
@spec_consumer.stubs(:requires_arc).returns(false)
@accessor.non_arc_source_files.should == @accessor.source_files
@accessor.arc_source_files.should.be.empty?
@accessor.arc_source_files.should.be.kind_of(Array)
@accessor.arc_source_files.should.be.empty
end
it 'when true returns all source files as arc' do
@spec_consumer.stubs(:requires_arc).returns(true)
@accessor.arc_source_files.should == @accessor.source_files
@accessor.non_arc_source_files.should.be.empty?
@accessor.non_arc_source_files.should.be.empty
end
it 'when a file pattern returns all source files as arc that match' do
......
require File.expand_path('../../spec_helper', __FILE__)
require 'webmock'
module Bacon
class Context
alias_method :after_webmock, :after
def after(&block)
after_webmock do
block.call
WebMock.reset!
end
end
end
end
module Pod
describe Validator do
......
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