diff options
Diffstat (limited to 'spec/mspec/spec/commands/mspec_run_spec.rb')
-rw-r--r-- | spec/mspec/spec/commands/mspec_run_spec.rb | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/spec/mspec/spec/commands/mspec_run_spec.rb b/spec/mspec/spec/commands/mspec_run_spec.rb index fcb44ad5a9..62acd49d7f 100644 --- a/spec/mspec/spec/commands/mspec_run_spec.rb +++ b/spec/mspec/spec/commands/mspec_run_spec.rb @@ -5,130 +5,130 @@ require 'mspec/commands/mspec-run' 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 MSpecRun, ".new" do +RSpec.describe MSpecRun, ".new" do before :each do @script = MSpecRun.new end it "sets config[:files] to an empty list" do - @script.config[:files].should == [] + expect(@script.config[:files]).to eq([]) end end -describe MSpecRun, "#options" do +RSpec.describe MSpecRun, "#options" do before :each do @argv = [one_spec, two_spec] @options, @config = new_option - MSpecOptions.stub(:new).and_return(@options) + allow(MSpecOptions).to receive(:new).and_return(@options) @script = MSpecRun.new - @script.stub(:config).and_return(@config) + allow(@script).to receive(:config).and_return(@config) end it "enables the filter options" do - @options.should_receive(:filters) + expect(@options).to receive(:filters) @script.options @argv end it "enables the chdir option" do - @options.should_receive(:chdir) + expect(@options).to receive(:chdir) @script.options @argv end it "enables the prefix option" do - @options.should_receive(:prefix) + expect(@options).to receive(:prefix) @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 randomize option to runs specs in random order" do - @options.should_receive(:randomize) + expect(@options).to receive(:randomize) @script.options @argv 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 verify options" do - @options.should_receive(:verify) + expect(@options).to receive(:verify) @script.options @argv end it "enables the action options" do - @options.should_receive(:actions) + expect(@options).to receive(:actions) @script.options @argv end it "enables the action filter options" do - @options.should_receive(:action_filters) + expect(@options).to receive(:action_filters) @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 "exits if there are no files to process and './spec' is not a directory" do - File.should_receive(:directory?).with("./spec").and_return(false) - @options.should_receive(:parse).and_return([]) - @script.should_receive(:abort).with("No files specified.") + expect(File).to receive(:directory?).with("./spec").and_return(false) + expect(@options).to receive(:parse).and_return([]) + expect(@script).to receive(:abort).with("No files specified.") @script.options end it "process 'spec/' if it is a directory and no files were specified" do - File.should_receive(:directory?).with("./spec").and_return(true) - @options.should_receive(:parse).and_return([]) - @script.should_receive(:files).with(["spec/"]).and_return(["spec/a_spec.rb"]) + expect(File).to receive(:directory?).with("./spec").and_return(true) + expect(@options).to receive(:parse).and_return([]) + expect(@script).to receive(:files).with(["spec/"]).and_return(["spec/a_spec.rb"]) @script.options 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 end -describe MSpecRun, "#run" do +RSpec.describe MSpecRun, "#run" do before :each do @script = MSpecRun.new - @script.stub(:exit) + allow(@script).to receive(:exit) @spec_dir = File.expand_path(File.dirname(__FILE__)+"/fixtures") @file_patterns = [ @spec_dir+"/level2", @@ -139,35 +139,35 @@ describe MSpecRun, "#run" do @spec_dir+"/one_spec.rb", @spec_dir+"/two_spec.rb"] @script.options @file_patterns - MSpec.stub :process + allow(MSpec).to receive :process end it "registers the tags patterns" do @script.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(@files) + expect(MSpec).to receive(:register_files).with(@files) @script.run end it "uses config[:files] if no files are given on the command line" do @script.config[:files] = @file_patterns - MSpec.should_receive(:register_files).with(@files) + expect(MSpec).to receive(:register_files).with(@files) @script.options [] @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 |