Skip to content

Commit

Permalink
No more need to reset global state in the specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Mar 4, 2012
1 parent b09aaeb commit 7e2dbed
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 42 deletions.
2 changes: 0 additions & 2 deletions spec/functional/command_spec.rb
Expand Up @@ -54,8 +54,6 @@ def command.master_repo_url; SpecHelper.fixture('spec-repos/master'); end
end

before do
Pod::Source.reset!
Pod::Spec::Set.reset!
config.repos_dir = fixture('spec-repos')
end

Expand Down
10 changes: 0 additions & 10 deletions spec/integration_spec.rb
Expand Up @@ -32,8 +32,6 @@ def set.specification
extend SpecHelper::TemporaryDirectory

before do
Pod::Source.reset!
Pod::Spec::Set.reset!
fixture('spec-repos/master') # ensure the archive is unpacked

@config_before = config
Expand Down Expand Up @@ -264,8 +262,6 @@ def should_successfully_perform(command)
installer = SpecHelper::Installer.new(spec)
installer.install!

Pod::Source.reset!
Pod::Spec::Set.reset!
spec = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
Expand All @@ -281,9 +277,6 @@ def should_successfully_perform(command)
end

it "creates a project with multiple targets" do
Pod::Source.reset!
Pod::Spec::Set.reset!

podfile = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
Expand Down Expand Up @@ -370,9 +363,6 @@ def should_successfully_perform(command)
end

it "should prevent duplication cleaning headers symlinks with multiple targets" do
Pod::Source.reset!
Pod::Spec::Set.reset!

podfile = Pod::Podfile.new do
# first ensure that the correct info is available to the specs when they load
config.rootspec = self
Expand Down
13 changes: 0 additions & 13 deletions spec/spec_helper.rb
Expand Up @@ -30,18 +30,6 @@ def argv(*argv)
config.silent = true
config.repos_dir = SpecHelper.tmp_repos_path

class Pod::Source
def self.reset!
@sources = nil
end
end

class Pod::Spec::Set
def self.reset!
@sets = nil
end
end

require 'tmpdir'

def temporary_sandbox
Expand All @@ -58,5 +46,4 @@ def copy_fixture_to_pod(name, pod)
FileUtils.cp_r(path, pod.root)
end


SpecHelper::Fixture.fixture('banana-lib') # ensure it exists
1 change: 0 additions & 1 deletion spec/unit/resolver_spec.rb
Expand Up @@ -2,7 +2,6 @@

describe "Pod::Resolver" do
before do
Pod::Spec::Set.reset!
@config_before = config
Pod::Config.instance = nil
config.silent = true
Expand Down
2 changes: 0 additions & 2 deletions spec/unit/source_spec.rb
Expand Up @@ -5,8 +5,6 @@
extend SpecHelper::TemporaryDirectory

before do
Pod::Source.reset!
Pod::Spec::Set.reset!
add_repo('repo1', fixture('spec-repos/master'))
(config.repos_dir + 'repo1/JSONKit').rmtree
add_repo('repo2', fixture('spec-repos/master'))
Expand Down
20 changes: 6 additions & 14 deletions spec/unit/specification/set_spec.rb
@@ -1,15 +1,8 @@
require File.expand_path('../../../spec_helper', __FILE__)

class Pod::Spec::Set
def reset!
@required_by = []
end
end

describe "Pod::Specification::Set" do
before do
@set = Pod::Spec::Set.new(fixture('spec-repos/master/CocoaLumberjack'))
@set.reset!
end

it "returns the name of the pod" do
Expand All @@ -36,6 +29,12 @@ def reset!
lambda { @set.required_version }.should.raise Pod::Informative
end

it "returns that this set is only part for other pods" do
@set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.should.be.only_part_of_other_pod
end

before do
@set.required_by(Pod::Spec.new { |s| s.dependency 'CocoaLumberjack', '< 1.2.1' })
end
Expand All @@ -57,13 +56,6 @@ def reset!
@set.should.not.be.only_part_of_other_pod
end

it "returns that this set is only part for other pods" do
@set.reset!
@set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.required_by(Pod::Spec.new { |s| s.part_of = 'CocoaLumberjack' })
@set.should.be.only_part_of_other_pod
end

it "ignores dotfiles when getting the version directories" do
`touch #{fixture('spec-repos/master/CocoaLumberjack/.DS_Store')}`
lambda { @set.versions }.should.not.raise
Expand Down

0 comments on commit 7e2dbed

Please sign in to comment.