Sha256: a3c9c86ab2eb99d82a0d7276d0af79b5a6ea63f7568dd418d2bb2c36cb0a1425

Contents?: true

Size: 1.98 KB

Versions: 6

Compression:

Stored size: 1.98 KB

Contents

require './spec/spec_helper'

describe SystemInfo do
  before(:each) do 
    @sysinfo = SystemInfo.new({
      "Name"=>"beh  apiuser", 
      "OfficeId"=>"20071029204441159539000000", 
      "Configuration"=>[{
        "IdxDisclaimer"=>""
      }], 
      "Id"=>"20101206154326670813000000", 
      "MlsId"=>"20000809145531659995000000", 
      "Office"=>"", 
      "Mls"=>"Fargo-Moorhead MLS"
    })
  end

  it "should respond to get" do
    SystemInfo.should respond_to(:get)
  end
  
  it "should have a primary_logo instance method" do
    @sysinfo.should respond_to(:primary_logo)
  end

  it "should respond to attributes" do
    ['Name','OfficeId','Id','MlsId','Office','Mls'].each do |k|
      (@sysinfo.send k.to_sym).should be_a(String)
    end
    @sysinfo.Configuration.should be_a(Array)
  end

  it "should have an array of config items" do
    @sysinfo.Configuration.should be_a(Array)
  end

  describe "#primary_logo" do
    before(:each) do
      @sysinfo_with_logos = SystemInfo.new({
        "Name"=>"Brandon  Reg1", 
        "OfficeId"=>"20080904154102121828000000", 
        "Configuration"=>[{
          "MlsLogos"=>[
            {"Uri"=>"http://images.dev.fbsdata.com/eup/20110406184939446866000000.jpg", "Name:"=>"logo and stuff"}, 
            {"Uri"=>"http://images.dev.fbsdata.com/eup/20110406191929838053000000.jpg", "Name:"=>"tried it"}
          ], 
          "IdxDisclaimer"=>"", 
          "IdxLogoSmall"=>"", 
          "IdxLogo"=>"http://images.dev.fbsdata.com/eup/20110406184939446866000000.jpg"
        }], 
        "Id"=>"20080904155327755059000000", 
        "MlsId"=>"20041217205818829687000000", 
        "Office"=>"Brandon Office1", 
        "Mls"=>"Eastern Upper Peninsula"
      })
    end 

    it "should return nil when no logo is present" do
      @sysinfo.primary_logo.should == nil
    end

    it "should return the first logo when several are present" do
      @sysinfo_with_logos.primary_logo.should be_a(Hash)
    end 
  end

  after(:each) do 
    @sysinfo = nil
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
flexmls_api-0.7.3 spec/unit/flexmls_api/models/system_info_spec.rb
flexmls_api-0.7.5 spec/unit/flexmls_api/models/system_info_spec.rb
flexmls_api-0.7.0 spec/unit/flexmls_api/models/system_info_spec.rb
flexmls_api-0.6.5 spec/unit/flexmls_api/models/system_info_spec.rb
flexmls_api-0.6.4 spec/unit/flexmls_api/models/system_info_spec.rb
flexmls_api-0.4.5 spec/unit/flexmls_api/models/system_info_spec.rb