Sha256: 9df977c3f95af22a490a2fa811e087a248fdfb827677d1bf7698305ce05876b6

Contents?: true

Size: 1.53 KB

Versions: 15

Compression:

Stored size: 1.53 KB

Contents

include ApiResource

Mocks.define do
  
  endpoint('/single_object_association') do
    get(HashDealer.roll(:test_association_resource), :params => {})
    get(HashDealer.roll(:active_test_association_resource), :params => {:active => true})
    get(HashDealer.roll(:active_birthday_test_association_resource), :params => {:active => true, :birthday => true})
  end

  endpoint("/mock_with_block/:id") do
    get({:abc => 123}, {:params => {:test => "123"}.matcher}) do |params|
      self[:test] = params[:test]
      self[:id] = params[:id]
      self
    end
  end

  endpoint('/multi_object_association') do
    get((0..4).to_a.collect{HashDealer.roll(:test_association_resource)}, :params => {})
    get((0..4).to_a.collect{HashDealer.roll(:active_test_association_resource)}, :params => {:active => true})
    get((0..4).to_a.collect{HashDealer.roll(:active_test_association_resource)}, :params => {:active => false})
    get((0..4).to_a.collect{HashDealer.roll(:active_birthday_test_association_resource)}, :params => {:active => true, :birthday => true})
  end

  endpoint("/has_one_objects/new") do
    get({
      "attributes" => {
        "public" => ["size", "color"]
      }
    })
  end
  
  endpoint("/has_many_objects/new") do
    get({
      "attributes" => {
        "public" => ["name"]
      }
    })
  end
  
  endpoint("/belongs_to_objects/new") do
    get({})
  end
  
  endpoint("/test_associations/new") do
    get({})
  end
  
  endpoint("/inner_classes/new") do
    get({})
  end
  
  endpoint("/childern/new") do
    get({})
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
api_resource-0.3.12 spec/support/mocks/association_mocks.rb
api_resource-0.3.11 spec/support/mocks/association_mocks.rb
api_resource-0.3.10 spec/support/mocks/association_mocks.rb
api_resource-0.3.8 spec/support/mocks/association_mocks.rb
api_resource-0.3.7 spec/support/mocks/association_mocks.rb
api_resource-0.3.6 spec/support/mocks/association_mocks.rb
api_resource-0.3.5 spec/support/mocks/association_mocks.rb
api_resource-0.3.4 spec/support/mocks/association_mocks.rb
api_resource-0.3.3 spec/support/mocks/association_mocks.rb
api_resource-0.3.2 spec/support/mocks/association_mocks.rb
api_resource-0.3.1 spec/support/mocks/association_mocks.rb
api_resource-0.3.0 spec/support/mocks/association_mocks.rb
api_resource-0.2.11 spec/support/mocks/association_mocks.rb
api_resource-0.2.10 spec/support/mocks/association_mocks.rb
api_resource-0.2.9 spec/support/mocks/association_mocks.rb