Sha256: 5c22874ccd4375039d7787b6d35f070f1b7b2eb5d381b8609c3699720fca4496
Contents?: true
Size: 1.44 KB
Versions: 3
Compression:
Stored size: 1.44 KB
Contents
require "test_helper" # rake test TEST=test/business_central/object/account_test.rb class BusinessCentral::Object::AccountTest < Minitest::Test def setup @company_id = '123456' @client = BusinessCentral::Client.new @client.authorize_from_token( token: '123', refresh_token: '456', expires_at: Time.now + 3600, expires_in: 3600 ) @account = @client.account(company_id: @company_id) end def test_find_all stub_request(:get, /accounts/) .to_return( status: 200, body: { 'value': [ { displayName: 'account1' } ] }.to_json ) response = @account.find_all assert_equal response.first[:display_name], 'account1' end def test_find_by_id test_account_id = '123' stub_request(:get, /accounts\(#{test_account_id}\)/) .to_return( status: 200, body: { displayName: 'account2' }.to_json ) response = @account.find_by_id(test_account_id) assert_equal response[:display_name], 'account2' end def test_create assert_raises BusinessCentral::NoSupportedMethod do @account.create({}) end end def test_update assert_raises BusinessCentral::NoSupportedMethod do @account.update('123', {}) end end def test_delete assert_raises BusinessCentral::NoSupportedMethod do @account.destroy('123') end end end
Version data entries
3 entries across 3 versions & 1 rubygems