Sha256: 83f43ae4356abbc0be3300692fe3b5359994a9d32d06ba7eab172aa6b56108bd

Contents?: true

Size: 847 Bytes

Versions: 2

Compression:

Stored size: 847 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)

module InterTest

  def setup
    IntercomRails::Config.reset!
    super
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
intercom-rails-0.1.1 test/test_setup.rb
intercom-rails-0.1.0 test/test_setup.rb