Sha256: 03c09a98ce0c7de5e6b74c0df1c7791e7243618510d4c22328efcf5c2bb87db2

Contents?: true

Size: 973 Bytes

Versions: 4

Compression:

Stored size: 973 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib tire_swing]))

Spec::Runner.configure do |config|
  # == Mock Framework
  #
  # RSpec uses it's own mocking framework by default. If you prefer to
  # use mocha, flexmock or RR, uncomment the appropriate line:
  #
  # config.mock_with :mocha
  # config.mock_with :flexmock
  # config.mock_with :rr

  # borrowed from rspec_on_rails' mock_model
  def mock_syntax_node(name, stubs={})
    m = mock "mock syntax node (#{name})", stubs
    m.send(:__mock_proxy).instance_eval do
      def @target.is_a?(other)
        Treetop::Runtime::SyntaxNode.ancestors.include?(other)
      end
      def @target.kind_of?(other)
        Treetop::Runtime::SyntaxNode.ancestors.include?(other)
      end
      def @target.instance_of?(other)
        other == Treetop::Runtime::SyntaxNode
      end
      def @target.class
        Treetop::Runtime::SyntaxNode
      end
    end
    yield m if block_given?
    m
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aniero-tire_swing-0.0.3 spec/spec_helper.rb
aniero-tire_swing-0.0.4 spec/spec_helper.rb
aniero-tire_swing-0.0.5 spec/spec_helper.rb
aniero-tire_swing-0.0.6 spec/spec_helper.rb