Sha256: 6cc37ed8b84cca6387202a3ae806fa288cfce5da248fe1eb76c0be155ae9b39c

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 KB

Contents

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

describe SK::SDK::ArCli, "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
    c1 = Client.new
  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
  end

  it "should raise error on second create" do
    lambda{
      SK::SDK::ArCli.make(:client)
    }.should raise_error(RuntimeError, "Constant Client already defined in scope of Object!")
  end

  it "should allow create a second class in different scope" do
    lambda{
      SK::SDK::ArCli.make(:client, SK::API)
      c = SK::API::Client.new
      c.id
    }.should_not raise_error(RuntimeError)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sk_sdk-0.0.7 spec/sk_sdk/ar_cli_spec.rb
sk_sdk-0.0.6 spec/sk_sdk/ar_cli_spec.rb
sk_sdk-0.0.5 spec/sk_sdk/ar_cli_spec.rb