Skip to content

Commit

Permalink
Write feature tests for handling unsigned stripe events (#74)
Browse files Browse the repository at this point in the history
See: #66

This is just a small step, and doesn't include the actual implementation
but it gives us a seam to move forward with and generate user-facing
feature documentation from.
  • Loading branch information
zspencer authored Jun 1, 2020
1 parent c1afca3 commit 18049ea
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 0 deletions.
29 changes: 29 additions & 0 deletions compensated-ruby/bin/cucumber
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'cucumber' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("cucumber", "cucumber")
3 changes: 3 additions & 0 deletions compensated-ruby/bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ set -vx

# Run RSpec
bin/rspec

# Run Cucumber
bin/cucumber
1 change: 1 addition & 0 deletions compensated-ruby/compensated.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rack"
spec.add_development_dependency "cucumber"
spec.add_development_dependency "yard"
end
17 changes: 17 additions & 0 deletions compensated-ruby/features/handling-stripe-events.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@stripe @event-handling
Feature: Handling Stripe Events
In order to give my clients value because they paid me
As a Client Developer
I would like to be able to handle stripe events

@future @security
Scenario: Event handler rejects Unsigned Stripe Webhook Events
Given Compensated is configured to reject unsigned Stripe Events
When an Unsigned Stripe Event is request is passed into the Compensated::RequestHandler
Then the Request Handler raises a Compensated::UnsignedEventError when transforming the event data

@future @security
Scenario: Event handler accepts Unsigned Stripe Webhook Events
Given Compensated is configured to accept unsigned Stripe Events
When an Unsigned Stripe Event is request is passed into the Compensated::RequestHandler
Then the Request Handler transforms the event data
21 changes: 21 additions & 0 deletions compensated-ruby/features/steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

Given("Compensated is configured to reject unsigned Stripe Events") do
pending # Write code here that turns the phrase above into concrete actions
end

Given("Compensated is configured to accept unsigned Stripe Events") do
pending # Write code here that turns the phrase above into concrete actions
end


When("an Unsigned Stripe Event is request is passed into the Compensated::RequestHandler") do
pending # Write code here that turns the phrase above into concrete actions
end

Then("the Request Handler raises a Compensated::UnsignedEventError when transforming the event data") do
pending # Write code here that turns the phrase above into concrete actions
end

Then("the Request Handler transforms the event data") do
pending # Write code here that turns the phrase above into concrete actions
end

0 comments on commit 18049ea

Please sign in to comment.