Sha256: 9db983d81e88cfee541b8413859fde92ba4a1e3bcf254ae6d506247b62f49149

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 Bytes

Contents

require 'spec/spec_helper'
require 'spec/resources_spec_helper'

class Client < SK::SDK::Base;end
# create objects in King namespace
module KingTester; end
%w[Invoice Product].each do |model|
  eval "class KingTester::#{model} < SK::SDK::Base;end"
end

describe SK::SDK::Base, "make new class" do

  it "should create class" do
    c = Client.new
    c.first_name = 'herbert' # implicit setter
    c.first_name.should == 'herbert' # implicit getter
  end

  it "should have properties as attributes" do
    c = Client.new :some_field => ''
    c.attributes.should == {"some_field"=>""}
  end

  it "should create save method" do
    c = Client.new 
    c.respond_to?(:save).should be_true
  end

  it "should have new_record?" do
    c = Client.new
    c.new_record?.should be_true
    i = KingTester::Invoice.new
    i.new_record?.should be_true
    p = KingTester::Product.new
    p.new_record?.should be_true
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sk_sdk-0.0.7 spec/sk_sdk/base_spec.rb
sk_sdk-0.0.6 spec/sk_sdk/base_spec.rb