diff options
Diffstat (limited to 'spec/mspec/spec/runner/actions/tagpurge_spec.rb')
-rw-r--r-- | spec/mspec/spec/runner/actions/tagpurge_spec.rb | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/spec/mspec/spec/runner/actions/tagpurge_spec.rb b/spec/mspec/spec/runner/actions/tagpurge_spec.rb index 27ad2a1470..37df0afd5a 100644 --- a/spec/mspec/spec/runner/actions/tagpurge_spec.rb +++ b/spec/mspec/spec/runner/actions/tagpurge_spec.rb @@ -4,7 +4,7 @@ require 'mspec/runner/mspec' require 'mspec/runner/example' require 'mspec/runner/tag' -describe TagPurgeAction, "#start" do +RSpec.describe TagPurgeAction, "#start" do before :each do @stdout = $stdout $stdout = IOStub.new @@ -17,45 +17,45 @@ describe TagPurgeAction, "#start" do it "prints a banner" do action = TagPurgeAction.new action.start - $stdout.should == "\nRemoving tags not matching any specs\n\n" + expect($stdout).to eq("\nRemoving tags not matching any specs\n\n") end end -describe TagPurgeAction, "#load" do +RSpec.describe TagPurgeAction, "#load" do before :each do @t1 = SpecTag.new "fails:I fail" @t2 = SpecTag.new "unstable:I'm unstable" end it "creates a MatchFilter for all tags" do - MSpec.should_receive(:read_tags).and_return([@t1, @t2]) - MatchFilter.should_receive(:new).with(nil, "I fail", "I'm unstable") + expect(MSpec).to receive(:read_tags).and_return([@t1, @t2]) + expect(MatchFilter).to receive(:new).with(nil, "I fail", "I'm unstable") TagPurgeAction.new.load end end -describe TagPurgeAction, "#after" do +RSpec.describe TagPurgeAction, "#after" do before :each do @state = double("ExampleState") - @state.stub(:description).and_return("str") + allow(@state).to receive(:description).and_return("str") @action = TagPurgeAction.new end it "does not save the description if the filter does not match" do - @action.should_receive(:===).with("str").and_return(false) + expect(@action).to receive(:===).with("str").and_return(false) @action.after @state - @action.matching.should == [] + expect(@action.matching).to eq([]) end it "saves the description if the filter matches" do - @action.should_receive(:===).with("str").and_return(true) + expect(@action).to receive(:===).with("str").and_return(true) @action.after @state - @action.matching.should == ["str"] + expect(@action.matching).to eq(["str"]) end end -describe TagPurgeAction, "#unload" do +RSpec.describe TagPurgeAction, "#unload" do before :each do @stdout = $stdout $stdout = IOStub.new @@ -64,11 +64,11 @@ describe TagPurgeAction, "#unload" do @t2 = SpecTag.new "unstable:I'm unstable" @t3 = SpecTag.new "fails:I'm unstable" - MSpec.stub(:read_tags).and_return([@t1, @t2, @t3]) - MSpec.stub(:write_tags) + allow(MSpec).to receive(:read_tags).and_return([@t1, @t2, @t3]) + allow(MSpec).to receive(:write_tags) @state = double("ExampleState") - @state.stub(:description).and_return("I'm unstable") + allow(@state).to receive(:description).and_return("I'm unstable") @action = TagPurgeAction.new @action.load @@ -80,37 +80,37 @@ describe TagPurgeAction, "#unload" do end it "does not rewrite any tags if there were no tags for the specs" do - MSpec.should_receive(:read_tags).and_return([]) - MSpec.should_receive(:delete_tags) - MSpec.should_not_receive(:write_tags) + expect(MSpec).to receive(:read_tags).and_return([]) + expect(MSpec).to receive(:delete_tags) + expect(MSpec).not_to receive(:write_tags) @action.load @action.after @state @action.unload - $stdout.should == "" + expect($stdout).to eq("") end it "rewrites tags that were matched" do - MSpec.should_receive(:write_tags).with([@t2, @t3]) + expect(MSpec).to receive(:write_tags).with([@t2, @t3]) @action.unload end it "prints tags that were not matched" do @action.unload - $stdout.should == "I fail\n" + expect($stdout).to eq("I fail\n") end end -describe TagPurgeAction, "#unload" do +RSpec.describe TagPurgeAction, "#unload" do before :each do @stdout = $stdout $stdout = IOStub.new - MSpec.stub(:read_tags).and_return([]) + allow(MSpec).to receive(:read_tags).and_return([]) @state = double("ExampleState") - @state.stub(:description).and_return("I'm unstable") + allow(@state).to receive(:description).and_return("I'm unstable") @action = TagPurgeAction.new @action.load @@ -122,33 +122,33 @@ describe TagPurgeAction, "#unload" do end it "deletes the tag file if no tags were found" do - MSpec.should_not_receive(:write_tags) - MSpec.should_receive(:delete_tags) + expect(MSpec).not_to receive(:write_tags) + expect(MSpec).to receive(:delete_tags) @action.unload - $stdout.should == "" + expect($stdout).to eq("") end end -describe TagPurgeAction, "#register" do +RSpec.describe TagPurgeAction, "#register" do before :each do - MSpec.stub(:register) + allow(MSpec).to receive(:register) @action = TagPurgeAction.new end it "registers itself with MSpec for the :unload event" do - MSpec.should_receive(:register).with(:unload, @action) + expect(MSpec).to receive(:register).with(:unload, @action) @action.register end end -describe TagPurgeAction, "#unregister" do +RSpec.describe TagPurgeAction, "#unregister" do before :each do - MSpec.stub(:unregister) + allow(MSpec).to receive(:unregister) @action = TagPurgeAction.new end it "unregisters itself with MSpec for the :unload event" do - MSpec.should_receive(:unregister).with(:unload, @action) + expect(MSpec).to receive(:unregister).with(:unload, @action) @action.unregister end end |