Sha256: ce478a982e303f658ef907430a29d3a6d5390737fb9f98766b35f1d09be9ba6c

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 Bytes

Contents

require 'pathname'
require 'json'

module FixturesHelper

  def webhook_examples_path
    Pathname.new(File.dirname(__FILE__)).join('..','fixtures','webhook_examples')
  end

  # Returns the JSON representation of an array of +sample_name+ events
  def webhook_example_events(sample_name)
    sample_path = webhook_examples_path.join("#{sample_name}.json")
    JSON.parse(sample_path.read)
  end

  # Returns the JSON representation of an +sample_name+ event
  def webhook_example_event(sample_name)
    webhook_example_events(sample_name).first
  end

  def payload_examples_path
    Pathname.new(File.dirname(__FILE__)).join('..','fixtures','payload_examples')
  end

  # Returns the content of +sample_name+ payload example filename
  def payload_example(sample_name)
    payload_examples_path.join(sample_name).read
  end


end


RSpec.configure do |conf|
  conf.include FixturesHelper
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mandrill-rails-0.0.4 spec/support/fixtures_helper.rb
mandrill-rails-0.0.3 spec/support/fixtures_helper.rb