Sha256: 4dd2d87a61ce52a036d37d3cdbd2ab772e8e0fba3ecd7ed2b579c593b3215aee

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 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})
    get(HashDealer.roll(:inactive_birthday_test_association_resource), :params => {:active => false, :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 => {:date => Date.today}
      }.matcher
    )
  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

  endpoint("/test_throughs/new") do
    get({})
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
api_resource-0.6.2 spec/support/mocks/association_mocks.rb
api_resource-0.6.1 spec/support/mocks/association_mocks.rb
api_resource-0.6.0 spec/support/mocks/association_mocks.rb
api_resource-0.5.1 spec/support/mocks/association_mocks.rb
api_resource-0.5.0 spec/support/mocks/association_mocks.rb