lurker 0.5.1 → 0.5.2
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 +4 -4
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.travis.yml +7 -0
- data/Gemfile +26 -2
- data/Gemfile.ci +4 -0
- data/README.md +44 -23
- data/Rakefile +85 -19
- data/features/docs_generation/html_generation.feature +7 -2
- data/features/docs_generation/multidomain_support.feature +12 -10
- data/features/docs_generation/partials.feature +98 -0
- data/features/step_definitions/additional_cli_steps.rb +14 -1
- data/features/support/env.rb +1 -0
- data/lib/lurker/cli.rb +16 -2
- data/lib/lurker/endpoint.rb +4 -0
- data/lib/lurker/form_builder.rb +1 -1
- data/lib/lurker/presenters/endpoint_presenter.rb +17 -16
- data/lib/lurker/presenters/schema_presenter.rb +10 -13
- data/lib/lurker/presenters/service_presenter.rb +11 -1
- data/lib/lurker/sandbox.rb +7 -2
- data/lib/lurker/service.rb +2 -2
- data/lib/lurker/templates/bootstrap.css.map +1 -0
- data/lib/lurker/templates/javascripts/JSXTransformer.js +12569 -0
- data/lib/lurker/templates/javascripts/application.js +7 -0
- data/lib/lurker/templates/javascripts/lurker.js +16 -45
- data/lib/lurker/templates/javascripts/phantomjs-shims.js +35 -0
- data/lib/lurker/templates/javascripts/react-catalyst.js +70 -0
- data/lib/lurker/templates/javascripts/react-with-addons.js +18884 -0
- data/lib/lurker/templates/layouts/application.html.erb +1 -1
- data/lib/lurker/templates/lurker/rendering/_param_form_element.html.erb +4 -4
- data/lib/lurker/templates/lurker/rendering/_param_form_legend.html.erb +1 -1
- data/lib/lurker/templates/lurker/rendering/_submit_form.html.erb +140 -0
- data/lib/lurker/templates/lurker/rendering/index.html.erb +5 -1
- data/lib/lurker/templates/lurker/rendering/show.html.erb +1 -40
- data/lib/lurker/templates/public/application.css +5 -0
- data/lib/lurker/templates/public/application.js +31828 -233
- data/lib/lurker/templates/stylesheets/application.css +5 -0
- data/lib/lurker/version.rb +1 -1
- data/lurker.gemspec +18 -18
- data/templates/generate_stuff.rb +6 -4
- data/templates/lurker_app.rb +1 -1
- metadata +79 -71
- metadata.gz.asc +7 -7
- data/Gemfile.local +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 283e1232ba94b0709c578cd9079df7752d246771
|
4
|
+
data.tar.gz: 052b2c171edb907e97c14d33c0e06825525714fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef36571fc15bc8b40b083f915a14ce602db250e8ff8d1bdace6d89da88c98a537fec81ced6a3db3cb599044e3a5f93f380a9f695874e4439e7cb4b5792484eb0
|
7
|
+
data.tar.gz: 91fd578c50783ff3f4125e6a2f31bc562054c401bec74698409ce0ede15b7f524a8ee51edfa9a2c7a7c90dcd55af6238d73b363f1dbafcaac7f71deb6b7786bf
|
checksums.yaml.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG v1
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABCgAGBQJTXvK5AAoJENcoxKfNVdjb5RoIAMetNDxFZ6KmLPkDpq50xeUt
|
6
|
+
HZri9cCVeD+5zk2SqIGTzh8jI1pqg822e1gFOyPpkZaXMUKisA0Lbogc2EWjsjte
|
7
|
+
HRjmH+ZL16VqFMhDFBoCX9Q1yXPm4wWhVcKK23fCbnY0x5HY2uHMUim8yDAN2bUO
|
8
|
+
/X7KIkNAwMLcihR1sHg8vCkmRWpN+29qaAvAOjjiyLyiND+Z7doweWNVrvxIF5Ei
|
9
|
+
L1jqEQouA+yXpSXtxYr4T+uQmwQCuL8TxDDm6EzMF8TuQFhLV2BwE2l8fQ5ZTtWq
|
10
|
+
qbysZqac/GxHz47at7+d1ghokp+jQ8uNt90vvNlo+ISfNOCHdP5jMEVTt6m1+HI=
|
11
|
+
=77ha
|
12
12
|
-----END PGP SIGNATURE-----
|
data.tar.gz.asc
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
Version: GnuPG v1
|
3
3
|
Comment: GPGTools - http://gpgtools.org
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
=
|
5
|
+
iQEcBAABCgAGBQJTXvK2AAoJENcoxKfNVdjbkmkIAJPPUMpXPntfkoEtTB4WAgo7
|
6
|
+
kFQwMJD5Lrz10tLwf7o8pkZWOEOMmHbZW46v2iLzgEXoXoBF5IOO8hBW0UmplWcK
|
7
|
+
s9Jx8ws2BrMt21qI48qYHDLHmn+Wexjvj/pV5X31JgfilzW9BhgV7MSfS//RmDkv
|
8
|
+
t5NCGdg84AJidKMGL95r4gxn7Uxp6q7oMZQONx9oaqXTAqLu7x9iuXTH1B3+1gNc
|
9
|
+
vJq+By9GseQ+I/TEPkz1wllWM3adMWH2a9iMqCys8DWw13Dpam8xnLRdEO+ZVJSy
|
10
|
+
hs2rVOKcGfEFEfI3gbwnd6VI7ItVxnFRlumNlEZ/V3ZkNANNQq+PEgOMBdasbgI=
|
11
|
+
=9S7g
|
12
12
|
-----END PGP SIGNATURE-----
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,28 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in lurker.gemspec
|
4
2
|
gemspec
|
3
|
+
|
4
|
+
# Add any gems and groups that you don't want to keep local
|
5
|
+
group :development do
|
6
|
+
# tools
|
7
|
+
gem 'pry-debugger'
|
8
|
+
gem 'pry-stack_explorer'
|
9
|
+
# rspec --format fuubar
|
10
|
+
gem 'fuubar'
|
11
|
+
# cucumber --format fuubar
|
12
|
+
gem 'fuubar-cucumber', github: 'martinciu/fuubar-cucumber', branch: 'master'
|
13
|
+
gem 'selenium-webdriver'
|
14
|
+
|
15
|
+
# deploy site
|
16
|
+
gem 'highline'
|
17
|
+
|
18
|
+
# build template static
|
19
|
+
# run `rake assets:precompile`
|
20
|
+
# to get bundled application.(js|css)
|
21
|
+
gem 'sprockets'
|
22
|
+
gem 'sass-rails'
|
23
|
+
gem 'coffee-rails'
|
24
|
+
gem 'bootstrap-sass', '~> 3.1.1'
|
25
|
+
gem 'jquery-rails'
|
26
|
+
gem 'remotipart'
|
27
|
+
gem "launchy"
|
28
|
+
end
|
data/Gemfile.ci
ADDED
data/README.md
CHANGED
@@ -5,12 +5,8 @@ The new de-facto for API testing your Rails application (Rails 3 & 4 both compat
|
|
5
5
|
[![Gem Version][GV img]][Gem Version]
|
6
6
|
[![Build Status][BS img]][Build Status]
|
7
7
|
[![Dependency Status][DS img]][Dependency Status]
|
8
|
-
[![Code Climate][CC img]][Code Climate]
|
9
|
-
[![Coverage Status][CS img]][Coverage Status]
|
10
|
-
[](http://inch-pages.github.io/github/razum2um/lurker)
|
11
8
|
[](http://githalytics.com/razum2um/lurker)
|
12
9
|
|
13
|
-
|
14
10
|
## Installation
|
15
11
|
|
16
12
|
Add this line to your application's Gemfile:
|
@@ -61,8 +57,8 @@ Now, you can test your API on-line (for real)
|
|
61
57
|
- [Pretty HTML documentation based on your schemas][html_generation_example]
|
62
58
|
- [Pretty submit form to test API endpoints (live) based on schemas][demo_live] (enter a name & press "Submit")
|
63
59
|
- [Handling URLs with dynamic segments][nested_controller_spec_example] (such as `api/v1/:user_id/repos`)
|
60
|
+
- [JSON-Schema partials][partial_example], also in YAML format ([demo][partial_example_demo])
|
64
61
|
- Multiple docs for many test cases
|
65
|
-
- JSON-Schema partials (inline reference to other schemas)
|
66
62
|
- ERB support inside `.json.yml.erb`
|
67
63
|
- HTTP-Auth authorization for your online docs
|
68
64
|
- Separate API-services generated within one test suite
|
@@ -71,42 +67,61 @@ Now, you can test your API on-line (for real)
|
|
71
67
|
- Static site deploy and milti-domain support
|
72
68
|
- Builtin Rack middlware `Lurker::Server.to_rack` serves cached digested assets
|
73
69
|
|
70
|
+
## Token authentication with sandbox
|
74
71
|
|
75
|
-
|
72
|
+
`Lurker::Sandbox` allows you to test services with token authentication:
|
76
73
|
|
77
74
|
# make sure it's not production!
|
78
75
|
# e.g. config/environtents/staging.rb
|
79
76
|
config.middleware.use Lurker::Sandbox
|
80
77
|
|
78
|
+
E.g. demo application runs with it: when creating, updating repos or users
|
79
|
+
ids getting increased, but if you look into GET #index,
|
80
|
+
new items are NOT showing up. **This is NOT a bug!** - sequences in postgres
|
81
|
+
are increasing notwithstanding ROLLBACK is called. As such:
|
82
|
+
|
83
|
+
- run all your specs with **the same** testing token
|
84
|
+
- ensure the same token to be accepted on your demo application
|
85
|
+
- insert `Lurker::Sandbox` and the recorded examples should be ok to submit again
|
86
|
+
|
81
87
|
## Demo application
|
82
88
|
|
83
89
|
You can clone the repo & run `rake build_example_docs`.
|
84
90
|
It will generate testing rails application under `tmp/lurker_app`.
|
85
91
|
Currently it is deployed [here][demo_app].
|
86
92
|
|
93
|
+
|
87
94
|
## Contributions
|
88
95
|
|
89
|
-
|
96
|
+
[![Code Climate][CC img]][Code Climate]
|
97
|
+
[![Coverage Status][CS img]][Coverage Status]
|
98
|
+
[](http://inch-pages.github.io/github/razum2um/lurker)
|
99
|
+
[][waffle]
|
100
|
+
|
101
|
+
I try to use [Waffle][waffle] to develop this gem, if you want to help:
|
102
|
+
|
103
|
+
- look on "Ready" section
|
104
|
+
- drag an issue to "In Progress" and assign to yourself
|
105
|
+
- have fun!
|
90
106
|
|
91
|
-
|
92
|
-
|
107
|
+
**NOTICE:** to get new version of bundled `bootstrap` or update js/css,
|
108
|
+
don't touch files under `lib/lurker/templates/public` - they are autogenerated
|
109
|
+
and copied to static generated site while `bin/lurker convert`
|
93
110
|
|
94
|
-
rake assets:precompile # to build
|
95
|
-
cucumber some/feature # to use pry-debugger
|
111
|
+
rake assets:precompile # to build them
|
96
112
|
|
97
|
-
|
113
|
+
Don't commit them to avoid conflicts.
|
98
114
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
- XML api testing via .xsd
|
115
|
+
**NOTE:** if you write features keep in mind to generate different files with aruba,
|
116
|
+
because they are kept in `lurker_app` directory to be deployed as a demo. Please, write
|
117
|
+
features in a way to generate **new** relevant `lurker/**/*.json.yml` files
|
118
|
+
|
119
|
+
To run cucumber in a clean `lurker` & `html` directories run:
|
120
|
+
|
121
|
+
CLEAN=1 cucumber features
|
122
|
+
|
123
|
+
**NOTE:** template partial `submit_form.html.erb` and it's partials is a big `jsx` script for `React`
|
124
|
+
so there are `<label htmlFor` instead of `<label for>` and `<div className` instead of `<div class`
|
110
125
|
|
111
126
|
## Acknoledgements
|
112
127
|
|
@@ -116,9 +131,13 @@ This gem is quite opinionated and relies on rails & rspec - if you're
|
|
116
131
|
interested in anything else, please take a look at [api_taster][api_taster] or [fdoc][fdoc],
|
117
132
|
This gem is heavily inspirated by them. Thanks, @square & @fredwu
|
118
133
|
|
134
|
+
Also thanks to [React.js][reactjs] for two-way binding.
|
135
|
+
|
136
|
+
[waffle]: https://waffle.io/razum2um/lurker
|
119
137
|
[gh_api]: https://developer.github.com/v3/meta/
|
120
138
|
[rspec]: https://github.com/rspec/rspec-rails
|
121
139
|
[api_taster]: https://github.com/fredwu/api_taster
|
140
|
+
[reactjs]: http://facebook.github.io/react/
|
122
141
|
[fdoc]: https://github.com/square/fdoc
|
123
142
|
[rspec_controller_spec]: https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs
|
124
143
|
[rspec_request_spec]: https://www.relishapp.com/rspec/rspec-rails/docs/request-specs/request-spec
|
@@ -129,6 +148,8 @@ This gem is heavily inspirated by them. Thanks, @square & @fredwu
|
|
129
148
|
[nested_controller_spec_example]: https://www.relishapp.com/razum2um/lurker/docs/controller-specs/nested-schema-scaffolding
|
130
149
|
[request_spec_example]: https://www.relishapp.com/razum2um/lurker/docs/request-specs/schema-scaffolding
|
131
150
|
[html_generation_example]: https://www.relishapp.com/razum2um/lurker/docs/docs-generation/html-generation
|
151
|
+
[partial_example]: https://www.relishapp.com/razum2um/lurker/docs/docs-generation/partials
|
152
|
+
[partial_example_demo]: http://lurker-app.herokuapp.com/lurker/api/v1/users/__user_id/repos-POST.html
|
132
153
|
[evil_martians]: http://evilmartians.com/
|
133
154
|
[demo_app]: http://lurker-app.herokuapp.com/lurker/
|
134
155
|
[demo_live]: http://lurker-app.herokuapp.com/lurker/api/v1/users-POST.html
|
data/Rakefile
CHANGED
@@ -8,6 +8,7 @@ desc 'pry console for gem'
|
|
8
8
|
task :c do
|
9
9
|
require 'pry'
|
10
10
|
require 'lurker'
|
11
|
+
require 'lurker/cli'
|
11
12
|
ARGV.clear
|
12
13
|
Pry.start
|
13
14
|
end
|
@@ -34,8 +35,8 @@ namespace :assets do
|
|
34
35
|
FileUtils.mkdir_p(BUILD_DIR)
|
35
36
|
|
36
37
|
# raw copy
|
37
|
-
%w[fonts].each do |subdir|
|
38
|
-
FileUtils.cp_r(SOURCE_DIR.join(subdir), BUILD_DIR
|
38
|
+
%w[fonts bootstrap.css.map].each do |subdir|
|
39
|
+
FileUtils.cp_r(SOURCE_DIR.join(subdir), BUILD_DIR)
|
39
40
|
end
|
40
41
|
|
41
42
|
sprockets = Sprockets::Environment.new(ROOT) do |env|
|
@@ -122,6 +123,11 @@ def in_lurker_app(command)
|
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
126
|
+
def on_razum2um_me(command)
|
127
|
+
puts "About to run: #{command}"
|
128
|
+
system %Q{ssh lurker@razum2um.me 'bash -l -c "source ~/.bashrc; cd ~/lurker; rvm use 2.1.1; #{command}"'}
|
129
|
+
end
|
130
|
+
|
125
131
|
def needs_generation?
|
126
132
|
!File.exists?("#{EXAMPLE_PATH}/Gemfile")
|
127
133
|
end
|
@@ -144,37 +150,97 @@ task :features => [:regenerate, :cucumber]
|
|
144
150
|
|
145
151
|
desc 'convert docs for example app'
|
146
152
|
task :build_example_docs => :features do
|
147
|
-
in_lurker_app "bin/lurker convert"
|
153
|
+
in_lurker_app "bin/lurker convert -c #{File.expand_path('../README.md', __FILE__)}"
|
148
154
|
end
|
149
155
|
|
150
|
-
|
151
|
-
|
152
|
-
|
156
|
+
def ask_for_deploy(name, callback)
|
157
|
+
if ENV['FORCE_DEPLOY']
|
158
|
+
puts "Deploy to #{name}"
|
159
|
+
callback.call
|
160
|
+
else
|
153
161
|
require_with_help 'highline/import'
|
154
|
-
in_lurker_app "echo 'bin/lurker' > .gitignore"
|
155
|
-
in_lurker_app "echo 'log' >> .gitignore"
|
156
|
-
# commit migration and deploy by hand first time
|
157
|
-
in_lurker_app "echo 'db/*' >> .gitignore"
|
158
|
-
in_lurker_app "echo 'tmp/*' >> .gitignore"
|
159
|
-
|
160
|
-
|
161
|
-
in_lurker_app "git add -A"
|
162
|
-
in_lurker_app "git status"
|
163
162
|
choose do |menu|
|
164
|
-
menu.prompt =
|
163
|
+
menu.prompt = "Commit & push & deploy to #{name}?"
|
165
164
|
menu.choice(:yes) {
|
166
|
-
|
167
|
-
|
168
|
-
in_lurker_app "heroku run rake db:import --app lurker-app"
|
165
|
+
ENV['FORCE_DEPLOY'] = '1'
|
166
|
+
callback.call
|
169
167
|
}
|
170
168
|
menu.choice(:no) { say("Exit") }
|
171
169
|
end
|
172
170
|
end
|
171
|
+
end
|
172
|
+
|
173
|
+
namespace :heroku do
|
174
|
+
desc 'pushes example lurker_app to heroku'
|
175
|
+
task :push => :predeploy do
|
176
|
+
do_deploy = Proc.new {
|
177
|
+
in_lurker_app "git commit -a -m 'auto commit: #{`git log --oneline -n 1`.strip}'" rescue nil
|
178
|
+
in_lurker_app "git push origin master"
|
179
|
+
in_lurker_app "heroku run rake db:import --app lurker-app"
|
180
|
+
}
|
181
|
+
ask_for_deploy("heroku", do_deploy)
|
182
|
+
end
|
173
183
|
|
174
184
|
desc 'rebuilds & pushes app to heroku'
|
175
185
|
task :deploy => [:build_example_docs, 'heroku:push'] do
|
176
186
|
end
|
177
187
|
end
|
178
188
|
|
189
|
+
namespace :razum2um do
|
190
|
+
desc 'pushes example lurker_app to razum2um'
|
191
|
+
task :push => :predeploy do
|
192
|
+
do_deploy = Proc.new {
|
193
|
+
in_lurker_app "git commit -a -m 'auto commit: #{`git log --oneline -n 1`.strip}'" rescue nil
|
194
|
+
in_lurker_app "git push razum2um master"
|
195
|
+
%w[database secrets].each do |fname|
|
196
|
+
on_razum2um_me "cp ~/#{fname}.yml config/#{fname}.yml"
|
197
|
+
end
|
198
|
+
on_razum2um_me "bundle install"
|
199
|
+
on_razum2um_me "RAILS_ENV=production bin/rake db:migrate"
|
200
|
+
on_razum2um_me "RAILS_ENV=production bin/rake db:import"
|
201
|
+
on_razum2um_me "touch tmp/restart.txt"
|
202
|
+
}
|
203
|
+
ask_for_deploy("razum2um.me", do_deploy)
|
204
|
+
end
|
205
|
+
|
206
|
+
desc 'rebuilds & pushes app to razum2um.me'
|
207
|
+
task :deploy => [:build_example_docs, 'razum2um:push'] do
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
179
211
|
task :default => [:spec, :regenerate, :cucumber, 'coveralls:push']
|
180
212
|
|
213
|
+
desc 'commits lurker app'
|
214
|
+
task :predeploy do
|
215
|
+
in_lurker_app "echo 'bin/lurker' > .gitignore"
|
216
|
+
in_lurker_app "echo 'log' >> .gitignore"
|
217
|
+
# commit migration and deploy by hand first time
|
218
|
+
in_lurker_app "echo 'db/*' >> .gitignore"
|
219
|
+
in_lurker_app "echo 'tmp/*log' >> .gitignore"
|
220
|
+
in_lurker_app "echo '.bundle/*' >> .gitignore"
|
221
|
+
|
222
|
+
in_lurker_app "git add -A"
|
223
|
+
in_lurker_app "git status"
|
224
|
+
end
|
225
|
+
|
226
|
+
desc 'deploys everything'
|
227
|
+
task :deploy => ["razum2um:deploy", "heroku:deploy"]
|
228
|
+
|
229
|
+
desc 'pushes everything'
|
230
|
+
task :push => ["razum2um:push", "heroku:push"]
|
231
|
+
|
232
|
+
desc 'releases gem & updates docs'
|
233
|
+
task :publish do
|
234
|
+
require 'lurker'
|
235
|
+
version = Lurker::VERSION
|
236
|
+
|
237
|
+
Bundler.with_clean_env do
|
238
|
+
system "git tag v#{version}"
|
239
|
+
system "relish versions:add razum2um/lurker:#{version}"
|
240
|
+
system "relish push razum2um/lurker:#{version}"
|
241
|
+
system "gem build lurker.gemspec --sign"
|
242
|
+
system "git push --tags"
|
243
|
+
system "gem push lurker-#{version}.gem"
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
@@ -64,8 +64,13 @@ Feature: html generation
|
|
64
64
|
Then I should see "user creation"
|
65
65
|
|
66
66
|
When I click on "user creation"
|
67
|
-
|
68
|
-
|
67
|
+
And I fill in the submit form field "name" with "Jim"
|
68
|
+
Then I should see:
|
69
|
+
"""
|
70
|
+
curl -X POST -d "user%5Bname%5D=Jim"
|
71
|
+
"""
|
72
|
+
|
73
|
+
And I submit lurk form
|
69
74
|
|
70
75
|
Then I should see JSON response with "Jim"
|
71
76
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
Feature: mutidomain support
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
In your `.service.yml` list you domains in form `hostname: url`
|
4
|
+
|
5
|
+
To deploy statically on other domain and be able to send API requests
|
6
|
+
you should turn off Access-Control-Allow-Origin restriction
|
5
7
|
in config/application.rb (Rails 4)
|
6
8
|
|
7
9
|
```ruby
|
@@ -20,8 +22,8 @@ Feature: mutidomain support
|
|
20
22
|
basePath: ''
|
21
23
|
description: ''
|
22
24
|
domains:
|
23
|
-
'
|
24
|
-
'http://lurker
|
25
|
+
'[Sandbox] Heroku': 'http://lurker-app.herokuapp.com'
|
26
|
+
'[Real] razum2um.me': 'http://lurker.razum2um.me'
|
25
27
|
name: LurkerApp
|
26
28
|
extensions: {}
|
27
29
|
"""
|
@@ -63,10 +65,10 @@ Feature: mutidomain support
|
|
63
65
|
create api/v1/users/__id-DELETE.html
|
64
66
|
"""
|
65
67
|
|
66
|
-
When I go to "/lurker"
|
67
|
-
|
68
|
-
Then I should see
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
When I go to "/lurker/api/v1/users/__id-DELETE.html"
|
69
|
+
When I select "[Sandbox] Heroku" hostname
|
70
|
+
Then I should see:
|
71
|
+
"""
|
72
|
+
curl -X DELETE "http://lurker-app.herokuapp.com/api/v1/users/1"
|
73
|
+
"""
|
72
74
|
|
@@ -0,0 +1,98 @@
|
|
1
|
+
Feature: partials
|
2
|
+
|
3
|
+
You can use `$ref` to reference to other schemas just like in JSON-Schema documentation
|
4
|
+
Paths must be either `http://` or relative filenames
|
5
|
+
|
6
|
+
Referenced files can be either `.json` files, or `.json.yml` (Same JSON in YAML)
|
7
|
+
|
8
|
+
**NOTE:** to reference `file.json.yml` use `$ref: 'file.json#/'`
|
9
|
+
All YAML preprocessing happens behind the scene.
|
10
|
+
|
11
|
+
Scenario: builds html for "repos/create" in request spec with nested partials
|
12
|
+
Given an empty directory named "html"
|
13
|
+
And a file named "lurker/definitions/user.json.yml" with:
|
14
|
+
"""yml
|
15
|
+
---
|
16
|
+
properties:
|
17
|
+
id:
|
18
|
+
type: integer
|
19
|
+
example: 1
|
20
|
+
name:
|
21
|
+
type: string
|
22
|
+
example: razum2um
|
23
|
+
"""
|
24
|
+
And a file named "lurker/definitions/repo.json.yml" with:
|
25
|
+
"""yml
|
26
|
+
---
|
27
|
+
properties:
|
28
|
+
id:
|
29
|
+
type: integer
|
30
|
+
example: 1
|
31
|
+
name:
|
32
|
+
type: string
|
33
|
+
example: new-gem
|
34
|
+
user:
|
35
|
+
$ref: '../definitions/user.json#/'
|
36
|
+
"""
|
37
|
+
And a file named "lurker/api/v1/users/__user_id/repos-POST.json.yml" with:
|
38
|
+
"""yml
|
39
|
+
---
|
40
|
+
description: repo creation
|
41
|
+
prefix: repos management
|
42
|
+
requestParameters:
|
43
|
+
properties:
|
44
|
+
user_id:
|
45
|
+
type: integer
|
46
|
+
example: 1
|
47
|
+
repo:
|
48
|
+
properties:
|
49
|
+
name:
|
50
|
+
type: string
|
51
|
+
example: new-gem
|
52
|
+
responseCodes:
|
53
|
+
- status: 200
|
54
|
+
successful: true
|
55
|
+
responseParameters:
|
56
|
+
$ref: '../../../../definitions/repo.json#/'
|
57
|
+
extensions:
|
58
|
+
method: POST
|
59
|
+
path_info: "/api/v1/users/1/repos"
|
60
|
+
path_params:
|
61
|
+
action: create
|
62
|
+
controller: api/v1/repos
|
63
|
+
user_id: '1'
|
64
|
+
suffix: ''
|
65
|
+
"""
|
66
|
+
|
67
|
+
Given a file named "spec/requests/repo_creation_spec.rb" with:
|
68
|
+
"""ruby
|
69
|
+
require "spec_helper"
|
70
|
+
|
71
|
+
describe Api::V1::ReposController, :lurker do
|
72
|
+
let!(:user) do
|
73
|
+
User.where(name: 'razum2um').first_or_create!
|
74
|
+
end
|
75
|
+
|
76
|
+
it "creates a new repo" do
|
77
|
+
expect {
|
78
|
+
post "api/v1/users/#{user.id}/repos", repo: { name: 'new-gem' }
|
79
|
+
expect(response).to be_success
|
80
|
+
expect(JSON.parse(response.body)['user']).to eq JSON.parse(user.to_json)
|
81
|
+
}.to change { Repo.count } .by(1)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
"""
|
85
|
+
|
86
|
+
When I run `bin/rspec spec/requests/repo_creation_spec.rb`
|
87
|
+
Then the example should pass
|
88
|
+
|
89
|
+
When I successfully run `bin/lurker convert`
|
90
|
+
Then the output should contain these lines:
|
91
|
+
"""
|
92
|
+
Converting lurker to html
|
93
|
+
using lurker
|
94
|
+
|
95
|
+
create index.html
|
96
|
+
create api/v1/users/__user_id/repos-POST.html
|
97
|
+
"""
|
98
|
+
|