Skip to content

Commit

Permalink
clean up spec_helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Dec 5, 2010
1 parent efc8168 commit 90209e1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 47 deletions.
2 changes: 1 addition & 1 deletion spec/rspec/matchers/operator_matcher_spec.rb
Expand Up @@ -21,7 +21,7 @@

end

describe "unsupported operators", :ruby => '1.9' do
describe "unsupported operators", :unless => RUBY_VERSION.to_f == 1.9 do
it "raises an appropriate error for should != expected" do
expect {
"apple".should != "pear"
Expand Down
46 changes: 1 addition & 45 deletions spec/spec_helper.rb
Expand Up @@ -15,54 +15,10 @@ def add_to_load_path(path, prepend=false)
require 'rspec/core'
require 'rspec/mocks'

Dir['./spec/support/**/*'].each do |f|
require f
end

RSpec::Matchers.define :include_method do |expected|
match do |actual|
actual.map { |m| m.to_s }.include?(expected.to_s)
end
end

module RSpec
module Ruby
class << self
def version
RUBY_VERSION
end
end
end
end

module RSpec
module Matchers
def fail
raise_error(RSpec::Expectations::ExpectationNotMetError)
end

def fail_with(message)
raise_error(RSpec::Expectations::ExpectationNotMetError, message)
end
end
end
Dir['./spec/support/**/*'].each {|f| require f}

RSpec::configure do |config|
config.mock_with(:rspec)
config.include RSpec::Mocks::Methods
config.color_enabled = true
config.filter_run :focused => true

config.filter_run_excluding :ruby => lambda {|version|
case version.to_s
when "!jruby"
RUBY_ENGINE != "jruby"
when /^> (.*)/
!(RUBY_VERSION.to_s > $1)
else
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
end
}

config.run_all_when_everything_filtered = true
end
2 changes: 1 addition & 1 deletion spec/support/classes.rb
@@ -1,4 +1,4 @@
# This file contains various classes used by the specs.
# various classes used by the specs
module RSpec
module Expectations
module Helper
Expand Down
18 changes: 18 additions & 0 deletions spec/support/matchers.rb
@@ -0,0 +1,18 @@
RSpec::Matchers.define :include_method do |expected|
match do |actual|
actual.map { |m| m.to_s }.include?(expected.to_s)
end
end

module RSpec
module Matchers
def fail
raise_error(RSpec::Expectations::ExpectationNotMetError)
end

def fail_with(message)
raise_error(RSpec::Expectations::ExpectationNotMetError, message)
end
end
end

10 changes: 10 additions & 0 deletions spec/support/ruby_version.rb
@@ -0,0 +1,10 @@
module RSpec
module Ruby
class << self
def version
RUBY_VERSION
end
end
end
end

0 comments on commit 90209e1

Please sign in to comment.