Sha256: 84f91d281b0015552b4781079eb8c62b41b10ea8f0cd4d8c0a5cd84c76387132

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

require 'unit_test_helper'

class EmployeeTest < Test::Unit::TestCase
  include TestHelper
  include Xeroizer::Record

  def setup
    @client = Xeroizer::PublicApplication.new(CONSUMER_KEY, CONSUMER_SECRET)
    @employee = @client.Employee.build

    @employee.employee_id = 'GUID'
    @employee.status = 'ACTIVE'

    @employee.first_name = 'Example'
    @employee.last_name = 'User'

    @employee.date_of_birth = DateTime.strptime("2015-01-01T00:00:00Z")

    @employee.gender = 'F'
    @employee.email = 'user@example.com'

    @employee.start_date = DateTime.strptime("2015-01-02T00:00:00Z")
    @employee.termination_date = DateTime.strptime("2015-01-03T00:00:00Z")
    @employee.is_authorised_to_approve_timesheets = false
    @employee.employee_group_name = "TEAM A"
    @doc = Nokogiri::XML(@employee.to_xml)
  end

  it "should render" do
    assert_equal "GUID", @doc.xpath("//EmployeeID").text
    assert_equal "ACTIVE", @doc.xpath("//Status").text
    assert_equal "Example", @doc.xpath("//FirstName").text
    assert_equal "User", @doc.xpath("//LastName").text
    assert_equal "2015-01-01", @doc.xpath("//DateOfBirth").text
    assert_equal "2015-01-02", @doc.xpath("//StartDate").text
    assert_equal "2015-01-03", @doc.xpath("//TerminationDate").text
    assert_equal "F", @doc.xpath("//Gender").text
    assert_equal "user@example.com", @doc.xpath("//Email").text

    assert_equal "false", @doc.xpath("//IsAuthorisedToApproveTimesheets").text
    assert_equal "TEAM A", @doc.xpath("//EmployeeGroupName").text
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xeroizer-3-pre-beta-3.0.0.pre.beta test/unit/models/employee_test.rb