Sha256: eaaed515b7d3adf0a86f862acd10e62210f8df95b1dcb1bec2c9c4c0e5a133a1

Contents?: true

Size: 1014 Bytes

Versions: 25

Compression:

Stored size: 1014 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 dummy_company(options = {})
  company = Struct.new(:id, :name).new
  company.id = options[:id] || '6'
  company.name = options[:name] || 'Intercom'
  company
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

25 entries across 25 versions & 1 rubygems

Version Path
intercom-rails-0.2.24 test/test_setup.rb
intercom-rails-0.2.23 test/test_setup.rb
intercom-rails-0.2.22 test/test_setup.rb
intercom-rails-0.2.21 test/test_setup.rb
intercom-rails-0.2.20 test/test_setup.rb
intercom-rails-0.2.19 test/test_setup.rb
intercom-rails-0.2.18 test/test_setup.rb
intercom-rails-0.2.17 test/test_setup.rb
intercom-rails-0.2.16 test/test_setup.rb
intercom-rails-0.2.15 test/test_setup.rb
intercom-rails-0.2.14 test/test_setup.rb
intercom-rails-0.2.13 test/test_setup.rb
intercom-rails-0.2.12 test/test_setup.rb
intercom-rails-0.2.11 test/test_setup.rb
intercom-rails-0.2.10 test/test_setup.rb
intercom-rails-0.2.9 test/test_setup.rb
intercom-rails-0.2.8 test/test_setup.rb
intercom-rails-0.2.7 test/test_setup.rb
intercom-rails-0.2.6 test/test_setup.rb
intercom-rails-0.2.5 test/test_setup.rb