Sha256: ff8b7ec798bee2f41f602ead23b54c945cd03b37163f57192c2e992563f73d2a

Contents?: true

Size: 895 Bytes

Versions: 14

Compression:

Stored size: 895 Bytes

Contents

# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.

require 'spec_helper.rb'

describe "AMEE module" do

  it "should cope if json gem isn't available" do
    # Monkeypatch Kernel#require to make sure that require 'json'
    # raises a LoadError
    module Kernel
      def require_with_mock(string)
        raise LoadError.new if string == 'json' 
        require_without_mock(string)
      end
      alias_method :require_without_mock, :require
      alias_method :require, :require_with_mock
    end
    # Remove amee.rb from required file list so we can load it again
    $".delete_if{|x| x.include? 'amee.rb'}
    # Require file - require 'json' should throw a LoadError,
    # but we should cope with it OK.
    lambda {
      require 'amee'
    }.should_not raise_error
  end
  
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
amee-4.4.0 spec/amee_spec.rb
amee-4.3.2 spec/amee_spec.rb
amee-4.3.1 spec/amee_spec.rb
amee-4.3.0 spec/amee_spec.rb
amee-4.2.0 spec/amee_spec.rb
amee-4.1.7 spec/amee_spec.rb
amee-4.1.6 spec/amee_spec.rb
amee-4.1.5 spec/amee_spec.rb
amee-4.1.4 spec/amee_spec.rb
amee-4.1.3 spec/amee_spec.rb
amee-4.1.2 spec/amee_spec.rb
amee-4.1.1 spec/amee_spec.rb
amee-4.1.0 spec/amee_spec.rb
amee-4.0.0 spec/amee_spec.rb