pokey 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 902eedd7df7d24c0ba7371ab75ed91dc59d1bf3f
4
+ data.tar.gz: 153fd390ac187d01c62b426bdda0c360925aa6f7
5
+ SHA512:
6
+ metadata.gz: 81d59aeed034302148895a9c828ec20c4958bf7316db5568a88c4baf8ce250fb98cb23022459f85c639f30b7736f714a2700aafdccfc370753d221eb420c647d
7
+ data.tar.gz: b93105e18878dc227d46cb478f8f60775373f041aac5afb66ca270a6be01bb8473d174134607a952e2d79b0a89d00e1117491cf090a89237c63ae07e04f43ecb
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ pokey
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pokey.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Chuck Callebs
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # Pokey
2
+
3
+ Pokey is a Ruby gem designed to easily simulate webhooks / other HTTP requests common
4
+ to a production environment.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'pokey'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install pokey
21
+
22
+ ## Usage
23
+
24
+ Create a new file in your initializers directory named `pokey.rb`. Here
25
+ is where you'll be defining your API calls.
26
+
27
+ ``` RUBY
28
+ Pokey.configure do |config|
29
+ config.add_hook do |hook|
30
+ hook.destination = "/my/webhook/endpoint"
31
+ hook.data = {
32
+ name: "Test endpoint",
33
+ endpoint_id: 1
34
+ }
35
+ end
36
+
37
+ Pokey::Scheduler.commit! # This isn't necessary in the config block
38
+ # but is a decent enough place to put it. This
39
+ # signifies that all endpoints have been added
40
+ # and Rufus will begin to schedule hooks.
41
+ end
42
+ ```
43
+
44
+ In addition, you can also define classes inside a designated directory to
45
+ streamline creation of Pokey events.
46
+
47
+ ``` RUBY
48
+ # initializers/pokey.rb
49
+ Pokey.configure do |config|
50
+ config.hook_dir = "app/pokey" # Defaults to app/pokey
51
+ end
52
+
53
+ # app/pokey/sendgrid_event_hook.rb
54
+ class SendgridEventHook < Pokey::Hook
55
+ def destination
56
+ if Rails.env.development?
57
+ "http://localhost:3000/api/sendgrid/events"
58
+ elsif Rails.env.qa?
59
+ "http://our-qa-environment.domain.com/api/sendgrid/events"
60
+ end
61
+ end
62
+
63
+ def data
64
+ {
65
+ name: event,
66
+ email: email,
67
+ category: category,
68
+ useragent: user_agent,
69
+ ip: ip_address,
70
+ stmp_id: stmp_id
71
+ }
72
+ end
73
+
74
+ def http_method
75
+ :post
76
+ end
77
+
78
+ def interval
79
+ 5
80
+ end
81
+
82
+ protected
83
+
84
+ def stmp_id
85
+ "<54d39f028d4ab_#{Random.rand(200000)}@web3.mail>"
86
+ end
87
+
88
+ def ip_address
89
+ "192.168.0.#{Random.rand(255)}"
90
+ end
91
+
92
+ def user_agent
93
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"
94
+ end
95
+
96
+ def category
97
+ [
98
+ ["User", "Welcome Email"],
99
+ ["User", "Forgot Password"]
100
+ ].sample
101
+ end
102
+
103
+ def event
104
+ ['delivered', 'open', 'click'].sample
105
+ end
106
+
107
+ def email
108
+ "autogen-#{Random.rand(200)}@domain.com"
109
+ end
110
+ end
111
+ ```
112
+
113
+ As your data will inevitably get more complex to simulate actual events,
114
+ Pokey::Hook sub-classes are the preferred way to declare endpoints.
115
+
116
+
117
+ ## Contributing
118
+
119
+ 1. Fork it ( https://github.com/ccallebs/pokey/fork )
120
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
121
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
122
+ 4. Push to the branch (`git push origin my-new-feature`)
123
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/lib/pokey.rb ADDED
@@ -0,0 +1,28 @@
1
+ require "pokey/version"
2
+ require "pokey/configuration"
3
+ require "pokey/hook"
4
+ require "pokey/hooks"
5
+ require "pokey/request"
6
+ require "pokey/scheduler"
7
+
8
+ module Pokey
9
+ class << self
10
+ attr_writer :configuration
11
+
12
+ def configure
13
+ yield(configuration)
14
+ end
15
+
16
+ def configuration
17
+ @configuration ||= Pokey::Configuration.new
18
+ end
19
+
20
+ def hook_dir=(val)
21
+ configuration.hook_dir = val
22
+ end
23
+
24
+ def hook_dir
25
+ configuration.hook_dir
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,12 @@
1
+ class Pokey::Configuration
2
+ attr_accessor :hook_dir, :hooks
3
+
4
+ def initialize
5
+ @hook_dir = "app/pokey"
6
+ @hooks = []
7
+ end
8
+
9
+ def add_hook(&block)
10
+ Pokey::Hooks.add(&block)
11
+ end
12
+ end
@@ -0,0 +1,35 @@
1
+ module Helpers
2
+ class Inflector
3
+ # File activesupport/lib/active_support/inflector/methods.rb, line 249
4
+ def self.constantize(camel_cased_word)
5
+ names = camel_cased_word.split('::')
6
+
7
+ # Trigger a built-in NameError exception including the ill-formed constant in the message.
8
+ Object.const_get(camel_cased_word) if names.empty?
9
+
10
+ # Remove the first blank element in case of '::ClassName' notation.
11
+ names.shift if names.size > 1 && names.first.empty?
12
+
13
+ names.inject(Object) do |constant, name|
14
+ if constant == Object
15
+ constant.const_get(name)
16
+ else
17
+ candidate = constant.const_get(name)
18
+ next candidate if constant.const_defined?(name, false)
19
+ next candidate unless Object.const_defined?(name)
20
+
21
+ # Go down the ancestors to check if it is owned directly. The check
22
+ # stops when we reach Object or the end of ancestors tree.
23
+ constant = constant.ancestors.inject do |const, ancestor|
24
+ break const if ancestor == Object
25
+ break ancestor if ancestor.const_defined?(name, false)
26
+ const
27
+ end
28
+
29
+ # owner is in Object, so raise
30
+ constant.const_get(name, false)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
data/lib/pokey/hook.rb ADDED
@@ -0,0 +1,7 @@
1
+ class Pokey::Hook
2
+ attr_accessor :destination, :http_method, :data, :interval
3
+
4
+ def make_http_request!
5
+ Pokey::Request.make!(destination, http_method, data)
6
+ end
7
+ end
@@ -0,0 +1,48 @@
1
+ require 'pokey/helpers/inflector'
2
+
3
+ class Pokey::Hooks
4
+ @@hooks = []
5
+
6
+ def self.clear!
7
+ @@hooks = []
8
+ end
9
+
10
+ def self.all
11
+ @@hooks
12
+ end
13
+
14
+ def self.count
15
+ @@hooks.length
16
+ end
17
+
18
+ def self.add(&block)
19
+ hook = Pokey::Hook.new
20
+ block.call(hook)
21
+ @@hooks << hook
22
+ end
23
+
24
+ def self.add_from_class(klass)
25
+ return unless klass
26
+ @@hooks << klass.new
27
+ end
28
+
29
+ def self.add_from_file(file_path)
30
+ require file_path
31
+
32
+ base_name = File.basename(file_path, ".rb")
33
+ klass = Helpers::Inflector.constantize(base_name.split('_').collect(&:capitalize).join)
34
+ add_from_class(klass)
35
+ end
36
+
37
+ def self.add_from_dir(directory)
38
+ directory += "/" if directory[-1] != "/"
39
+
40
+ Dir.glob("#{directory}*.rb").map(&File.method(:realpath)).each do |file_path|
41
+ require file_path
42
+
43
+ base_name = File.basename(file_path, ".rb")
44
+ klass = Helpers::Inflector.constantize(base_name.split('_').collect(&:capitalize).join)
45
+ add_from_class(klass)
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,59 @@
1
+ # Handles making the request to the webhook destination
2
+
3
+ require 'net/http'
4
+
5
+ class Pokey::Request
6
+ attr_accessor :destination, :http_method, :data
7
+
8
+ def initialize(destination, http_method = :post, data = {})
9
+ @destination, @http_method, @data = destination, http_method, data
10
+ end
11
+
12
+ def raw_request
13
+ http_object
14
+ end
15
+
16
+ def make!
17
+ Net::HTTP.start(uri.host, uri.port) do |http|
18
+ request = raw_request
19
+
20
+ if request.is_a?(Net::HTTP::Post)
21
+ request.set_form_data(@data)
22
+ end
23
+
24
+ response = http.request(request)
25
+ end
26
+ end
27
+
28
+ def uri
29
+ raw_uri = URI.parse(@destination)
30
+
31
+ if @http_method == :get
32
+ raw_uri.query = URI.encode_www_form(@data)
33
+ end
34
+
35
+ raw_uri
36
+ end
37
+
38
+ def self.make!(destination, http_method, data)
39
+ request = Pokey::Request.new(destination, http_method, data)
40
+ request.make!
41
+ request
42
+ end
43
+
44
+ private
45
+
46
+ def http_object
47
+ @http_object ||= begin
48
+ if @http_method == :get
49
+ Net::HTTP::Get.new(uri)
50
+ elsif @http_method == :post
51
+ Net::HTTP::Post.new(uri)
52
+ else
53
+ raise UnknownHTTPObjectError
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ class UnknownHTTPObjectError < Exception; end;
@@ -0,0 +1,19 @@
1
+ require "rufus-scheduler"
2
+
3
+ class Pokey::Scheduler
4
+ def rufus
5
+ @rufus ||= Rufus::Scheduler.new
6
+ end
7
+
8
+ def self.commit!
9
+ scheduler = new
10
+
11
+ Pokey::Hooks.add_from_dir(Pokey.hook_dir)
12
+
13
+ Pokey::Hooks.all.each do |hook|
14
+ scheduler.rufus.every "#{hook.interval}s" do
15
+ hook.make_http_request!
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Pokey
2
+ VERSION = "0.1.0".freeze
3
+ end
data/pokey.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ require './lib/pokey/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "pokey"
5
+ spec.version = Pokey::VERSION.dup
6
+ spec.authors = ["Chuck Callebs"]
7
+ spec.email = ["chuck@callebs.io"]
8
+ spec.summary = %q{Automatically create HTTP requests in the background.}
9
+ spec.description = %q{Automatically create HTTP requests in the background. You can use
10
+ Pokey to simulate production webhooks on QA/development environments.}
11
+ spec.homepage = "https://github.com/ccallebs/pokey"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0")
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+
18
+ spec.add_runtime_dependency 'rufus-scheduler', '~> 3.1.2'
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.7"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rspec", "~> 3.2"
23
+ spec.add_development_dependency "pry"
24
+ spec.add_development_dependency "webmock"
25
+ end
@@ -0,0 +1,38 @@
1
+ require "./lib/pokey"
2
+
3
+ describe Pokey do
4
+ describe "#configure" do
5
+ describe "#hook_dir" do
6
+ it "defaults to app/pokey" do
7
+ Pokey.configure do |config|
8
+ end
9
+
10
+ expect(Pokey.hook_dir).to eq("app/pokey")
11
+ end
12
+ end
13
+
14
+ describe "#hook_dir=" do
15
+ it "sets value of #hook_dir successfully" do
16
+ Pokey.configure do |config|
17
+ config.hook_dir = "app/new_hook_dir"
18
+ end
19
+
20
+ expect(Pokey.hook_dir).to eq("app/new_hook_dir")
21
+ end
22
+ end
23
+
24
+ describe "#add_hook" do
25
+ it "increases hook count by 1" do
26
+ expect {
27
+ Pokey.configure do |config|
28
+ config.add_hook do |hook|
29
+ hook.destination = "/endpoint"
30
+ hook.data = {}
31
+ hook.interval = 3600
32
+ end
33
+ end
34
+ }.to change { Pokey::Hooks.count }.by(1)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
1
+ require './lib/pokey'
2
+
3
+ RSpec.describe Pokey::Hook do
4
+ subject { Pokey::Hook.new }
5
+
6
+ context "when subclassed" do
7
+ subject do
8
+ class TestHook < Pokey::Hook
9
+ def destination
10
+ "/test/hook"
11
+ end
12
+
13
+ def http_method
14
+ :post
15
+ end
16
+
17
+ def data
18
+ {
19
+ name: "Test Hook",
20
+ id: 1
21
+ }
22
+ end
23
+ end
24
+
25
+ TestHook.new
26
+ end
27
+
28
+ context '#make_http_request!' do
29
+ it 'attempts to make an http request' do
30
+ expect(Pokey::Request).to receive(:make!)
31
+ subject.make_http_request!
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -0,0 +1,64 @@
1
+ require './lib/pokey/hook'
2
+ require './lib/pokey/hooks'
3
+
4
+ RSpec.describe Pokey::Hooks do
5
+ before do
6
+ Pokey::Hooks.clear!
7
+ end
8
+
9
+ describe '.add' do
10
+ subject do
11
+ Pokey::Hooks.add do |hook|
12
+ hook.destination = "http://test.com/destination"
13
+ hook.data = {
14
+ name: "Test",
15
+ id: 1
16
+ }
17
+ hook.interval = 3600
18
+ end
19
+ end
20
+
21
+ it 'succesfully adds hook to list' do
22
+ expect { subject }.to change { Pokey::Hooks.all.length }.by(1)
23
+ end
24
+
25
+ it 'successfully retains hook data' do
26
+ subject
27
+ hook = Pokey::Hooks.all.first
28
+ expect(hook.destination).to eq("http://test.com/destination")
29
+ expect(hook.data).to eq({ name: "Test", id: 1 })
30
+ expect(hook.interval).to eq(3600)
31
+ end
32
+ end
33
+
34
+ describe '.add_from_file' do
35
+ let(:file) { './spec/pokey/sample_hooks/sample_hook.rb' }
36
+
37
+ let(:subject) do
38
+ Pokey::Hooks.add_from_file(file)
39
+ end
40
+
41
+ it 'successfully adds hook to list' do
42
+ expect { subject }.to change { Pokey::Hooks.all.length }.by(1)
43
+ end
44
+ end
45
+
46
+ describe '.add_from_dir' do
47
+ let(:dir) { './spec/pokey/sample_hooks/' }
48
+
49
+ let(:subject) do
50
+ Pokey::Hooks.add_from_dir(dir)
51
+ end
52
+
53
+ it 'has multiple files in the directory' do
54
+ expect(Dir.entries(dir).size).to be > 1
55
+ end
56
+
57
+ it 'successfully adds multiple hooks' do
58
+ Pokey::Hooks.clear!
59
+ count = Dir.entries(dir).size - 2
60
+ subject
61
+ expect(Pokey::Hooks.all.length).to eq(count)
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,55 @@
1
+ require './lib/pokey/request'
2
+
3
+ RSpec.describe Pokey::Request do
4
+ let(:destination) { "http://test.com/test/endpoint" }
5
+ let(:http_method) { :post }
6
+ let(:data) { { name: "Test Endpoint", id: 1 } }
7
+
8
+ describe 'defaults' do
9
+ subject { Pokey::Request.new(destination) }
10
+
11
+ it 'defaults http_method to post' do
12
+ expect(subject.http_method).to eq(:post)
13
+ end
14
+
15
+ it 'defaults data to {}' do
16
+ expect(subject.data).to eq({})
17
+ end
18
+ end
19
+
20
+ describe "#make!" do
21
+ subject { Pokey::Request.make!(destination, http_method, data) }
22
+
23
+ context 'when :post' do
24
+ before(:each) do
25
+ stub_request(:post, destination)
26
+ end
27
+
28
+ it "successfully makes http request" do
29
+ expect(Net::HTTP::Post).to receive(:new)
30
+ expect_any_instance_of(Net::HTTP).to receive(:request)
31
+ subject
32
+ end
33
+
34
+ it "passes params along with it" do
35
+ expect_any_instance_of(Net::HTTP::Post).to receive(:set_form_data).with(data)
36
+ subject
37
+ end
38
+ end
39
+
40
+ context 'when :get' do
41
+ let(:http_method) { :get }
42
+
43
+ it "successfully makes http request" do
44
+ expect(Net::HTTP::Get).to receive(:new)
45
+ expect_any_instance_of(Net::HTTP).to receive(:request)
46
+ subject
47
+ end
48
+
49
+ it "passes params in the uri" do
50
+ request = Pokey::Request.new(destination, http_method, data)
51
+ expect(request.uri.to_s.length).to be > destination.length
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,17 @@
1
+ class AnotherSampleHook < Pokey::Hook
2
+ def destination
3
+ "http://www.another.com/sample/hook"
4
+ end
5
+
6
+ def interval
7
+ 2400
8
+ end
9
+
10
+ def data
11
+ {
12
+ name: "Another Sample Hook",
13
+ id: 2,
14
+ description: "George Bluth approves."
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ class SampleHook < Pokey::Hook
2
+ def destination
3
+ "http://test.com/sample/hook"
4
+ end
5
+
6
+ def interval
7
+ 7200
8
+ end
9
+
10
+ def data
11
+ {
12
+ name: "Sample hook",
13
+ id: 1
14
+ }
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ require './lib/pokey'
2
+
3
+ RSpec.describe Pokey::Scheduler do
4
+ before do
5
+ Pokey.add_hook do |hook|
6
+ hook.destination = "/my/webhook/endpoint"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,99 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19
+
20
+ require 'webmock/rspec'
21
+
22
+ # Disable all requests
23
+ WebMock.disable_net_connect!(allow_localhost: false)
24
+
25
+ require 'pry'
26
+
27
+ RSpec.configure do |config|
28
+ # rspec-expectations config goes here. You can use an alternate
29
+ # assertion/expectation library such as wrong or the stdlib/minitest
30
+ # assertions if you prefer.
31
+ config.expect_with :rspec do |expectations|
32
+ # This option will default to `true` in RSpec 4. It makes the `description`
33
+ # and `failure_message` of custom matchers include text for helper methods
34
+ # defined using `chain`, e.g.:
35
+ # be_bigger_than(2).and_smaller_than(4).description
36
+ # # => "be bigger than 2 and smaller than 4"
37
+ # ...rather than:
38
+ # # => "be bigger than 2"
39
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
40
+ end
41
+
42
+ # rspec-mocks config goes here. You can use an alternate test double
43
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
44
+ config.mock_with :rspec do |mocks|
45
+ # Prevents you from mocking or stubbing a method that does not exist on
46
+ # a real object. This is generally recommended, and will default to
47
+ # `true` in RSpec 4.
48
+ mocks.verify_partial_doubles = true
49
+ end
50
+
51
+ # The settings below are suggested to provide a good initial experience
52
+ # with RSpec, but feel free to customize to your heart's content.
53
+ =begin
54
+ # These two settings work together to allow you to limit a spec run
55
+ # to individual examples or groups you care about by tagging them with
56
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
57
+ # get run.
58
+ config.filter_run :focus
59
+ config.run_all_when_everything_filtered = true
60
+
61
+ # Limits the available syntax to the non-monkey patched syntax that is
62
+ # recommended. For more details, see:
63
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
64
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
65
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
66
+ config.disable_monkey_patching!
67
+
68
+ # This setting enables warnings. It's recommended, but in some cases may
69
+ # be too noisy due to issues in dependencies.
70
+ config.warnings = true
71
+
72
+ # Many RSpec users commonly either run the entire suite or an individual
73
+ # file, and it's useful to allow more verbose output when running an
74
+ # individual spec file.
75
+ if config.files_to_run.one?
76
+ # Use the documentation formatter for detailed output,
77
+ # unless a formatter has already been configured
78
+ # (e.g. via a command-line flag).
79
+ config.default_formatter = 'doc'
80
+ end
81
+
82
+ # Print the 10 slowest examples and example groups at the
83
+ # end of the spec run, to help surface which specs are running
84
+ # particularly slow.
85
+ config.profile_examples = 10
86
+
87
+ # Run specs in random order to surface order dependencies. If you find an
88
+ # order dependency and want to debug it, you can fix the order by providing
89
+ # the seed, which is printed after each run.
90
+ # --seed 1234
91
+ config.order = :random
92
+
93
+ # Seed global randomization in this process using the `--seed` CLI option.
94
+ # Setting this allows you to use `--seed` to deterministically reproduce
95
+ # test failures related to randomization by passing the same `--seed` value
96
+ # as the one that triggered the failure.
97
+ Kernel.srand config.seed
98
+ =end
99
+ end
metadata ADDED
@@ -0,0 +1,163 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pokey
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chuck Callebs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rufus-scheduler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.1.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.1.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: |-
98
+ Automatically create HTTP requests in the background. You can use
99
+ Pokey to simulate production webhooks on QA/development environments.
100
+ email:
101
+ - chuck@callebs.io
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files: []
105
+ files:
106
+ - ".gitignore"
107
+ - ".rspec"
108
+ - ".ruby-gemset"
109
+ - ".ruby-version"
110
+ - Gemfile
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - lib/pokey.rb
115
+ - lib/pokey/configuration.rb
116
+ - lib/pokey/helpers/inflector.rb
117
+ - lib/pokey/hook.rb
118
+ - lib/pokey/hooks.rb
119
+ - lib/pokey/request.rb
120
+ - lib/pokey/scheduler.rb
121
+ - lib/pokey/version.rb
122
+ - pokey.gemspec
123
+ - spec/pokey/configure_spec.rb
124
+ - spec/pokey/hook_spec.rb
125
+ - spec/pokey/hooks_spec.rb
126
+ - spec/pokey/request_spec.rb
127
+ - spec/pokey/sample_hooks/another_sample_hook.rb
128
+ - spec/pokey/sample_hooks/sample_hook.rb
129
+ - spec/pokey/scheduler_spec.rb
130
+ - spec/spec_helper.rb
131
+ homepage: https://github.com/ccallebs/pokey
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.4.8
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Automatically create HTTP requests in the background.
155
+ test_files:
156
+ - spec/pokey/configure_spec.rb
157
+ - spec/pokey/hook_spec.rb
158
+ - spec/pokey/hooks_spec.rb
159
+ - spec/pokey/request_spec.rb
160
+ - spec/pokey/sample_hooks/another_sample_hook.rb
161
+ - spec/pokey/sample_hooks/sample_hook.rb
162
+ - spec/pokey/scheduler_spec.rb
163
+ - spec/spec_helper.rb