Sha256: 3f9b1bb96b2c34455fb491e4aa1e12621591e2247f0abb27d3471f85752e5c2c

Contents?: true

Size: 959 Bytes

Versions: 2

Compression:

Stored size: 959 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require 'mspec/expectations/expectations'
require 'mspec/matchers/stringsymboladapter'

class StringSymbolSpecs
  include StringSymbolAdapter
end

describe StringSymbolAdapter, "#convert_name" do
  before :all do
    @verbose = $VERBOSE
    $VERBOSE = nil
  end

  after :all do
    $VERBOSE = @verbose
  end

  before :each do
    @ruby_version = Object.const_get :RUBY_VERSION

    @name = mock("name")
  end

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

  it "converts the name to a string if RUBY_VERSION < 1.9" do
    Object.const_set :RUBY_VERSION, "1.8.6"
    @name.should_receive(:to_s).and_return("method_name")
    StringSymbolSpecs.new.convert_name @name
  end

  it "does not convert the name to a string if RUBY_VERSION >= 1.9" do
    Object.const_set :RUBY_VERSION, "1.9.0"
    @name.should_not_receive(:to_s)
    StringSymbolSpecs.new.convert_name @name
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mspec-1.5.11 spec/matchers/stringsymboladapter_spec.rb
mspec-1.5.10 spec/matchers/stringsymboladapter_spec.rb