Sha256: 6db625b794009cd1e11f61707379d972e9724036ed1d567c7ff4d4aef7f01ff2

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

require 'fakeweb'

require 'shopify-mock/version'
require 'shopify-mock/urls'
require 'shopify-mock/fixtures'

module ShopifyAPI
  module Mock
    class << self
      def enabled
        @enabled || false
      end
      
      def enabled=(value=false)
        return @enabled if value == @enabled
        if value
          load File.expand_path("../shopify-mock/responses.rb", __FILE__)
        else
          FakeWeb.clean_registry
        end
        @enabled = value
      end
      
      def allow_internet
        @allow_internet || true
      end
      
      def allow_internet=(state = true)
        return @allow_internet if @allow_internet == state
        @allow_internet = state
        FakeWeb.allow_net_connect = @allow_internet
      end
    end
  end
end

ShopifyAPI::Mock.enable if defined?(Rails) && Rails.env.test?

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shopify-mock-0.0.1 lib/shopify-mock.rb