Sha256: 00d005b8549f2c42d5a2c01de0cb4c36de2b5c29d095588c60f4a753a1ab8e9e

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

require 'intercom-rails'
require 'minitest/autorun'
require 'rspec/mocks'
require 'pry'

def dummy_user(options = {})
  user = Struct.new(:email, :name).new
  user.email = options[:email] || 'ben@intercom.io'
  user.name = options[:name] || 'Ben McRedmond'
  user
end

def fake_action_view_class
  klass = Class.new(ActionView::Base)
  klass.class_eval do
    include IntercomRails::ScriptTagHelper
    attr_reader :controller
  end
  klass
end

class Object
  # any_instance.rspec_reset does not work
  def self.unstub_all_instance_methods
    public_instance_methods.each do |method|
      begin
        self.any_instance.unstub(method) 
      rescue RSpec::Mocks::MockExpectationError
        next
      end
    end
  end
end

RSpec::Mocks::setup(Object.new)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
intercom-rails-0.0.9 test/test_setup.rb