summaryrefslogtreecommitdiff
path: root/spec/mspec/spec/commands/mspec_tag_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/spec/commands/mspec_tag_spec.rb')
-rw-r--r--spec/mspec/spec/commands/mspec_tag_spec.rb170
1 files changed, 85 insertions, 85 deletions
diff --git a/spec/mspec/spec/commands/mspec_tag_spec.rb b/spec/mspec/spec/commands/mspec_tag_spec.rb
index cdb3ac1a60..1ab5f6ea58 100644
--- a/spec/mspec/spec/commands/mspec_tag_spec.rb
+++ b/spec/mspec/spec/commands/mspec_tag_spec.rb
@@ -8,13 +8,13 @@ require 'mspec/runner/actions/tagpurge'
one_spec = File.expand_path(File.dirname(__FILE__)) + '/fixtures/one_spec.rb'
two_spec = File.expand_path(File.dirname(__FILE__)) + '/fixtures/two_spec.rb'
-describe MSpecTag, ".new" do
+RSpec.describe MSpecTag, ".new" do
before :each do
@script = MSpecTag.new
end
it "sets config[:ltags] to an empty list" do
- @script.config[:ltags].should == []
+ expect(@script.config[:ltags]).to eq([])
end
it "sets config[:tagger] to :add" do
@@ -30,16 +30,16 @@ describe MSpecTag, ".new" do
end
end
-describe MSpecTag, "#options" do
+RSpec.describe MSpecTag, "#options" do
before :each do
@stdout, $stdout = $stdout, IOStub.new
@argv = [one_spec, two_spec]
@options, @config = new_option
- MSpecOptions.stub(:new).and_return(@options)
+ allow(MSpecOptions).to receive(:new).and_return(@options)
@script = MSpecTag.new
- @script.stub(:config).and_return(@config)
+ allow(@script).to receive(:config).and_return(@config)
end
after :each do
@@ -47,80 +47,80 @@ describe MSpecTag, "#options" do
end
it "enables the filter options" do
- @options.should_receive(:filters)
+ expect(@options).to receive(:filters)
@script.options @argv
end
it "enables the configure option" do
- @options.should_receive(:configure)
+ expect(@options).to receive(:configure)
@script.options @argv
end
it "provides a custom action (block) to the config option" do
- @script.should_receive(:load).with("cfg.mspec")
+ expect(@script).to receive(:load).with("cfg.mspec")
@script.options ["-B", "cfg.mspec", one_spec]
end
it "enables the dry run option" do
- @options.should_receive(:pretend)
+ expect(@options).to receive(:pretend)
@script.options @argv
end
it "enables the unguarded option" do
- @options.should_receive(:unguarded)
+ expect(@options).to receive(:unguarded)
@script.options @argv
end
it "enables the interrupt single specs option" do
- @options.should_receive(:interrupt)
+ expect(@options).to receive(:interrupt)
@script.options @argv
end
it "enables the formatter options" do
- @options.should_receive(:formatters)
+ expect(@options).to receive(:formatters)
@script.options @argv
end
it "enables the verbose option" do
- @options.should_receive(:verbose)
+ expect(@options).to receive(:verbose)
@script.options @argv
end
it "enables the version option" do
- @options.should_receive(:version)
+ expect(@options).to receive(:version)
@script.options @argv
end
it "enables the help option" do
- @options.should_receive(:help)
+ expect(@options).to receive(:help)
@script.options @argv
end
it "calls #custom_options" do
- @script.should_receive(:custom_options).with(@options)
+ expect(@script).to receive(:custom_options).with(@options)
@script.options @argv
end
it "exits if there are no files to process" do
- @options.should_receive(:parse).and_return([])
- @script.should_receive(:exit)
+ expect(@options).to receive(:parse).and_return([])
+ expect(@script).to receive(:exit)
@script.options
- $stdout.should include "No files specified"
+ expect($stdout.to_s).to include "No files specified"
end
end
-describe MSpecTag, "options" do
+RSpec.describe MSpecTag, "options" do
before :each do
@options, @config = new_option
- MSpecOptions.stub(:new).and_return(@options)
+ allow(MSpecOptions).to receive(:new).and_return(@options)
@script = MSpecTag.new
- @script.stub(:config).and_return(@config)
+ allow(@script).to receive(:config).and_return(@config)
end
describe "-N, --add TAG" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("-N", "--add", "TAG", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("-N", "--add", "TAG", an_instance_of(String))
@script.options [one_spec]
end
@@ -129,16 +129,16 @@ describe MSpecTag, "options" do
@config[:tagger] = nil
@config[:tag] = nil
@script.options [opt, "taggit", one_spec]
- @config[:tagger].should == :add
- @config[:tag].should == "taggit:"
+ expect(@config[:tagger]).to eq(:add)
+ expect(@config[:tag]).to eq("taggit:")
end
end
end
describe "-R, --del TAG" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("-R", "--del", "TAG",
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("-R", "--del", "TAG",
an_instance_of(String))
@script.options [one_spec]
end
@@ -149,17 +149,17 @@ describe MSpecTag, "options" do
@config[:tag] = nil
@config[:outcome] = nil
@script.options [opt, "taggit", one_spec]
- @config[:tagger].should == :del
- @config[:tag].should == "taggit:"
- @config[:outcome].should == :pass
+ expect(@config[:tagger]).to eq(:del)
+ expect(@config[:tag]).to eq("taggit:")
+ expect(@config[:outcome]).to eq(:pass)
end
end
end
describe "-Q, --pass" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("-Q", "--pass", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("-Q", "--pass", an_instance_of(String))
@script.options [one_spec]
end
@@ -167,15 +167,15 @@ describe MSpecTag, "options" do
["-Q", "--pass"].each do |opt|
@config[:outcome] = nil
@script.options [opt, one_spec]
- @config[:outcome].should == :pass
+ expect(@config[:outcome]).to eq(:pass)
end
end
end
describe "-F, --fail" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("-F", "--fail", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("-F", "--fail", an_instance_of(String))
@script.options [one_spec]
end
@@ -183,15 +183,15 @@ describe MSpecTag, "options" do
["-F", "--fail"].each do |opt|
@config[:outcome] = nil
@script.options [opt, one_spec]
- @config[:outcome].should == :fail
+ expect(@config[:outcome]).to eq(:fail)
end
end
end
describe "-L, --all" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("-L", "--all", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("-L", "--all", an_instance_of(String))
@script.options [one_spec]
end
@@ -199,100 +199,100 @@ describe MSpecTag, "options" do
["-L", "--all"].each do |opt|
@config[:outcome] = nil
@script.options [opt, one_spec]
- @config[:outcome].should == :all
+ expect(@config[:outcome]).to eq(:all)
end
end
end
describe "--list TAG" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("--list", "TAG", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("--list", "TAG", an_instance_of(String))
@script.options [one_spec]
end
it "sets the mode to :list" do
@config[:tagger] = nil
@script.options ["--list", "TAG", one_spec]
- @config[:tagger].should == :list
+ expect(@config[:tagger]).to eq(:list)
end
it "sets ltags to include TAG" do
@config[:tag] = nil
@script.options ["--list", "TAG", one_spec]
- @config[:ltags].should == ["TAG"]
+ expect(@config[:ltags]).to eq(["TAG"])
end
end
describe "--list-all" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("--list-all", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("--list-all", an_instance_of(String))
@script.options [one_spec]
end
it "sets the mode to :list_all" do
@config[:tagger] = nil
@script.options ["--list-all", one_spec]
- @config[:tagger].should == :list_all
+ expect(@config[:tagger]).to eq(:list_all)
end
end
describe "--purge" do
it "is enabled with #options" do
- @options.stub(:on)
- @options.should_receive(:on).with("--purge", an_instance_of(String))
+ allow(@options).to receive(:on)
+ expect(@options).to receive(:on).with("--purge", an_instance_of(String))
@script.options [one_spec]
end
it "sets the mode to :purge" do
@config[:tagger] = nil
@script.options ["--purge", one_spec]
- @config[:tagger].should == :purge
+ expect(@config[:tagger]).to eq(:purge)
end
end
end
-describe MSpecTag, "#run" do
+RSpec.describe MSpecTag, "#run" do
before :each do
- MSpec.stub(:process)
+ allow(MSpec).to receive(:process)
options = double("MSpecOptions").as_null_object
- options.stub(:parse).and_return(["one", "two"])
- MSpecOptions.stub(:new).and_return(options)
+ allow(options).to receive(:parse).and_return(["one", "two"])
+ allow(MSpecOptions).to receive(:new).and_return(options)
@config = { }
@script = MSpecTag.new
- @script.stub(:exit)
- @script.stub(:config).and_return(@config)
- @script.stub(:files).and_return(["one", "two"])
+ allow(@script).to receive(:exit)
+ allow(@script).to receive(:config).and_return(@config)
+ allow(@script).to receive(:files).and_return(["one", "two"])
@script.options
end
it "registers the tags patterns" do
@config[:tags_patterns] = [/spec/, "tags"]
- MSpec.should_receive(:register_tags_patterns).with([/spec/, "tags"])
+ expect(MSpec).to receive(:register_tags_patterns).with([/spec/, "tags"])
@script.run
end
it "registers the files to process" do
- MSpec.should_receive(:register_files).with(["one", "two"])
+ expect(MSpec).to receive(:register_files).with(["one", "two"])
@script.run
end
it "processes the files" do
- MSpec.should_receive(:process)
+ expect(MSpec).to receive(:process)
@script.run
end
it "exits with the exit code registered with MSpec" do
- MSpec.stub(:exit_code).and_return(7)
- @script.should_receive(:exit).with(7)
+ allow(MSpec).to receive(:exit_code).and_return(7)
+ expect(@script).to receive(:exit).with(7)
@script.run
end
end
-describe MSpecTag, "#register" do
+RSpec.describe MSpecTag, "#register" do
before :each do
@script = MSpecTag.new
@config = @script.config
@@ -301,19 +301,19 @@ describe MSpecTag, "#register" do
@config[:astrings] = []
@config[:ltags] = ["fails", "unstable"]
- @script.stub(:files).and_return([])
+ allow(@script).to receive(:files).and_return([])
@script.options "fake"
@t = double("TagAction")
- @t.stub(:register)
+ allow(@t).to receive(:register)
@tl = double("TagListAction")
- @tl.stub(:register)
+ allow(@tl).to receive(:register)
end
it "raises an ArgumentError if no recognized action is given" do
@config[:tagger] = :totally_whack
- lambda { @script.register }.should raise_error(ArgumentError)
+ expect { @script.register }.to raise_error(ArgumentError)
end
describe "when config[:tagger] is the default (:add)" do
@@ -322,93 +322,93 @@ describe MSpecTag, "#register" do
end
it "creates a TagAction" do
- TagAction.should_receive(:new).and_return(@t)
+ expect(TagAction).to receive(:new).and_return(@t)
@script.register
end
it "creates a TagAction if config[:tagger] is :del" do
@config[:tagger] = :del
@config[:outcome] = :pass
- TagAction.should_receive(:new).with(:del, :pass, "fake", nil, [], []).and_return(@t)
+ expect(TagAction).to receive(:new).with(:del, :pass, "fake", nil, [], []).and_return(@t)
@script.register
end
it "calls #register on the TagAction instance" do
- TagAction.should_receive(:new).and_return(@t)
- @t.should_receive(:register)
+ expect(TagAction).to receive(:new).and_return(@t)
+ expect(@t).to receive(:register)
@script.register
end
end
describe "when config[:tagger] is :list" do
before :each do
- TagListAction.should_receive(:new).with(@config[:ltags]).and_return(@tl)
+ expect(TagListAction).to receive(:new).with(@config[:ltags]).and_return(@tl)
@config[:tagger] = :list
end
it "creates a TagListAction" do
- @tl.should_receive(:register)
+ expect(@tl).to receive(:register)
@script.register
end
it "registers MSpec pretend mode" do
- MSpec.should_receive(:register_mode).with(:pretend)
+ expect(MSpec).to receive(:register_mode).with(:pretend)
@script.register
end
it "sets config[:formatter] to false" do
@script.register
- @config[:formatter].should be_false
+ expect(@config[:formatter]).to be_falsey
end
end
describe "when config[:tagger] is :list_all" do
before :each do
- TagListAction.should_receive(:new).with(nil).and_return(@tl)
+ expect(TagListAction).to receive(:new).with(nil).and_return(@tl)
@config[:tagger] = :list_all
end
it "creates a TagListAction" do
- @tl.should_receive(:register)
+ expect(@tl).to receive(:register)
@script.register
end
it "registers MSpec pretend mode" do
- MSpec.should_receive(:register_mode).with(:pretend)
+ expect(MSpec).to receive(:register_mode).with(:pretend)
@script.register
end
it "sets config[:formatter] to false" do
@script.register
- @config[:formatter].should be_false
+ expect(@config[:formatter]).to be_falsey
end
end
describe "when config[:tagger] is :purge" do
before :each do
- TagPurgeAction.should_receive(:new).and_return(@tl)
- MSpec.stub(:register_mode)
+ expect(TagPurgeAction).to receive(:new).and_return(@tl)
+ allow(MSpec).to receive(:register_mode)
@config[:tagger] = :purge
end
it "creates a TagPurgeAction" do
- @tl.should_receive(:register)
+ expect(@tl).to receive(:register)
@script.register
end
it "registers MSpec in pretend mode" do
- MSpec.should_receive(:register_mode).with(:pretend)
+ expect(MSpec).to receive(:register_mode).with(:pretend)
@script.register
end
it "registers MSpec in unguarded mode" do
- MSpec.should_receive(:register_mode).with(:unguarded)
+ expect(MSpec).to receive(:register_mode).with(:unguarded)
@script.register
end
it "sets config[:formatter] to false" do
@script.register
- @config[:formatter].should be_false
+ expect(@config[:formatter]).to be_falsey
end
end
end