Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions spec/auto_tagger/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags-ci/2009"),
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/heads/master")
]
base.repo.stub(:refs) { mock("RefSet", :all => refs) }
base.repo.stub(:refs) { double("RefSet", :all => refs) }
base.refs_for_stage("ci").should == [
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/2009")
]
Expand All @@ -267,7 +267,7 @@
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/1002"),
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/heads/master")
]
base.repo.stub(:refs) { mock("RefSet", :all => refs) }
base.repo.stub(:refs) { double("RefSet", :all => refs) }
base.refs_for_stage("ci").map(&:name).should == [ "refs/tags/ci/999", "refs/tags/ci/1001", "refs/tags/ci/1002" ]
end
end
Expand All @@ -293,7 +293,7 @@
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/production/2008"),
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/production/2009")
]
base.repo.stub(:refs) { mock("RefSet", :all => refs) }
base.repo.stub(:refs) { double("RefSet", :all => refs) }
base.release_tag_entries.should == [
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/ci/2009"),
AutoTagger::Git::Ref.new(base.repo, "abc123", "refs/tags/demo/2009"),
Expand Down
4 changes: 2 additions & 2 deletions spec/auto_tagger/capistrano_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

it "returns the sha of the last ref from that stage" do
helper = AutoTagger::CapistranoHelper.new({})
ref = mock(AutoTagger::Git::Ref, :sha => "abc123")
auto_tagger = mock AutoTagger::Base, :last_ref_from_previous_stage => ref
ref = double(AutoTagger::Git::Ref, :sha => "abc123")
auto_tagger = double AutoTagger::Base, :last_ref_from_previous_stage => ref
helper.stub(:auto_tagger) { auto_tagger }
helper.ref.should == "abc123"
end
Expand Down
16 changes: 8 additions & 8 deletions spec/auto_tagger/command_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe "#execute" do
it "runs the version command" do
command_line = AutoTagger::CommandLine.new ["version"]
command_line.execute.first.should be_true
command_line.execute.first.should eq(true)
command_line.execute.last.should include(AutoTagger::VERSION)
end

Expand All @@ -17,7 +17,7 @@
describe "#cleanup" do
it "runs the cleanup command with a stage" do
command_line = AutoTagger::CommandLine.new ["cleanup"]
tagger = mock(AutoTagger::Base, :cleanup => 7)
tagger = double(AutoTagger::Base, :cleanup => 7)
AutoTagger::Base.should_receive(:new).and_return(tagger)
command_line.execute.last.should include("7")
end
Expand All @@ -32,7 +32,7 @@
describe "#delete_locally" do
it "runs the delete_locally command" do
command_line = AutoTagger::CommandLine.new ["delete_locally"]
tagger = mock(AutoTagger::Base, :delete_locally => 7)
tagger = double(AutoTagger::Base, :delete_locally => 7)
AutoTagger::Base.should_receive(:new).and_return(tagger)
command_line.execute.last.should include("7")
end
Expand All @@ -47,7 +47,7 @@
describe "#delete_on_remote" do
it "runs the delete_on_remote command" do
command_line = AutoTagger::CommandLine.new ["delete_on_remote"]
tagger = mock(AutoTagger::Base, :delete_on_remote => 7)
tagger = double(AutoTagger::Base, :delete_on_remote => 7)
AutoTagger::Base.should_receive(:new).and_return(tagger)
command_line.execute.last.should include("7")
end
Expand All @@ -62,7 +62,7 @@
describe "#list" do
it "runs the list command" do
command_line = AutoTagger::CommandLine.new ["list"]
tagger = mock(AutoTagger::Base, :list => ["foo", "bar"])
tagger = double(AutoTagger::Base, :list => ["foo", "bar"])
AutoTagger::Base.should_receive(:new).and_return(tagger)
command_line.execute.last.should include("foo", "bar")
end
Expand All @@ -76,22 +76,22 @@

it "runs the config command" do
command_line = AutoTagger::CommandLine.new ["config"]
config = mock(AutoTagger::Configuration, :settings => {"foo" => "bar"})
config = double(AutoTagger::Configuration, :settings => {"foo" => "bar"})
AutoTagger::Configuration.should_receive(:new).and_return(config)
command_line.execute.last.should include("foo", "bar")
end

describe "#create" do
it "runs the create command" do
command_line = AutoTagger::CommandLine.new ["create"]
tagger = mock(AutoTagger::Base, :create_ref => mock(AutoTagger::Git::Ref, :name => "refs/tags"))
tagger = double(AutoTagger::Base, :create_ref => double(AutoTagger::Git::Ref, :name => "refs/tags"))
AutoTagger::Base.should_receive(:new).and_return(tagger)
command_line.execute.last.should include("refs/tags")
end

it "includes a deprecation command when necessary" do
command_line = AutoTagger::CommandLine.new ["ci"]
tagger = mock(AutoTagger::Base, :create_ref => mock(AutoTagger::Git::Ref, :name => "refs/tags"))
tagger = double(AutoTagger::Base, :create_ref => double(AutoTagger::Git::Ref, :name => "refs/tags"))
AutoTagger::Base.should_receive(:new).and_return(tagger)
result = command_line.execute.last
result.should include("DEPRECATION")
Expand Down
2 changes: 1 addition & 1 deletion spec/auto_tagger/git/ref_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe AutoTagger::Git::RefSet do

before do
@repo = mock(AutoTagger::Git::Repo, :exec => true)
@repo = double(AutoTagger::Git::Repo, :exec => true)
@ref_set = AutoTagger::Git::RefSet.new(@repo)
@refstring = <<-LIST
23087241c495773c8eece1c195cc453a8055c4eb refs/tags/200808080808
Expand Down
4 changes: 2 additions & 2 deletions spec/auto_tagger/git/ref_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe AutoTagger::Git::Ref do

before do
@repo = mock(AutoTagger::Git::Repo, :exec => true)
@repo = double(AutoTagger::Git::Repo, :exec => true)
@ref = AutoTagger::Git::Ref.new(@repo, "85af4e", "refs/auto_tags/ci")
end

Expand Down Expand Up @@ -43,4 +43,4 @@
end
end

end
end
2 changes: 1 addition & 1 deletion spec/auto_tagger/git/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

before do
File.stub(:exists?).and_return(true)
@commander = mock(AutoTagger::Commander)
@commander = double(AutoTagger::Commander)
end

describe "#path" do
Expand Down
10 changes: 5 additions & 5 deletions spec/auto_tagger/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@

it "understands --dry-run" do
options = AutoTagger::Options.from_command_line ["--dry-run"]
options[:dry_run].should be_true
options[:dry_run].should eq(true)

options = AutoTagger::Options.from_command_line ["--dry-run=true"]
options[:dry_run].should be_true
options[:dry_run].should eq(true)

options = AutoTagger::Options.from_command_line ["--dry-run=false"]
options[:dry_run].should be_false
options[:dry_run].should eq(false)
end

it "understands --fetch-refs" do
Expand All @@ -60,7 +60,7 @@
options[:offline].should be_nil

options = AutoTagger::Options.from_command_line ["--offline=true"]
options[:offline].should be_true
options[:offline].should eq(true)
end
end

Expand Down Expand Up @@ -157,4 +157,4 @@
it_should_behave_like "common options"
end

end
end
4 changes: 2 additions & 2 deletions spec/auto_tagger/recipes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

describe "create_ref" do
before do
@auto_tagger = mock(AutoTagger::Base)
@auto_tagger = double(AutoTagger::Base)
AutoTagger::Base.should_receive(:new).and_return(@auto_tagger)

@config = Capistrano::Configuration.instance = Capistrano::Configuration.new
@config.load "lib/auto_tagger/recipes"
@config.stub(:real_revision).and_return("REAL_REVISION")

@ref = mock(:name => "TAG", :sha => "SHA")
@ref = double(:name => "TAG", :sha => "SHA")
end

it "creates a tag from the real_revision when :auto_tagger_stage is set" do
Expand Down