Skip to content

Instantly share code, notes, and snippets.

Intermittently coding

Beth Skurrie bethesque

Intermittently coding
Block or report user

Report or block bethesque

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bethesque / gist:9385794
Created Mar 6, 2014
Naming conventions in Ruby
View gist:9385794
def method_names_are_like_this
module Things
class UserThing
bethesque / gist:69ae590e8312523e5337
Last active Aug 29, 2015
Thoughts on verifying that mocked models are actually valid
View gist:69ae590e8312523e5337

It's about ensuring the model used to stub client responses can actually be produced by the response you expect. Imagine your client returns a model like so:

class MyModel
   attr_reader :timestamp
   def initialize attrs
      @timestamp = attr[:timestamp]
bethesque / preload-interactions.rb
Last active Aug 29, 2015
Server with preloaded interactions
View preload-interactions.rb
# $ pact service -p 8080
# (new window)
# $ ruby preload-interactions.rb
# $ curl localhost:8080/path_one #Yay all good!
# $ curl localhost:8080/path_two #Boo... which response do we want???
require 'json'
require 'net/http'
require 'pact/consumer/consumer_contract_builder'
require 'pact/consumer_contract'
bethesque / idea.rb
Last active Aug 29, 2015
Using pact for Capybara tests and unit tests
View idea.rb
class InternalProviderClient
def thing
#get a thing from the internal provider
# pact_helper
Pact.configure do | config |
config.pactfile_write_mode = :update
bethesque /
Last active Aug 29, 2015
Idea for FixturePact

Pact is great for HTTP microservices that communicate directly with each other, but many services use an intermediate system that acts as a pipe (eg. a queue, S3 bucket). The agreement about the format of the message is really between the two ends of the chain, not between the links immediatly adjacent.

The pact concept should be able to be applied to non-http services. The code below is an attempt to come up with a DSL for a new pact library that uses the same pact matching concepts, but does not constrain the communication protocol.

Thoughts/improvements appreciated, but remember Gists do not send notifications when you post a comment :|

bethesque /
Last active Aug 29, 2015
A quick start guide to Webmachine


  • Override resource_exists?, content_types_provided, allowed_methods, and implement the method to render the resource.
class OrderResource < Webmachine::Resource
  def allowed_methods
  def content_types_provided
bethesque / example.rb
Created Oct 9, 2014
How to do a multipart updatable date with Reform
View example.rb
require 'date'
class Applicant
attr_accessor :date
applicant = =, 10, 13)
require 'reform'
bethesque / document.rb
Last active Aug 29, 2015
Pact Broker document
View document.rb do | pacticipant |
pacticipant.repository git: ''
pacticipant.doc ''
bethesque / echoHttpRequest.js
Last active Aug 29, 2015 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
View echoHttpRequest.js
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
You can’t perform that action at this time.