stockpot 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f43eafb8e8824ae2cf552f540571255bade39ecb1f4d69f0aa488e549c281217
4
+ data.tar.gz: cf93e96b363e17f00ba7eaf3179c101c9e0a225041dae149fcaf714b800d62a0
5
+ SHA512:
6
+ metadata.gz: 024bb18e47254d64292ec41baaf89e5a8b1b4e04c454d219336689ef4acbca21c9faf086e8a3031a3693df51da22b62a5a9cb04807dff24cdbb145bdd340bb67
7
+ data.tar.gz: 2f078327627c946c854bfad1271ffb46167ba93032ab856e8f72e3d054196014f92ad681e1c268943c4dfcf2915077f66551cee1f5c6ee8f171d4eadb3c1cd10
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Jayson Smith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # Stockpot
2
+
3
+ `Stockpot` makes setting up test data in your Rails database from an external resource easier.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/stockpot.svg)](https://badge.fury.io/rb/stockpot)
6
+ <!-- [![Build Status](https://semaphoreci.com/api/v1/freshly/stockpot/branches/master/badge.svg)](https://semaphoreci.com/freshly/stockpot)
7
+ [![Maintainability](TODO)](https://codeclimate.com/github/Freshly/stockpot/maintainability)
8
+ [![Test Coverage](TODO)](https://codeclimate.com/github/Freshly/stockpot/test_coverage) -->
9
+
10
+ `Stockpot` gives you an easy way to expose a number of end points from your app, enabling CRUD actions that you can utilize from things like a standalone test suite to set up state. For instance, rather than going through the entirety of a new user creation flow just to check that users can update their data once registered, simply make a POST call to `/stockpot/database_management` with your dummy user's data, shortcutting that unnecessary setup and enabling you to go to directly checking the system behavior needed.
11
+
12
+ Use it in your external Cypress or Cucumber tests, set up a webpage to allow manual testers to set up and get state with an interface fronting the API, etc.
13
+
14
+ Why the name `Stockpot`? Keeping with Freshly's food related naming, a [stockpot](https://en.wikipedia.org/wiki/Stock_pot) is one of the most common types of cooking pots worldwide, and a stockpot is traditionally use to make stock or broth which can be the basis for cooking more complex recipes. You put ingredients in, do some cooking, and take out a finished product. For this project, think of your database as being the stockpot, putting in test data, doing some action in the system under test, and then pulling out data to use in your assertions of your system's behavior.
15
+
16
+ ### Version 0.1.x Notes
17
+
18
+ Initial development notes: Stockpot is very much a work in progress. The initial implementation is _mostly_ an abstraction of Freshly's current usage of controllers to allow our external Cypress test project to interact with our Rails app's database. The current pie in the sky plan is to genericize things more so that different tools can be used and allow folk's more configuration options.
19
+
20
+ * [Installation](#installation)
21
+ * [Usage](#usage)
22
+ * [Development](#development)
23
+ * [Contributing](#contributing)
24
+ * [License](#license)
25
+
26
+ ## Installation
27
+
28
+ Add this line to your application's Gemfile:
29
+
30
+ ```ruby
31
+ gem 'stockpot'
32
+ ```
33
+
34
+ And then execute:
35
+
36
+ ```bash
37
+ bundle
38
+ ```
39
+
40
+ Or install it yourself as:
41
+
42
+ ```bash
43
+ gem install stockpot
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ### Rails App
49
+
50
+ Add the `Stockpot` engine to your `/config/routes.rb` file, changing the base path if you'd like to:
51
+
52
+ ```ruby
53
+ mount Stockpot::Engine, at: "/stockpot"`
54
+ ```
55
+
56
+ This will give you the following [routes](/config/routes.rb) (assuming the default "/stockpot" path):
57
+
58
+ * `/stockpot/records`
59
+ * GET - Query for data
60
+ * POST - Create new data
61
+ * DELETE - Remove data
62
+ * PUT - Update data
63
+
64
+ * `/stockpot/clean_database`
65
+ * DELETE - Clears Rails & Redis caches and truncates Active Records databases.
66
+
67
+ * `/stockpot/redis`
68
+ * GET - Query for data
69
+ * POST - Create new data
70
+
71
+ ### Cypress/External Suite
72
+
73
+ We utilize Cypress commands to abstract out helpers for setting up state such as
74
+
75
+ ```javascript
76
+ Cypress.Commands.add("getRecords", args => {
77
+ cy.request({
78
+ method: "GET",
79
+ url: "stockpot/records",
80
+ body: {
81
+ models: args
82
+ }
83
+ })
84
+ })
85
+ ```
86
+
87
+ Our tests can then call this command like this
88
+
89
+ ```javascript
90
+ cy.getRecords([{ model: "user", id: user.id }])
91
+ .then(res => {
92
+ expect(newEmail).to.eql(res.body.users[0].email)
93
+ })
94
+ ```
95
+
96
+ ## Development
97
+
98
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
99
+
100
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
101
+
102
+ ## Contributing
103
+
104
+ This Open Source is supported by [Freshly](https://freshly.com), a company committed to quality code and delicious food.
105
+
106
+ We're basically [always hiring](https://jobs.lever.co/freshly).
107
+
108
+ Come join us in our New York City, Phoenix, or Minsk offices and write some awesome software!
109
+
110
+ Community support is always appreciated! Bug reports and pull requests are welcome on [GitHub](https://github.com/Freshly/stockpot).
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stockpot
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Stockpot
6
+ config.generators.api_only = true
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stockpot
4
+ VERSION = "0.1.1"
5
+ end
data/lib/stockpot.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "stockpot/engine"
4
+
5
+ module Stockpot
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # desc "Explaining what the task does"
4
+ # task :stockpot do
5
+ # # Task goes here
6
+ # end
metadata ADDED
@@ -0,0 +1,247 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stockpot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Jayson Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: factory_bot_rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 4.8.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 4.8.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: database_cleaner
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.6.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: redis
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.3.5
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.3.5
69
+ - !ruby/object:Gem::Dependency
70
+ name: timecop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.8'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.7'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '12.3'
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 12.3.3
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '12.3'
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 12.3.3
117
+ - !ruby/object:Gem::Dependency
118
+ name: rspec
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '3.8'
124
+ type: :development
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: '3.8'
131
+ - !ruby/object:Gem::Dependency
132
+ name: rspec-rails
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '3.8'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 3.8.2
141
+ type: :development
142
+ prerelease: false
143
+ version_requirements: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '3.8'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 3.8.2
151
+ - !ruby/object:Gem::Dependency
152
+ name: spicerack-styleguide
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: 0.16.2
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '1.0'
161
+ type: :development
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: 0.16.2
168
+ - - "<"
169
+ - !ruby/object:Gem::Version
170
+ version: '1.0'
171
+ - !ruby/object:Gem::Dependency
172
+ name: shoulda-matchers
173
+ requirement: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - "~>"
176
+ - !ruby/object:Gem::Version
177
+ version: '4.1'
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: 4.1.2
181
+ type: :development
182
+ prerelease: false
183
+ version_requirements: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '4.1'
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: 4.1.2
191
+ - !ruby/object:Gem::Dependency
192
+ name: simplecov
193
+ requirement: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: 0.17.1
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: 0.17.1
205
+ description: 'Exposes a few end points from your app, easily enabling CRUD actions
206
+ on your database that you can utilize from things like a standalone test suite to
207
+ set up state. (think: Cypress, Cucumber, etc.)'
208
+ email:
209
+ - gh@nes.33mail.com
210
+ executables: []
211
+ extensions: []
212
+ extra_rdoc_files: []
213
+ files:
214
+ - LICENSE.txt
215
+ - README.md
216
+ - lib/stockpot.rb
217
+ - lib/stockpot/engine.rb
218
+ - lib/stockpot/version.rb
219
+ - lib/tasks/stockpot_tasks.rake
220
+ homepage: https://github.com/Freshly/stockpot
221
+ licenses:
222
+ - MIT
223
+ metadata:
224
+ homepage_uri: https://github.com/Freshly/stockpot
225
+ source_code_uri: https://github.com/Freshly/stockpot
226
+ changelog_uri: https://github.com/Freshly/stockpot/blob/master/CHANGELOG.md
227
+ post_install_message:
228
+ rdoc_options: []
229
+ require_paths:
230
+ - lib
231
+ required_ruby_version: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - ">="
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
236
+ required_rubygems_version: !ruby/object:Gem::Requirement
237
+ requirements:
238
+ - - ">="
239
+ - !ruby/object:Gem::Version
240
+ version: '0'
241
+ requirements: []
242
+ rubygems_version: 3.0.6
243
+ signing_key:
244
+ specification_version: 4
245
+ summary: Makes setting up test data in your Rails database from an external resource
246
+ easier.
247
+ test_files: []