mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/mspec@d900a49
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bd8412b74f
commit
5ccf36c7ec
41 changed files with 547 additions and 650 deletions
|
@ -22,7 +22,6 @@ class MSpecCI < MSpecScript
|
|||
options.chdir
|
||||
options.prefix
|
||||
options.configure { |f| load f }
|
||||
options.name
|
||||
options.pretend
|
||||
options.interrupt
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ class MSpecRun < MSpecScript
|
|||
options.chdir
|
||||
options.prefix
|
||||
options.configure { |f| load f }
|
||||
options.name
|
||||
options.randomize
|
||||
options.repeat
|
||||
options.pretend
|
||||
|
|
|
@ -30,7 +30,6 @@ class MSpecTag < MSpecScript
|
|||
|
||||
options.doc "\n How to modify the execution"
|
||||
options.configure { |f| load f }
|
||||
options.name
|
||||
options.pretend
|
||||
options.unguarded
|
||||
options.interrupt
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require 'mspec/utils/ruby_name'
|
||||
require 'mspec/guards/block_device'
|
||||
require 'mspec/guards/bug'
|
||||
require 'mspec/guards/conflict'
|
||||
|
|
|
@ -11,8 +11,6 @@ class BlockDeviceGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def with_block_device(&block)
|
||||
BlockDeviceGuard.new.run_if(:with_block_device, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,8 +23,6 @@ class BugGuard < VersionGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def ruby_bug(bug, version, &block)
|
||||
BugGuard.new(bug, version).run_unless(:ruby_bug, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,6 @@ class ConflictsGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
# In some cases, libraries will modify another Ruby method's
|
||||
# behavior. The specs for the method's behavior will then fail
|
||||
# if that library is loaded. This guard will not run if any of
|
||||
|
@ -16,4 +15,3 @@ class Object
|
|||
def conflicts_with(*modules, &block)
|
||||
ConflictsGuard.new(*modules).run_unless(:conflicts_with, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,6 @@ class BigEndianGuard < EndianGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def big_endian(&block)
|
||||
BigEndianGuard.new.run_if(:big_endian, &block)
|
||||
end
|
||||
|
@ -24,4 +23,3 @@ class Object
|
|||
def little_endian(&block)
|
||||
BigEndianGuard.new.run_unless(:little_endian, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,6 @@ class FeatureGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
# Provides better documentation in the specs by
|
||||
# naming sets of features that work together as
|
||||
# a whole. Examples include :encoding, :fiber,
|
||||
|
@ -40,4 +39,3 @@ class Object
|
|||
def with_feature(*features, &block)
|
||||
FeatureGuard.new(*features).run_if(:with_feature, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'mspec/runner/mspec'
|
||||
require 'mspec/runner/actions/tally'
|
||||
require 'mspec/utils/ruby_name'
|
||||
|
||||
class SpecGuard
|
||||
def self.report
|
||||
|
|
|
@ -5,9 +5,9 @@ class PlatformGuard < SpecGuard
|
|||
args.any? do |name|
|
||||
case name
|
||||
when :rubinius
|
||||
RUBY_NAME.start_with?('rbx')
|
||||
RUBY_ENGINE.start_with?('rbx')
|
||||
when :ruby, :jruby, :truffleruby, :ironruby, :macruby, :maglev, :topaz, :opal
|
||||
RUBY_NAME.start_with?(name.to_s)
|
||||
RUBY_ENGINE.start_with?(name.to_s)
|
||||
else
|
||||
raise "unknown implementation #{name}"
|
||||
end
|
||||
|
@ -67,7 +67,6 @@ class PlatformGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def platform_is(*args, &block)
|
||||
PlatformGuard.new(*args).run_if(:platform_is, &block)
|
||||
end
|
||||
|
@ -75,4 +74,3 @@ class Object
|
|||
def platform_is_not(*args, &block)
|
||||
PlatformGuard.new(*args).run_unless(:platform_is_not, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,8 +6,6 @@ class QuarantineGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def quarantine!(&block)
|
||||
QuarantineGuard.new.run_unless(:quarantine!, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,6 @@ class SuperUserGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def as_superuser(&block)
|
||||
SuperUserGuard.new.run_if(:as_superuser, &block)
|
||||
end
|
||||
|
@ -14,4 +13,3 @@ class Object
|
|||
def as_user(&block)
|
||||
SuperUserGuard.new.run_unless(:as_user, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,8 +9,6 @@ class SupportedGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def not_supported_on(*args, &block)
|
||||
SupportedGuard.new(*args).run_unless(:not_supported_on, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,8 +32,6 @@ class VersionGuard < SpecGuard
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def ruby_version_is(*args, &block)
|
||||
VersionGuard.new(*args).run_if(:ruby_version_is, &block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
# Convenience helper for specs using ARGF.
|
||||
# Set @argf to an instance of ARGF.class with the given +argv+.
|
||||
# That instance must be used instead of ARGF as ARGF is global
|
||||
|
@ -34,4 +33,3 @@ class Object
|
|||
@__mspec_saved_argf_file__ = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
# Convenience helper for altering ARGV. Saves the
|
||||
# value of ARGV and sets it to +args+. If a block
|
||||
# is given, yields to the block and then restores
|
||||
|
@ -43,4 +42,3 @@ class Object
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
# The new_datetime helper makes writing DateTime specs more simple by
|
||||
# providing default constructor values and accepting a Hash of only the
|
||||
# constructor values needed for the particular spec. For example:
|
||||
|
@ -7,7 +6,6 @@ class Object
|
|||
#
|
||||
# Possible keys are:
|
||||
# :year, :month, :day, :hour, :minute, :second, :offset and :sg.
|
||||
|
||||
def new_datetime(opts={})
|
||||
require 'date'
|
||||
|
||||
|
@ -47,5 +45,3 @@ class Object
|
|||
ENV["TZ"] = old
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
# Returns the name of a fixture file by adjoining the directory
|
||||
# of the +file+ argument with "fixtures" and the contents of the
|
||||
# +args+ array. For example,
|
||||
|
@ -23,4 +22,3 @@ class Object
|
|||
end
|
||||
File.join(path, fixtures, args)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
class Object
|
||||
def flunk(msg="This example is a failure")
|
||||
SpecExpectation.fail_with "Failed:", msg
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
# Copies a file
|
||||
def cp(source, dest)
|
||||
File.open(dest, "wb") do |d|
|
||||
|
@ -69,4 +68,3 @@ class Object
|
|||
yield f if block_given?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,7 +61,6 @@ class IOStub
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
# Creates a "bare" file descriptor (i.e. one that is not associated
|
||||
# with any Ruby object). The file descriptor can safely be passed
|
||||
# to IO.new without creating a Ruby object alias to the fd.
|
||||
|
@ -110,4 +109,3 @@ class Object
|
|||
fmode(oom[:mode] || "r:utf-8")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
class Object
|
||||
def mock_to_path(path)
|
||||
# Cannot use our Object#mock here since it conflicts with RSpec
|
||||
obj = MockObject.new('path')
|
||||
obj.should_receive(:to_path).and_return(path)
|
||||
obj
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
require 'mspec/guards/platform'
|
||||
|
||||
class Object
|
||||
def nan_value
|
||||
0/0.0
|
||||
end
|
||||
|
@ -69,4 +68,3 @@ class Object
|
|||
raise "unknown implementation for fixnum_min() helper"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
require 'mspec/utils/ruby_name'
|
||||
require 'mspec/guards/platform'
|
||||
require 'mspec/helpers/tmp'
|
||||
|
||||
|
@ -46,8 +45,8 @@ require 'mspec/helpers/tmp'
|
|||
# constructed as follows:
|
||||
#
|
||||
# 1. the value of ENV['RUBY_EXE']
|
||||
# 2. an explicit value based on RUBY_NAME
|
||||
# 3. cwd/(RUBY_NAME + $(EXEEXT) || $(exeext) || '')
|
||||
# 2. an explicit value based on RUBY_ENGINE
|
||||
# 3. cwd/(RUBY_ENGINE + $(EXEEXT) || $(exeext) || '')
|
||||
# 4. $(bindir)/$(RUBY_INSTALL_NAME)
|
||||
#
|
||||
# The value will only be used if the file exists and is executable.
|
||||
|
@ -64,8 +63,7 @@ require 'mspec/helpers/tmp'
|
|||
# 2. Running the specs while developing an alternative
|
||||
# Ruby implementation. This explicitly names the
|
||||
# executable in the development directory based on
|
||||
# the value of RUBY_NAME, which is probably initialized
|
||||
# from the value of RUBY_ENGINE.
|
||||
# the value of RUBY_ENGINE.
|
||||
# 3. Running the specs within the source directory for
|
||||
# some implementation. (E.g. a local build directory.)
|
||||
# 4. Running the specs against some installed Ruby
|
||||
|
@ -76,13 +74,12 @@ require 'mspec/helpers/tmp'
|
|||
# will be appended to RUBY_EXE so that the interpreter
|
||||
# is always called with those flags.
|
||||
|
||||
class Object
|
||||
def ruby_exe_options(option)
|
||||
case option
|
||||
when :env
|
||||
ENV['RUBY_EXE']
|
||||
when :engine
|
||||
case RUBY_NAME
|
||||
case RUBY_ENGINE
|
||||
when 'rbx'
|
||||
"bin/rbx"
|
||||
when 'jruby'
|
||||
|
@ -96,7 +93,7 @@ class Object
|
|||
end
|
||||
when :name
|
||||
require 'rbconfig'
|
||||
bin = RUBY_NAME + (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
|
||||
bin = RUBY_ENGINE + (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')
|
||||
File.join(".", bin)
|
||||
when :install_name
|
||||
require 'rbconfig'
|
||||
|
@ -175,4 +172,3 @@ class Object
|
|||
unless Object.const_defined?(:RUBY_EXE) and RUBY_EXE
|
||||
RUBY_EXE = resolve_ruby_exe
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,7 +30,6 @@ all specs are cleaning up temporary files:
|
|||
end
|
||||
end
|
||||
|
||||
class Object
|
||||
def tmp(name, uniquify=true)
|
||||
Dir.mkdir SPEC_TEMP_DIR unless Dir.exist? SPEC_TEMP_DIR
|
||||
|
||||
|
@ -42,4 +41,3 @@ class Object
|
|||
|
||||
File.join SPEC_TEMP_DIR, name
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
class Object
|
||||
def suppress_warning
|
||||
verbose = $VERBOSE
|
||||
$VERBOSE = nil
|
||||
|
@ -6,4 +5,3 @@ class Object
|
|||
ensure
|
||||
$VERBOSE = verbose
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ class HtmlFormatter < DottedFormatter
|
|||
"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;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
require 'mspec/expectations/expectations'
|
||||
require 'mspec/utils/ruby_name'
|
||||
require 'mspec/runner/formatters/yaml'
|
||||
|
||||
class JUnitFormatter < YamlFormatter
|
||||
|
@ -39,7 +38,7 @@ class JUnitFormatter < YamlFormatter
|
|||
errors="#{errors}"
|
||||
failures="#{failures}"
|
||||
time="#{time}"
|
||||
name="Spec Output For #{::RUBY_NAME} (#{::RUBY_VERSION})">
|
||||
name="Spec Output For #{::RUBY_ENGINE} (#{::RUBY_VERSION})">
|
||||
XML
|
||||
@tests.each do |h|
|
||||
description = encode_for_xml h[:test].description
|
||||
|
|
|
@ -200,13 +200,6 @@ class MSpecOptions
|
|||
"Load FILE containing configuration options", &block)
|
||||
end
|
||||
|
||||
def name
|
||||
on("-n", "--name", "RUBY_NAME",
|
||||
"Set the value of RUBY_NAME (used to determine the implementation)") do |n|
|
||||
Object.const_set :RUBY_NAME, n
|
||||
end
|
||||
end
|
||||
|
||||
def targets
|
||||
on("-t", "--target", "TARGET",
|
||||
"Implementation to run the specs, where TARGET is:") do |t|
|
||||
|
@ -469,7 +462,6 @@ class MSpecOptions
|
|||
# Generated with:
|
||||
# puts File.read(__FILE__).scan(/def (\w+).*\n\s*on\(/)
|
||||
configure {}
|
||||
name
|
||||
targets
|
||||
formatters
|
||||
filters
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
unless Object.const_defined?(:RUBY_NAME) and RUBY_NAME
|
||||
if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE
|
||||
RUBY_NAME = RUBY_ENGINE
|
||||
else
|
||||
require 'rbconfig'
|
||||
RUBY_NAME = RbConfig::CONFIG["RUBY_INSTALL_NAME"] || RbConfig::CONFIG["ruby_install_name"]
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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/)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,6 +24,9 @@ raise RUBYSPEC_REPO unless Dir.exist?(RUBYSPEC_REPO)
|
|||
|
||||
NOW = Time.now
|
||||
|
||||
BRIGHT_YELLOW = "\e[33;1m"
|
||||
RESET = "\e[0m"
|
||||
|
||||
class RubyImplementation
|
||||
attr_reader :name
|
||||
|
||||
|
@ -110,7 +113,7 @@ def rebase_commits(impl)
|
|||
|
||||
rebased = impl.rebased_branch
|
||||
if branch?(rebased)
|
||||
puts "#{rebased} already exists, assuming it correct"
|
||||
puts "#{BRIGHT_YELLOW}#{rebased} already exists, assuming it correct#{RESET}"
|
||||
sh "git", "checkout", rebased
|
||||
else
|
||||
sh "git", "checkout", impl.name
|
||||
|
@ -118,7 +121,7 @@ def rebase_commits(impl)
|
|||
if ENV["LAST_MERGE"]
|
||||
last_merge = `git log -n 1 --format='%H %ct' #{ENV["LAST_MERGE"]}`
|
||||
else
|
||||
last_merge = `git log --grep='#{impl.last_merge_message}' -n 1 --format='%H %ct'`
|
||||
last_merge = `git log --grep='^#{impl.last_merge_message}' -n 1 --format='%H %ct'`
|
||||
end
|
||||
last_merge, commit_timestamp = last_merge.chomp.split(' ')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue