diff --git a/spec/auto_tagger/base_spec.rb b/spec/auto_tagger/base_spec.rb index ca21720..f56f607 100644 --- a/spec/auto_tagger/base_spec.rb +++ b/spec/auto_tagger/base_spec.rb @@ -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") ] @@ -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 @@ -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"), diff --git a/spec/auto_tagger/capistrano_helper_spec.rb b/spec/auto_tagger/capistrano_helper_spec.rb index d4b33a1..d348f2a 100644 --- a/spec/auto_tagger/capistrano_helper_spec.rb +++ b/spec/auto_tagger/capistrano_helper_spec.rb @@ -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 diff --git a/spec/auto_tagger/command_line_spec.rb b/spec/auto_tagger/command_line_spec.rb index af65668..7d8002a 100644 --- a/spec/auto_tagger/command_line_spec.rb +++ b/spec/auto_tagger/command_line_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -76,7 +76,7 @@ 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 @@ -84,14 +84,14 @@ 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") diff --git a/spec/auto_tagger/git/ref_set_spec.rb b/spec/auto_tagger/git/ref_set_spec.rb index 2bcf38b..eb2953c 100644 --- a/spec/auto_tagger/git/ref_set_spec.rb +++ b/spec/auto_tagger/git/ref_set_spec.rb @@ -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 diff --git a/spec/auto_tagger/git/ref_spec.rb b/spec/auto_tagger/git/ref_spec.rb index ec91c4f..417273a 100644 --- a/spec/auto_tagger/git/ref_spec.rb +++ b/spec/auto_tagger/git/ref_spec.rb @@ -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 @@ -43,4 +43,4 @@ end end -end \ No newline at end of file +end diff --git a/spec/auto_tagger/git/repo_spec.rb b/spec/auto_tagger/git/repo_spec.rb index b5a45c0..67c63b8 100644 --- a/spec/auto_tagger/git/repo_spec.rb +++ b/spec/auto_tagger/git/repo_spec.rb @@ -4,7 +4,7 @@ before do File.stub(:exists?).and_return(true) - @commander = mock(AutoTagger::Commander) + @commander = double(AutoTagger::Commander) end describe "#path" do diff --git a/spec/auto_tagger/options_spec.rb b/spec/auto_tagger/options_spec.rb index 0929047..5337258 100644 --- a/spec/auto_tagger/options_spec.rb +++ b/spec/auto_tagger/options_spec.rb @@ -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 @@ -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 @@ -157,4 +157,4 @@ it_should_behave_like "common options" end -end \ No newline at end of file +end diff --git a/spec/auto_tagger/recipes_spec.rb b/spec/auto_tagger/recipes_spec.rb index f6bdeda..8e4a26f 100644 --- a/spec/auto_tagger/recipes_spec.rb +++ b/spec/auto_tagger/recipes_spec.rb @@ -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