Sha256: 01dd6e7751476f99c3205ad8e7e4ad45312c4e64bfcaff6bcbbe1f06dd926541

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe LVS::JsonService::Base do
  it "should include Request" do
    LVS::JsonService::Base.ancestors.should include(LVS::JsonService::Request)
  end
  
  it "should ignore calls to missing methods if ignore_missing is true" do
    class IgnoreMissingExample < LVS::JsonService::Base
      self.ignore_missing = true
    end
    obj = IgnoreMissingExample.new
    obj.do_voodoo.should eql(nil)
  end
  
  it "should raise an exception on missing methods if ignore_missing is not set" do
    class RaiseOnMissingExample < LVS::JsonService::Base; end
    obj = RaiseOnMissingExample.new
    lambda {obj.do_voodoo}.should raise_error(NoMethodError)
  end
  
  it "should find camelCase attributes using camelCase or ruby_sytax" do
    class AttributeNames < LVS::JsonService::Base
      self.ignore_missing = true
      fake_service :call, '{"longMethodName":1}'
    end
    obj = AttributeNames.call
    obj.longMethodName.should eql(1)
    obj.long_method_name.should eql(1)
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
LVS-JSONService-0.2.8 spec/lvs/json_service/base_spec.rb