Sha256: ccc3f4e190077f843a6237dd1b6d4c4c9cb7fa3172ed81e32d8e5dd40b9a8648

Contents?: true

Size: 1.9 KB

Versions: 17

Compression:

Stored size: 1.9 KB

Contents

require './spec/spec_helper'

describe Fields do
  before(:each) do
    stub_auth_request
  end

  context "/fields/order", :support do
    on_get_it "should find field orders for all property types" do
      Fields.should respond_to(:order)

      # stub request
      stub_api_get('/fields/order','fields/order.json')

      # request
      resources = subject.class.order

      # a standard array of results
      resources.should be_an(Array)
      resources.length.should eq(1)

      # make sure multiple property types are present
      resources.first.should have_key("A")
      resources.first.should have_key("B")

      resources.first["A"].should be_an(Array)
    end
  end

  context "/fields/order/<property_type>", :support do
    on_get_it "should find field order for a single property type" do
      Fields.should respond_to(:order)

      # stub request
      stub_api_get('/fields/order/A','fields/order_a.json')

      # request
      resources = subject.class.order("A")

      # a standard array of results
      resources.should be_an(Array)
      resources.length.should eq(2)

      # validate a single entity
      group = resources.first[resources.first.keys.first]
      group.should be_an(Array)
      group.length.should eq(2)
      group.each do |field|
        field.should have_key("Field")
      end

    end
  end

  context "/fields/order/settings", :support do
    on_get_it "returns the field order settings" do
      Fields.should respond_to(:settings)

      # stub request
      stub_api_get('/fields/order/settings','fields/settings.json')

      # request
      settings = subject.class.settings

      # a standard array of results
      settings.should be_an(Array)
      settings.length.should eq(1)

      # make sure ShowingInstructions is present
      settings.first.should have_key("ShowingInstructions")
      settings.first["ShowingInstructions"].should be_an(Array)
    end
  end


end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
spark_api-1.4.34 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.32 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.31 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.29 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.28 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.27 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.26 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.25 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.24 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.23 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.22 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.21 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.20 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.19 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.18 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.17 spec/unit/spark_api/models/fields_spec.rb
spark_api-1.4.16 spec/unit/spark_api/models/fields_spec.rb