lib/service_contract/mock.rb
# generates fake data that adheres to the types defined in the service contract
generates fake data that adheres to the types defined in the service contract
generates fake data that adheres to the types defined in the service contract
def mock_fields(type)
        {}.tap do |res|
          type.fields.each do |parameter|
            if customizations.key?(parameter.name)
              res[parameter.name] = customizations[parameter.name].call
            else
              res[parameter.name] = mock_value(parameter.type)
            end
          end
        end
      end
def mock_fields ( type ) { } . tap do | res | type . fields . each do | parameter | if customizations . key? ( parameter . name ) res [ parameter . name ] = customizations [ parameter . name ] . call else res [ parameter . name ] = mock_value ( parameter . type ) end end end end
generates fake data that adheres to the types defined in the service contract
generates fake data that adheres to the types defined in the service contract
type
<not_specific>