Skip to content

Instantly share code, notes, and snippets.

@jackcasey
jackcasey / paddock.rb
Created May 19, 2017 06:10 — forked from rio9791/paddock.rb
Paddock Equality
# In this example case when we create paddock objects we want them to be equal
# to each other if their name and area are the same and their lat/lng are "close
# enough" to each other. In our case we want "close enough" to mean the lat and
# lng match up to four decimal places.
#
# Download this file and the corresponding test case file tc_paddock.rb. Run the
# test case file like this `ruby tc_paddock.rb`. Currently all tests fail.
# Please make the changes you feel are necessary to make the tests pass, then
# make a gist with your version of paddock.rb and let us know.
### Keybase proof
I hereby claim:
* I am jackcasey on github.
* I am beetlefeet (https://keybase.io/beetlefeet) on keybase.
* I have a public key whose fingerprint is 69FA 9509 0442 9BC8 A800 4712 2C96 5EC9 C43C 511D
To claim this, I am signing this object:
module FancyPants
class User
def name
"Mr. #{self.lastname}"
end
end
class Company
def name
"#{super()} Est. #{self.created_at.year}"
end
@jackcasey
jackcasey / cukes
Created February 14, 2012 08:34
Some cucumber features
Feature: Trials api - Authentication
In order to display my information on the trials iPad app
As a Trial Assessor
I want to be able to authenticate with the web service
Background: # features/trialsapi_authentication.feature:6
Given there is a company # features/step_definitions/company_steps.rb:1
And there is a trial assessor # features/trialsapi_steps.rb:19
And I accept JSON # features/trialsapi_steps.rb:15
@jackcasey
jackcasey / hashin
Created February 10, 2012 06:32
hashin
{
"inputs(c76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityInput/p609)__position"=>
"0",
"pests(c76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityPest/p328)__position"=>
"1",
"started_at"=>"0",
"inputs(c76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityInput/p609)__rate"=>
"4",
"inputs(c76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityInput/p613)__unit_cost"=>
"8",
@jackcasey
jackcasey / hashbad
Created February 10, 2012 06:32
hashbad
{
"pests" => [
{
"coverage" => "0",
"position" => "1",
"coreDataID" => "76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityPest/p328",
"pest_id" => "3"
},
{
"coverage" => "0",
@jackcasey
jackcasey / hashexpected
Created February 10, 2012 06:32
hashexpected
{
"pests" => [
{
"coverage" => "0",
"position" => "0",
"coreDataID" => "76A09CC2-AD2F-4223-8F0E-EB4E66339BEF/ActivityPest/p326",
"pest_id" => "1274"
},
{
"coverage" => "0",