diff options
Diffstat (limited to 'spec/mspec/spec')
-rw-r--r-- | spec/mspec/spec/commands/mspec_ci_spec.rb | 5 | ||||
-rw-r--r-- | spec/mspec/spec/commands/mspec_run_spec.rb | 5 | ||||
-rw-r--r-- | spec/mspec/spec/commands/mspec_tag_spec.rb | 5 | ||||
-rw-r--r-- | spec/mspec/spec/guards/bug_spec.rb | 12 | ||||
-rw-r--r-- | spec/mspec/spec/guards/platform_spec.rb | 38 | ||||
-rw-r--r-- | spec/mspec/spec/guards/support_spec.rb | 16 | ||||
-rw-r--r-- | spec/mspec/spec/helpers/ruby_exe_spec.rb | 32 | ||||
-rw-r--r-- | spec/mspec/spec/runner/formatters/html_spec.rb | 7 | ||||
-rw-r--r-- | spec/mspec/spec/utils/options_spec.rb | 24 |
9 files changed, 54 insertions, 90 deletions
diff --git a/spec/mspec/spec/commands/mspec_ci_spec.rb b/spec/mspec/spec/commands/mspec_ci_spec.rb index 1e8949b0d3..5221363953 100644 --- a/spec/mspec/spec/commands/mspec_ci_spec.rb +++ b/spec/mspec/spec/commands/mspec_ci_spec.rb @@ -33,11 +33,6 @@ describe MSpecCI, "#options" do @script.options ["-B", "cfg.mspec"] end - it "enables the name option" do - @options.should_receive(:name) - @script.options - end - it "enables the dry run option" do @options.should_receive(:pretend) @script.options diff --git a/spec/mspec/spec/commands/mspec_run_spec.rb b/spec/mspec/spec/commands/mspec_run_spec.rb index 4d350cdc02..90a42bd62b 100644 --- a/spec/mspec/spec/commands/mspec_run_spec.rb +++ b/spec/mspec/spec/commands/mspec_run_spec.rb @@ -56,11 +56,6 @@ describe MSpecRun, "#options" do @script.options ["-B", "cfg.mspec", one_spec] end - it "enables the name option" do - @options.should_receive(:name) - @script.options @argv - end - it "enables the randomize option to runs specs in random order" do @options.should_receive(:randomize) @script.options @argv diff --git a/spec/mspec/spec/commands/mspec_tag_spec.rb b/spec/mspec/spec/commands/mspec_tag_spec.rb index 3c2e94db52..cdb3ac1a60 100644 --- a/spec/mspec/spec/commands/mspec_tag_spec.rb +++ b/spec/mspec/spec/commands/mspec_tag_spec.rb @@ -61,11 +61,6 @@ describe MSpecTag, "#options" do @script.options ["-B", "cfg.mspec", one_spec] end - it "enables the name option" do - @options.should_receive(:name) - @script.options @argv - end - it "enables the dry run option" do @options.should_receive(:pretend) @script.options @argv diff --git a/spec/mspec/spec/guards/bug_spec.rb b/spec/mspec/spec/guards/bug_spec.rb index 93c549041a..c8529a49f7 100644 --- a/spec/mspec/spec/guards/bug_spec.rb +++ b/spec/mspec/spec/guards/bug_spec.rb @@ -14,12 +14,12 @@ describe BugGuard, "#match? when #implementation? is 'ruby'" do before :each do hide_deprecation_warnings stub_const "VersionGuard::FULL_RUBY_VERSION", SpecVersion.new('1.8.6') - @ruby_name = Object.const_get :RUBY_NAME - Object.const_set :RUBY_NAME, 'ruby' + @ruby_engine = Object.const_get :RUBY_ENGINE + Object.const_set :RUBY_ENGINE, 'ruby' end after :each do - Object.const_set :RUBY_NAME, @ruby_name + Object.const_set :RUBY_ENGINE, @ruby_engine end it "returns false when version argument is less than RUBY_VERSION" do @@ -76,15 +76,15 @@ describe BugGuard, "#match? when #implementation? is not 'ruby'" do before :each do hide_deprecation_warnings @ruby_version = Object.const_get :RUBY_VERSION - @ruby_name = Object.const_get :RUBY_NAME + @ruby_engine = Object.const_get :RUBY_ENGINE Object.const_set :RUBY_VERSION, '1.8.6' - Object.const_set :RUBY_NAME, 'jruby' + Object.const_set :RUBY_ENGINE, 'jruby' end after :each do Object.const_set :RUBY_VERSION, @ruby_version - Object.const_set :RUBY_NAME, @ruby_name + Object.const_set :RUBY_ENGINE, @ruby_engine end it "returns false when version argument is less than RUBY_VERSION" do diff --git a/spec/mspec/spec/guards/platform_spec.rb b/spec/mspec/spec/guards/platform_spec.rb index 578773e476..f0af12c1f8 100644 --- a/spec/mspec/spec/guards/platform_spec.rb +++ b/spec/mspec/spec/guards/platform_spec.rb @@ -120,56 +120,56 @@ describe PlatformGuard, ".implementation?" do end before :each do - @ruby_name = Object.const_get :RUBY_NAME + @ruby_engine = Object.const_get :RUBY_ENGINE end after :each do - Object.const_set :RUBY_NAME, @ruby_name + Object.const_set :RUBY_ENGINE, @ruby_engine end - it "returns true if passed :ruby and RUBY_NAME == 'ruby'" do - Object.const_set :RUBY_NAME, 'ruby' + it "returns true if passed :ruby and RUBY_ENGINE == 'ruby'" do + Object.const_set :RUBY_ENGINE, 'ruby' PlatformGuard.implementation?(:ruby).should == true end - it "returns true if passed :rubinius and RUBY_NAME == 'rbx'" do - Object.const_set :RUBY_NAME, 'rbx' + it "returns true if passed :rubinius and RUBY_ENGINE == 'rbx'" do + Object.const_set :RUBY_ENGINE, 'rbx' PlatformGuard.implementation?(:rubinius).should == true end - it "returns true if passed :jruby and RUBY_NAME == 'jruby'" do - Object.const_set :RUBY_NAME, 'jruby' + it "returns true if passed :jruby and RUBY_ENGINE == 'jruby'" do + Object.const_set :RUBY_ENGINE, 'jruby' PlatformGuard.implementation?(:jruby).should == true end - it "returns true if passed :ironruby and RUBY_NAME == 'ironruby'" do - Object.const_set :RUBY_NAME, 'ironruby' + it "returns true if passed :ironruby and RUBY_ENGINE == 'ironruby'" do + Object.const_set :RUBY_ENGINE, 'ironruby' PlatformGuard.implementation?(:ironruby).should == true end - it "returns true if passed :maglev and RUBY_NAME == 'maglev'" do - Object.const_set :RUBY_NAME, 'maglev' + it "returns true if passed :maglev and RUBY_ENGINE == 'maglev'" do + Object.const_set :RUBY_ENGINE, 'maglev' PlatformGuard.implementation?(:maglev).should == true end - it "returns true if passed :topaz and RUBY_NAME == 'topaz'" do - Object.const_set :RUBY_NAME, 'topaz' + it "returns true if passed :topaz and RUBY_ENGINE == 'topaz'" do + Object.const_set :RUBY_ENGINE, 'topaz' PlatformGuard.implementation?(:topaz).should == true end - it "returns true if passed :ruby and RUBY_NAME matches /^ruby/" do - Object.const_set :RUBY_NAME, 'ruby' + it "returns true if passed :ruby and RUBY_ENGINE matches /^ruby/" do + Object.const_set :RUBY_ENGINE, 'ruby' PlatformGuard.implementation?(:ruby).should == true - Object.const_set :RUBY_NAME, 'ruby1.8' + Object.const_set :RUBY_ENGINE, 'ruby1.8' PlatformGuard.implementation?(:ruby).should == true - Object.const_set :RUBY_NAME, 'ruby1.9' + Object.const_set :RUBY_ENGINE, 'ruby1.9' PlatformGuard.implementation?(:ruby).should == true end it "raises an error when passed an unrecognized name" do - Object.const_set :RUBY_NAME, 'ruby' + Object.const_set :RUBY_ENGINE, 'ruby' lambda { PlatformGuard.implementation?(:python) }.should raise_error(/unknown implementation/) diff --git a/spec/mspec/spec/guards/support_spec.rb b/spec/mspec/spec/guards/support_spec.rb index 43a7e76f06..f899ad02f6 100644 --- a/spec/mspec/spec/guards/support_spec.rb +++ b/spec/mspec/spec/guards/support_spec.rb @@ -5,15 +5,15 @@ describe Object, "#not_supported_on" do before :all do @verbose = $VERBOSE $VERBOSE = nil - @ruby_name = Object.const_get :RUBY_NAME if Object.const_defined? :RUBY_NAME + @ruby_engine = Object.const_get :RUBY_ENGINE if Object.const_defined? :RUBY_ENGINE end after :all do $VERBOSE = @verbose - if @ruby_name - Object.const_set :RUBY_NAME, @ruby_name + if @ruby_engine + Object.const_set :RUBY_ENGINE, @ruby_engine else - Object.send :remove_const, :RUBY_NAME + Object.send :remove_const, :RUBY_ENGINE end end @@ -22,7 +22,7 @@ describe Object, "#not_supported_on" do end it "raises an Exception when passed :ruby" do - Object.const_set :RUBY_NAME, "jruby" + Object.const_set :RUBY_ENGINE, "jruby" lambda { not_supported_on(:ruby) { ScratchPad.record :yield } }.should raise_error(Exception) @@ -30,19 +30,19 @@ describe Object, "#not_supported_on" do end it "does not yield when #implementation? returns true" do - Object.const_set :RUBY_NAME, "jruby" + Object.const_set :RUBY_ENGINE, "jruby" not_supported_on(:jruby) { ScratchPad.record :yield } ScratchPad.recorded.should_not == :yield end it "yields when #standard? returns true" do - Object.const_set :RUBY_NAME, "ruby" + Object.const_set :RUBY_ENGINE, "ruby" not_supported_on(:rubinius) { ScratchPad.record :yield } ScratchPad.recorded.should == :yield end it "yields when #implementation? returns false" do - Object.const_set :RUBY_NAME, "jruby" + Object.const_set :RUBY_ENGINE, "jruby" not_supported_on(:rubinius) { ScratchPad.record :yield } ScratchPad.recorded.should == :yield end diff --git a/spec/mspec/spec/helpers/ruby_exe_spec.rb b/spec/mspec/spec/helpers/ruby_exe_spec.rb index debfc3b1ca..474ad7b51a 100644 --- a/spec/mspec/spec/helpers/ruby_exe_spec.rb +++ b/spec/mspec/spec/helpers/ruby_exe_spec.rb @@ -4,6 +4,10 @@ require 'mspec/helpers' require 'rbconfig' class RubyExeSpecs + public :ruby_exe_options + public :resolve_ruby_exe + public :ruby_cmd + public :ruby_exe end describe "#ruby_exe_options" do @@ -11,14 +15,14 @@ describe "#ruby_exe_options" do @verbose = $VERBOSE $VERBOSE = nil - @ruby_name = Object.const_get :RUBY_NAME + @ruby_engine = Object.const_get :RUBY_ENGINE @ruby_exe_env = ENV['RUBY_EXE'] @script = RubyExeSpecs.new end after :all do - Object.const_set :RUBY_NAME, @ruby_name + Object.const_set :RUBY_ENGINE, @ruby_engine ENV['RUBY_EXE'] = @ruby_exe_env $VERBOSE = @verbose end @@ -32,33 +36,33 @@ describe "#ruby_exe_options" do @script.ruby_exe_options(:env).should == "kowabunga" end - it "returns 'bin/jruby' when passed :engine and RUBY_NAME is 'jruby'" do - Object.const_set :RUBY_NAME, 'jruby' + it "returns 'bin/jruby' when passed :engine and RUBY_ENGINE is 'jruby'" do + Object.const_set :RUBY_ENGINE, 'jruby' @script.ruby_exe_options(:engine).should == 'bin/jruby' end - it "returns 'bin/rbx' when passed :engine, RUBY_NAME is 'rbx'" do - Object.const_set :RUBY_NAME, 'rbx' + it "returns 'bin/rbx' when passed :engine, RUBY_ENGINE is 'rbx'" do + Object.const_set :RUBY_ENGINE, 'rbx' @script.ruby_exe_options(:engine).should == 'bin/rbx' end - it "returns 'ir' when passed :engine and RUBY_NAME is 'ironruby'" do - Object.const_set :RUBY_NAME, 'ironruby' + it "returns 'ir' when passed :engine and RUBY_ENGINE is 'ironruby'" do + Object.const_set :RUBY_ENGINE, 'ironruby' @script.ruby_exe_options(:engine).should == 'ir' end - it "returns 'maglev-ruby' when passed :engine and RUBY_NAME is 'maglev'" do - Object.const_set :RUBY_NAME, 'maglev' + it "returns 'maglev-ruby' when passed :engine and RUBY_ENGINE is 'maglev'" do + Object.const_set :RUBY_ENGINE, 'maglev' @script.ruby_exe_options(:engine).should == 'maglev-ruby' end - it "returns 'topaz' when passed :engine and RUBY_NAME is 'topaz'" do - Object.const_set :RUBY_NAME, 'topaz' + it "returns 'topaz' when passed :engine and RUBY_ENGINE is 'topaz'" do + Object.const_set :RUBY_ENGINE, 'topaz' @script.ruby_exe_options(:engine).should == 'topaz' end - it "returns RUBY_NAME + $(EXEEXT) when passed :name" do - bin = RUBY_NAME + (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '') + it "returns RUBY_ENGINE + $(EXEEXT) when passed :name" do + bin = RUBY_ENGINE + (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '') name = File.join ".", bin @script.ruby_exe_options(:name).should == name end diff --git a/spec/mspec/spec/runner/formatters/html_spec.rb b/spec/mspec/spec/runner/formatters/html_spec.rb index d2aff1b2a7..3783ab6a89 100644 --- a/spec/mspec/spec/runner/formatters/html_spec.rb +++ b/spec/mspec/spec/runner/formatters/html_spec.rb @@ -1,5 +1,4 @@ require File.dirname(__FILE__) + '/../../spec_helper' -require 'mspec/utils/ruby_name' require 'mspec/guards/guard' require 'mspec/runner/formatters/html' require 'mspec/runner/mspec' @@ -32,14 +31,14 @@ describe HtmlFormatter, "#start" do it "prints the HTML head" do @formatter.start - ruby_name = RUBY_NAME - ruby_name.should =~ /^#{ruby_name}/ + ruby_engine = RUBY_ENGINE + ruby_engine.should =~ /^#{ruby_engine}/ @out.should == %[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> -<title>Spec Output For #{ruby_name} (#{RUBY_VERSION})</title> +<title>Spec Output For #{ruby_engine} (#{RUBY_VERSION})</title> <style type="text/css"> ul { list-style: none; diff --git a/spec/mspec/spec/utils/options_spec.rb b/spec/mspec/spec/utils/options_spec.rb index 26c52bdbd0..face909286 100644 --- a/spec/mspec/spec/utils/options_spec.rb +++ b/spec/mspec/spec/utils/options_spec.rb @@ -507,30 +507,6 @@ describe "The --prefix STR option" do end end -describe "The -n, --name RUBY_NAME option" do - before :each do - @verbose, $VERBOSE = $VERBOSE, nil - @options, @config = new_option - end - - after :each do - $VERBOSE = @verbose - end - - it "is enabled with #name" do - @options.should_receive(:on).with("-n", "--name", "RUBY_NAME", - an_instance_of(String)) - @options.name - end - - it "sets RUBY_NAME when invoked" do - Object.should_receive(:const_set).with(:RUBY_NAME, "name").twice - @options.name - @options.parse ["-n", "name"] - @options.parse ["--name", "name"] - end -end - describe "The -t, --target TARGET option" do before :each do @options, @config = new_option |