Sha256: 868fa3033d771a5f99580720166229d053350a7e20144bf8f2f4ea11fd39ad59

Contents?: true

Size: 866 Bytes

Versions: 8

Compression:

Stored size: 866 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/helpers/language_version'

describe Object, "#language_version" do
  before :all do
    @ruby_version = Object.const_get :RUBY_VERSION

    Object.const_set :RUBY_VERSION, "8.2.3"

    dir = File.dirname(File.expand_path(__FILE__))
    @name = "#{dir}/versions/method_8.2.rb"
  end

  after :all do
    Object.const_set :RUBY_VERSION, @ruby_version
  end

  it "loads files conditionally based on name and RUBY_VERSION if it exists" do
    File.should_receive(:exists?).with(@name).and_return(true)
    should_receive(:require).with(@name)
    language_version __FILE__, "method"
  end

  it "does not load the file if it does not exist" do
    File.should_receive(:exists?).with(@name).and_return(false)
    should_not_receive(:require).with(@name)
    language_version __FILE__, "method"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mspec-1.5.10 spec/helpers/language_version_spec.rb
mspec-1.5.11 spec/helpers/language_version_spec.rb
mspec-1.5.12 spec/helpers/language_version_spec.rb
mspec-1.5.8 spec/helpers/language_version_spec.rb
mspec-1.5.7 spec/helpers/language_version_spec.rb
mspec-1.5.9 spec/helpers/language_version_spec.rb
mspec-1.5.5 spec/helpers/language_version_spec.rb
mspec-1.5.6 spec/helpers/language_version_spec.rb