Sha256: 842cc48861ccf45e36c775da445e5b4c076a55445e8c92d69963cd04347bcd09

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require "test_helper"
# rake test TEST=test/business_central/object/base_test.rb

class BusinessCentral::Object::BaseTest < Minitest::Test
  def setup
    @company_id = '123456'
    @client = BusinessCentral::Client.new
  end

  def test_no_method_supported_for_find_all
    base = BusinessCentral::Object::Base.new(@client, {})
    set_object_method(base, [])
    assert_raises(BusinessCentral::NoSupportedMethod) do
      base.find_all
    end
  end

  def test_no_method_supported_for_find_by_id
    base = BusinessCentral::Object::Base.new(@client, {})
    set_object_method(base, [])
    assert_raises(BusinessCentral::NoSupportedMethod) do
      base.find_by_id('123')
    end
  end

  def test_no_method_supported_for_where_query
    base = BusinessCentral::Object::Base.new(@client, {})
    set_object_method(base, [])
    assert_raises(BusinessCentral::NoSupportedMethod) do
      base.where("displayName eq '123'")
    end
  end

  private

  def set_object_method(base, value)
    base.class.const_set('OBJECT_METHODS', value) if !base.class.const_defined?('OBJECT_METHODS')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
business-central-1.0.3 test/business_central/object/base_test.rb