lurker 0.5.3 → 0.5.4
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/.gitignore +1 -0
- data/.travis.yml +4 -4
- data/README.md +4 -2
- data/Rakefile +13 -1
- data/features/controller_specs/nested_schema_scaffolding.feature +4 -4
- data/features/controller_specs/test_endpoint.feature +36 -15
- data/features/request_specs/nested_schema_scaffolding.feature +4 -4
- data/features/request_specs/schema_suffixes.feature +173 -0
- data/features/support/env.rb +7 -1
- data/gemfiles/Gemfile32.ci +6 -0
- data/{Gemfile.ci → gemfiles/Gemfile40.ci} +3 -1
- data/gemfiles/Gemfile41.ci +6 -0
- data/lib/lurker.rb +0 -2
- data/lib/lurker/cli.rb +10 -55
- data/lib/lurker/controller_spec_watcher.rb +12 -6
- data/lib/lurker/endpoint.rb +1 -1
- data/lib/lurker/presenters/base_presenter.rb +0 -13
- data/lib/lurker/presenters/endpoint_presenter.rb +7 -6
- data/lib/lurker/presenters/json_presenter.rb +0 -9
- data/lib/lurker/presenters/response_code_presenter.rb +0 -9
- data/lib/lurker/presenters/schema_presenter.rb +1 -33
- data/lib/lurker/presenters/service_presenter.rb +2 -24
- data/lib/lurker/request_spec_watcher.rb +11 -6
- data/lib/lurker/service.rb +1 -1
- data/lib/lurker/templates/javascripts/application.js +0 -2
- data/lib/lurker/templates/public/application.css +0 -148
- data/lib/lurker/templates/public/application.js +2 -1904
- data/lib/lurker/templates/stylesheets/application.css +0 -2
- data/lib/lurker/version.rb +1 -1
- data/lurker.gemspec +2 -1
- data/templates/generate_stuff.rb +111 -22
- data/templates/lurker_app.rb +0 -5
- metadata +31 -32
- metadata.gz.asc +7 -7
- data/lib/lurker/meta_service.rb +0 -46
- data/lib/lurker/presenters/meta_service_presenter.rb +0 -85
- data/lib/lurker/templates/endpoint.html.erb +0 -62
- data/lib/lurker/templates/endpoint.md.erb +0 -40
- data/lib/lurker/templates/javascripts/demo/dashboard-demo.js +0 -117
- data/lib/lurker/templates/javascripts/demo/flot-demo.js +0 -1242
- data/lib/lurker/templates/javascripts/demo/morris-demo.js +0 -155
- data/lib/lurker/templates/javascripts/plugins/dataTables/dataTables.bootstrap.js +0 -245
- data/lib/lurker/templates/javascripts/plugins/dataTables/jquery.dataTables.js +0 -14013
- data/lib/lurker/templates/javascripts/plugins/flot/excanvas.min.js +0 -1
- data/lib/lurker/templates/javascripts/plugins/flot/jquery.flot.js +0 -2599
- data/lib/lurker/templates/javascripts/plugins/flot/jquery.flot.pie.js +0 -750
- data/lib/lurker/templates/javascripts/plugins/flot/jquery.flot.resize.js +0 -60
- data/lib/lurker/templates/javascripts/plugins/flot/jquery.flot.tooltip.min.js +0 -12
- data/lib/lurker/templates/javascripts/plugins/morris/morris.js +0 -1888
- data/lib/lurker/templates/javascripts/plugins/morris/raphael-2.1.0.min.js +0 -10
- data/lib/lurker/templates/lurker/rendering/_endpoint.html.erb +0 -65
- data/lib/lurker/templates/meta_service.html.erb +0 -54
- data/lib/lurker/templates/service.html.erb +0 -50
- data/lib/lurker/templates/service.md.erb +0 -18
- data/lib/lurker/templates/styles.css +0 -75
- data/lib/lurker/templates/stylesheets/plugins/dataTables/dataTables.bootstrap.css +0 -233
- data/lib/lurker/templates/stylesheets/plugins/morris/morris-0.4.3.min.css +0 -2
- data/lib/lurker/templates/stylesheets/plugins/social-buttons/social-buttons.css +0 -68
- data/lib/lurker/templates/stylesheets/plugins/timeline/timeline.css +0 -144
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0db77bd62f588abb4fb1578efb4a2bb549757c4
|
|
4
|
+
data.tar.gz: bee8c146efa0e12da5b93bf39f279cdfd798ca1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b80cbbda321aec3d97d7773344afed7315267d3c4be8504278d9ac951eeeaa16d1290674c42bf5de802e09c3a373654e440880078e07a13561b42dd62b70bea
|
|
7
|
+
data.tar.gz: ce9992065fe080a56c59007fe6b2d67b22e0858632df68d23a4c20227ba040f996a47a2634e790cb06d3498d3f99621a57f74c7799fd104f4b78d94a7e0a1c61
|
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
|
+
iQEcBAABCgAGBQJTaes0AAoJENcoxKfNVdjbTfwH/RoJGVRj3ReOEemgkXBTaCVm
|
|
6
|
+
d3+jIU4Bj/hKl4l9bIy2izCwGuIropA9j4gHC8v8+slgpgtejggl1aH2FkNMrszS
|
|
7
|
+
5wjLhJxXKCFWPZVe3k/LTg07JcJj9aInvP96jKyiwIKGnCQEYcAwVrko9tu3R8WV
|
|
8
|
+
ENpDqkH8E69P0KZ2XDH22va4aH4VtVDrw4VCJWftEg91ufPzyrsPoNbb5j+jk6DQ
|
|
9
|
+
X/IB4R+YDJ3ch3An2UuAQK6rpu1GFd5migwpdrYKUzZYO/6xenK/pjALia/Yj4jm
|
|
10
|
+
jvnN7pJzPm9357Gg6h6iPY4Q8Us89Ri6XqZrdT7cQ1Zzclco7crxWT+syYi2PL0=
|
|
11
|
+
=913O
|
|
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
|
+
iQEcBAABCgAGBQJTaesyAAoJENcoxKfNVdjbuuAIAM6HJ0fiHPEW8Jl1jXGNW8gK
|
|
6
|
+
6KCxhB8w9yRtVj7bQf6WfPV00OzpS7CVH3ln/NzLF75DYG6b6JQ6C2zmYFqwSH+M
|
|
7
|
+
LNrGef8gdIrTmanItakJ23xQ+ADxnNg6Ib0FCTCEs8BOfYoDtPnHv9Mp5hqLNQW3
|
|
8
|
+
XeOD5f9Q6DrTuMssWTDA3ZvmMtBPDYAsI/Xr3Ku9fZGnoqorHBhCnELWGZVTg4xo
|
|
9
|
+
IAhguO6vxMQPgyqSrPnj/kZLRVGiw2mF2LnlfRNAirKM+ByNklcwlrTvBcwRQhpJ
|
|
10
|
+
tBptan36Aier/uEaBkncd/dfKCmm/f8APSPJubc8aG+3SSL7rkw2lG7aN6RPGQ0=
|
|
11
|
+
=eB97
|
|
12
12
|
-----END PGP SIGNATURE-----
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Lurker
|
|
2
2
|
|
|
3
|
-
The new de-facto for API testing your Rails application
|
|
3
|
+
The new de-facto for API testing your Rails application.
|
|
4
|
+
Works on Rails 3.2, 4.0, 4.1 & Ruby 1.9.3, 2.0.0, 2.1.1.
|
|
4
5
|
|
|
5
6
|
[![Gem Version][GV img]][Gem Version]
|
|
6
7
|
[![Build Status][BS img]][Build Status]
|
|
@@ -132,8 +133,9 @@ This gem is quite opinionated and relies on rails & rspec - if you're
|
|
|
132
133
|
interested in anything else, please take a look at [api_taster][api_taster] or [fdoc][fdoc],
|
|
133
134
|
This gem is heavily inspirated by them. Thanks, @square & @fredwu
|
|
134
135
|
|
|
135
|
-
Also thanks to [React.js][reactjs] for two-way binding.
|
|
136
|
+
Also thanks to [Andrey Deryabin][aderyabin] for advice and [React.js][reactjs] for two-way binding.
|
|
136
137
|
|
|
138
|
+
[aderyabin]: https://twitter.com/aderyabin
|
|
137
139
|
[waffle]: https://waffle.io/razum2um/lurker
|
|
138
140
|
[gh_api]: https://developer.github.com/v3/meta/
|
|
139
141
|
[rspec]: https://github.com/rspec/rspec-rails
|
data/Rakefile
CHANGED
|
@@ -91,7 +91,7 @@ namespace :clobber do
|
|
|
91
91
|
desc "clobber the generated app"
|
|
92
92
|
task :app do
|
|
93
93
|
FileUtils.mkdir_p EXAMPLE_PATH
|
|
94
|
-
in_lurker_app "bin/spring stop"
|
|
94
|
+
in_lurker_app "bin/spring stop" rescue nil
|
|
95
95
|
Dir.chdir EXAMPLE_PATH do
|
|
96
96
|
Dir.glob("*", File::FNM_DOTMATCH).each do |fname|
|
|
97
97
|
next if fname == '.' || fname == '..' || fname == '.git'
|
|
@@ -111,7 +111,19 @@ namespace :generate do
|
|
|
111
111
|
|
|
112
112
|
desc "generate a bunch of stuff with generators"
|
|
113
113
|
task :stuff do
|
|
114
|
+
if ENV['BUNDLE_GEMFILE'].to_s.match(/Gemfile(32|40)\.ci$/)
|
|
115
|
+
in_lurker_app "bundle install"
|
|
116
|
+
%w[rake rspec-core spring].each do |gem|
|
|
117
|
+
in_lurker_app "bundle binstubs #{gem}"
|
|
118
|
+
end
|
|
119
|
+
end
|
|
114
120
|
in_lurker_app "LOCATION='../../templates/generate_stuff.rb' bin/rake rails:template --quiet --silent"
|
|
121
|
+
|
|
122
|
+
unless ENV['TRAVIS']
|
|
123
|
+
in_lurker_app 'bin/rake db:setup'
|
|
124
|
+
in_lurker_app 'bin/rake db:import'
|
|
125
|
+
end
|
|
126
|
+
in_lurker_app 'bin/rake RAILS_ENV=test db:setup'
|
|
115
127
|
end
|
|
116
128
|
end
|
|
117
129
|
|
|
@@ -58,14 +58,14 @@ Feature: nested schema scaffolding
|
|
|
58
58
|
description: ''
|
|
59
59
|
type: integer
|
|
60
60
|
example: 1
|
|
61
|
-
user_id:
|
|
62
|
-
description: ''
|
|
63
|
-
type: integer
|
|
64
|
-
example: 1
|
|
65
61
|
name:
|
|
66
62
|
description: ''
|
|
67
63
|
type: string
|
|
68
64
|
example: lurker
|
|
65
|
+
user_id:
|
|
66
|
+
description: ''
|
|
67
|
+
type: integer
|
|
68
|
+
example: 1
|
|
69
69
|
required: []
|
|
70
70
|
extensions:
|
|
71
71
|
method: GET
|
|
@@ -10,17 +10,24 @@ Feature: test endpoint
|
|
|
10
10
|
but specs are NOT passing because of nonsufficient `role` attribute
|
|
11
11
|
|
|
12
12
|
Background:
|
|
13
|
-
Given a file named "lurker/api/v1/users-
|
|
13
|
+
Given a file named "lurker/api/v1/users/__id-PATCH.json.yml" with:
|
|
14
14
|
"""yml
|
|
15
15
|
---
|
|
16
16
|
prefix: ''
|
|
17
17
|
description: ''
|
|
18
18
|
responseCodes:
|
|
19
|
+
- status: 400
|
|
20
|
+
successful: true
|
|
21
|
+
description: ''
|
|
19
22
|
- status: 200
|
|
20
23
|
successful: true
|
|
21
24
|
description: ''
|
|
22
25
|
requestParameters:
|
|
23
26
|
properties:
|
|
27
|
+
id:
|
|
28
|
+
description: ''
|
|
29
|
+
type: integer
|
|
30
|
+
example: 1
|
|
24
31
|
user:
|
|
25
32
|
description: ''
|
|
26
33
|
type: object
|
|
@@ -43,14 +50,16 @@ Feature: test endpoint
|
|
|
43
50
|
example: Bob
|
|
44
51
|
required: []
|
|
45
52
|
extensions:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
path_info: "/api/v1/users"
|
|
49
|
-
method: POST
|
|
53
|
+
path_info: "/api/v1/users/1"
|
|
54
|
+
method: PATCH
|
|
50
55
|
suffix: ''
|
|
56
|
+
path_params:
|
|
57
|
+
action: update
|
|
58
|
+
controller: api/v1/users
|
|
59
|
+
id: 1
|
|
51
60
|
"""
|
|
52
61
|
|
|
53
|
-
Scenario: json schema tests request and response using "users/
|
|
62
|
+
Scenario: json schema tests request and response using "users/update"
|
|
54
63
|
Given a file named "spec/controllers/api/v1/users_controller_spec.rb" with:
|
|
55
64
|
"""ruby
|
|
56
65
|
require "spec_helper"
|
|
@@ -58,8 +67,12 @@ Feature: test endpoint
|
|
|
58
67
|
describe Api::V1::UsersController, :lurker do
|
|
59
68
|
render_views
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
let(:user) do
|
|
71
|
+
User.where(name: 'razum2um').first_or_create!
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "updates a user" do
|
|
75
|
+
patch :update, id: user.id, user: { name: 'Bob' }
|
|
63
76
|
expect(response).to be_success
|
|
64
77
|
end
|
|
65
78
|
end
|
|
@@ -68,7 +81,7 @@ Feature: test endpoint
|
|
|
68
81
|
When I run `bin/rspec spec/controllers/api/v1/users_controller_spec.rb`
|
|
69
82
|
Then the example should pass
|
|
70
83
|
|
|
71
|
-
Scenario: json schema tests request parameters and tell what fails using "users/
|
|
84
|
+
Scenario: json schema tests request parameters and tell what fails using "users/update"
|
|
72
85
|
Given a file named "spec/controllers/api/v1/users_controller_spec.rb" with:
|
|
73
86
|
"""ruby
|
|
74
87
|
require "spec_helper"
|
|
@@ -76,8 +89,12 @@ Feature: test endpoint
|
|
|
76
89
|
describe Api::V1::UsersController, :lurker do
|
|
77
90
|
render_views
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
|
|
92
|
+
let(:user) do
|
|
93
|
+
User.where(name: 'razum2um').first_or_create!
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "updates a user" do
|
|
97
|
+
patch :update, id: user.id, user: { name: 1 }
|
|
81
98
|
expect(response).not_to be_success
|
|
82
99
|
end
|
|
83
100
|
end
|
|
@@ -93,7 +110,7 @@ Feature: test endpoint
|
|
|
93
110
|
1 example, 1 failure
|
|
94
111
|
"""
|
|
95
112
|
|
|
96
|
-
Scenario: json schema tests response parameters and tell what fails using "users/
|
|
113
|
+
Scenario: json schema tests response parameters and tell what fails using "users/update"
|
|
97
114
|
Given a file named "spec/controllers/api/v1/users_controller_spec.rb" with:
|
|
98
115
|
"""ruby
|
|
99
116
|
require "spec_helper"
|
|
@@ -101,9 +118,13 @@ Feature: test endpoint
|
|
|
101
118
|
describe Api::V1::UsersController, :lurker do
|
|
102
119
|
render_views
|
|
103
120
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
121
|
+
let(:user) do
|
|
122
|
+
User.where(name: 'razum2um').first_or_create!
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it "updates a user" do
|
|
126
|
+
patch :update, id: user.id, user: { name: '' }
|
|
127
|
+
expect(response).not_to be_success
|
|
107
128
|
end
|
|
108
129
|
end
|
|
109
130
|
"""
|
|
@@ -43,14 +43,14 @@ Feature: nested schema scaffolding
|
|
|
43
43
|
description: ''
|
|
44
44
|
type: integer
|
|
45
45
|
example: 1
|
|
46
|
-
user_id:
|
|
47
|
-
description: ''
|
|
48
|
-
type: integer
|
|
49
|
-
example: 1
|
|
50
46
|
name:
|
|
51
47
|
description: ''
|
|
52
48
|
type: string
|
|
53
49
|
example: lurker
|
|
50
|
+
user_id:
|
|
51
|
+
description: ''
|
|
52
|
+
type: integer
|
|
53
|
+
example: 1
|
|
54
54
|
required: []
|
|
55
55
|
extensions:
|
|
56
56
|
method: GET
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Feature: schema suffixes
|
|
2
|
+
|
|
3
|
+
If your API is stable and the new code isn't breaking it
|
|
4
|
+
you'll see nothing special, just passing specs
|
|
5
|
+
|
|
6
|
+
**NOTE:** the second request example is expecting a nonsuccessful response and it is,
|
|
7
|
+
but specs are NOT passing because of nonsufficient `name` parameter
|
|
8
|
+
|
|
9
|
+
**NOTE:** the third response example is expecting a successful response and it is,
|
|
10
|
+
but specs are NOT passing because of nonsufficient `role` attribute
|
|
11
|
+
|
|
12
|
+
Scenario: json schema tests request and response using "repos/update"
|
|
13
|
+
Given a file named "lurker/api/v1/users/__user_id/repos/__id-PATCH.json.yml" with:
|
|
14
|
+
"""yml
|
|
15
|
+
---
|
|
16
|
+
prefix: 'repos management'
|
|
17
|
+
description: 'repo updating'
|
|
18
|
+
responseCodes:
|
|
19
|
+
- status: 200
|
|
20
|
+
successful: true
|
|
21
|
+
description: ''
|
|
22
|
+
requestParameters:
|
|
23
|
+
properties:
|
|
24
|
+
id:
|
|
25
|
+
description: ''
|
|
26
|
+
type: string
|
|
27
|
+
example: 1
|
|
28
|
+
user_id:
|
|
29
|
+
description: ''
|
|
30
|
+
type: string
|
|
31
|
+
example: razum2um
|
|
32
|
+
repo:
|
|
33
|
+
description: ''
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
name:
|
|
37
|
+
description: ''
|
|
38
|
+
type: string
|
|
39
|
+
example: 'updated-name'
|
|
40
|
+
required: []
|
|
41
|
+
required: []
|
|
42
|
+
responseParameters:
|
|
43
|
+
properties:
|
|
44
|
+
id:
|
|
45
|
+
description: ''
|
|
46
|
+
type: integer
|
|
47
|
+
example: 1
|
|
48
|
+
name:
|
|
49
|
+
description: ''
|
|
50
|
+
type: string
|
|
51
|
+
example: 'updated-name'
|
|
52
|
+
user_id:
|
|
53
|
+
description: ''
|
|
54
|
+
type: integer
|
|
55
|
+
example: 1
|
|
56
|
+
required: []
|
|
57
|
+
extensions:
|
|
58
|
+
path_info: "/api/v1/users/razum2um/repos/lurker"
|
|
59
|
+
method: PATCH
|
|
60
|
+
suffix: ''
|
|
61
|
+
path_params:
|
|
62
|
+
action: update
|
|
63
|
+
controller: api/v1/repos
|
|
64
|
+
user_id: razum2um
|
|
65
|
+
id: lurker
|
|
66
|
+
"""
|
|
67
|
+
And a file named "spec/requests/updating_repos_spec.rb" with:
|
|
68
|
+
"""ruby
|
|
69
|
+
require "spec_helper"
|
|
70
|
+
|
|
71
|
+
describe Api::V1::ReposController, :lurker, type: :request do
|
|
72
|
+
|
|
73
|
+
let(:user) do
|
|
74
|
+
User.where(name: 'razum2um').first_or_create!
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
let(:repo) do
|
|
78
|
+
user.repos.where(name: 'lurker').first_or_create!
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "updates a repo name" do
|
|
82
|
+
expect {
|
|
83
|
+
patch "/api/v1/users/#{user.name}/repos/#{repo.name}", repo: { name: 'updated-name' }
|
|
84
|
+
expect(response).to be_success
|
|
85
|
+
}.to change { repo.reload.name } .from('lurker').to('updated-name')
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
When I run `bin/rspec spec/requests/updating_repos_spec.rb`
|
|
91
|
+
Then the example should pass
|
|
92
|
+
|
|
93
|
+
Scenario: json schema tests request parameters and tell what fails using "users/update"
|
|
94
|
+
Given a file named "lurker/api/v1/users/__user_id/repos/__id-failed-PATCH.json.yml" with:
|
|
95
|
+
"""yml
|
|
96
|
+
---
|
|
97
|
+
prefix: 'repos management'
|
|
98
|
+
description: 'failed repo updating'
|
|
99
|
+
responseCodes:
|
|
100
|
+
- status: 400
|
|
101
|
+
successful: true
|
|
102
|
+
description: ''
|
|
103
|
+
requestParameters:
|
|
104
|
+
properties:
|
|
105
|
+
id:
|
|
106
|
+
description: ''
|
|
107
|
+
type: string
|
|
108
|
+
example: 1
|
|
109
|
+
user_id:
|
|
110
|
+
description: ''
|
|
111
|
+
type: string
|
|
112
|
+
example: razum2um
|
|
113
|
+
repo:
|
|
114
|
+
description: ''
|
|
115
|
+
type: object
|
|
116
|
+
properties:
|
|
117
|
+
name:
|
|
118
|
+
description: ''
|
|
119
|
+
type: string
|
|
120
|
+
example: ''
|
|
121
|
+
required: []
|
|
122
|
+
required: []
|
|
123
|
+
responseParameters:
|
|
124
|
+
properties:
|
|
125
|
+
errors:
|
|
126
|
+
description: ''
|
|
127
|
+
type: object
|
|
128
|
+
example: 1
|
|
129
|
+
properties:
|
|
130
|
+
name:
|
|
131
|
+
description: ''
|
|
132
|
+
type: array
|
|
133
|
+
items:
|
|
134
|
+
description: ''
|
|
135
|
+
type: string
|
|
136
|
+
example: can't be blank
|
|
137
|
+
required: []
|
|
138
|
+
extensions:
|
|
139
|
+
path_info: "/api/v1/users/razum2um/repos/lurker"
|
|
140
|
+
method: PATCH
|
|
141
|
+
suffix: 'failed'
|
|
142
|
+
path_params:
|
|
143
|
+
action: update
|
|
144
|
+
controller: api/v1/repos
|
|
145
|
+
user_id: razum2um
|
|
146
|
+
id: lurker
|
|
147
|
+
"""
|
|
148
|
+
And a file named "spec/requests/failed_updating_repos_spec.rb" with:
|
|
149
|
+
"""ruby
|
|
150
|
+
require "spec_helper"
|
|
151
|
+
|
|
152
|
+
describe Api::V1::ReposController, type: :request do
|
|
153
|
+
|
|
154
|
+
let(:user) do
|
|
155
|
+
User.where(name: 'razum2um').first_or_create!
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
let(:repo) do
|
|
159
|
+
user.repos.where(name: 'lurker').first_or_create!
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "fails to update a repo with a blank name", lurker: 'failed' do
|
|
163
|
+
expect {
|
|
164
|
+
patch "/api/v1/users/#{user.name}/repos/#{repo.name}", repo: { name: '' }
|
|
165
|
+
expect(response).not_to be_success
|
|
166
|
+
}.not_to change { repo.reload.name }
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
When I run `bin/rspec spec/requests/failed_updating_repos_spec.rb`
|
|
172
|
+
Then the example should pass
|
|
173
|
+
|