restspec-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +158 -0
- data/LICENSE +22 -0
- data/README.md +48 -0
- data/Rakefile +1 -0
- data/dummy/.gitignore +16 -0
- data/dummy/.rspec +2 -0
- data/dummy/README.rdoc +28 -0
- data/dummy/Rakefile +6 -0
- data/dummy/app/assets/images/.keep +0 -0
- data/dummy/app/assets/javascripts/application.js +16 -0
- data/dummy/app/assets/stylesheets/application.css +15 -0
- data/dummy/app/controllers/application_controller.rb +5 -0
- data/dummy/app/controllers/concerns/.keep +0 -0
- data/dummy/app/helpers/application_helper.rb +2 -0
- data/dummy/app/mailers/.keep +0 -0
- data/dummy/app/models/.keep +0 -0
- data/dummy/app/models/concerns/.keep +0 -0
- data/dummy/app/views/layouts/application.html.erb +14 -0
- data/dummy/bin/bundle +3 -0
- data/dummy/bin/rails +8 -0
- data/dummy/bin/rake +8 -0
- data/dummy/bin/spring +18 -0
- data/dummy/config.ru +4 -0
- data/dummy/config/application.rb +31 -0
- data/dummy/config/boot.rb +4 -0
- data/dummy/config/database.yml +25 -0
- data/dummy/config/environment.rb +5 -0
- data/dummy/config/environments/development.rb +37 -0
- data/dummy/config/environments/production.rb +78 -0
- data/dummy/config/environments/test.rb +39 -0
- data/dummy/config/initializers/assets.rb +8 -0
- data/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy/config/initializers/inflections.rb +16 -0
- data/dummy/config/initializers/mime_types.rb +4 -0
- data/dummy/config/initializers/session_store.rb +3 -0
- data/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/dummy/config/locales/en.yml +23 -0
- data/dummy/config/routes.rb +56 -0
- data/dummy/config/secrets.yml +22 -0
- data/dummy/db/schema.rb +16 -0
- data/dummy/db/seeds.rb +7 -0
- data/dummy/lib/assets/.keep +0 -0
- data/dummy/lib/tasks/.keep +0 -0
- data/dummy/log/.keep +0 -0
- data/dummy/public/404.html +67 -0
- data/dummy/public/422.html +67 -0
- data/dummy/public/500.html +66 -0
- data/dummy/public/favicon.ico +0 -0
- data/dummy/public/robots.txt +5 -0
- data/dummy/spec/api/restspec/endpoints.rb +5 -0
- data/dummy/spec/api/restspec/requirements.rb +0 -0
- data/dummy/spec/api/restspec/restspec_config.rb +13 -0
- data/dummy/spec/api/restspec/schemas.rb +3 -0
- data/dummy/spec/api/secrets_spec.rb +9 -0
- data/dummy/spec/rails_helper.rb +58 -0
- data/dummy/spec/spec_helper.rb +85 -0
- data/dummy/vendor/assets/javascripts/.keep +0 -0
- data/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/lib/generators/restspec/install_generator.rb +41 -0
- data/lib/generators/restspec/templates/restspec_config.rb +13 -0
- data/lib/restspec-rails.rb +12 -0
- data/lib/restspec/rails/network_adapter.rb +24 -0
- data/lib/restspec/rails/version.rb +5 -0
- data/restspec-rails.gemspec +28 -0
- metadata +186 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4a85c1e0b68677a1b53b1bb3da63ea42dc828e55
|
4
|
+
data.tar.gz: 309dcbdc6369b47ed4e5b5b533658e63f60e8617
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02c11867df4644f3624d3f160ef73c084fc52eebc623a690f914914d9aacdb3a80014efe2af9437ab43709f81c27df0f5cf12417050cb341c6f7d0050a3d885e
|
7
|
+
data.tar.gz: cb976131e724f2224749050af70698acd74942815fcc247040bbeccc753696df4957782e15b30aaefdf4394c2ae8200e23e15e647e8e5610aea2defd9e7ade53
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.DS_Store
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalisation:
|
25
|
+
/.bundle/
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in punto_pagos_rails.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use debugger
|
14
|
+
# gem 'debugger'
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
restspec-rails (0.0.1)
|
5
|
+
rails (>= 4)
|
6
|
+
restspec (~> 0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionmailer (4.2.0)
|
12
|
+
actionpack (= 4.2.0)
|
13
|
+
actionview (= 4.2.0)
|
14
|
+
activejob (= 4.2.0)
|
15
|
+
mail (~> 2.5, >= 2.5.4)
|
16
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
+
actionpack (4.2.0)
|
18
|
+
actionview (= 4.2.0)
|
19
|
+
activesupport (= 4.2.0)
|
20
|
+
rack (~> 1.6.0)
|
21
|
+
rack-test (~> 0.6.2)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
24
|
+
actionview (4.2.0)
|
25
|
+
activesupport (= 4.2.0)
|
26
|
+
builder (~> 3.1)
|
27
|
+
erubis (~> 2.7.0)
|
28
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
30
|
+
activejob (4.2.0)
|
31
|
+
activesupport (= 4.2.0)
|
32
|
+
globalid (>= 0.3.0)
|
33
|
+
activemodel (4.2.0)
|
34
|
+
activesupport (= 4.2.0)
|
35
|
+
builder (~> 3.1)
|
36
|
+
activerecord (4.2.0)
|
37
|
+
activemodel (= 4.2.0)
|
38
|
+
activesupport (= 4.2.0)
|
39
|
+
arel (~> 6.0)
|
40
|
+
activesupport (4.2.0)
|
41
|
+
i18n (~> 0.7)
|
42
|
+
json (~> 1.7, >= 1.7.7)
|
43
|
+
minitest (~> 5.1)
|
44
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
45
|
+
tzinfo (~> 1.1)
|
46
|
+
arel (6.0.0)
|
47
|
+
builder (3.2.2)
|
48
|
+
coderay (1.1.0)
|
49
|
+
diff-lcs (1.2.5)
|
50
|
+
erubis (2.7.0)
|
51
|
+
faker (1.4.3)
|
52
|
+
i18n (~> 0.5)
|
53
|
+
globalid (0.3.0)
|
54
|
+
activesupport (>= 4.1.0)
|
55
|
+
hashie (3.3.2)
|
56
|
+
httparty (0.13.3)
|
57
|
+
json (~> 1.8)
|
58
|
+
multi_xml (>= 0.5.2)
|
59
|
+
i18n (0.7.0)
|
60
|
+
json (1.8.1)
|
61
|
+
loofah (2.0.1)
|
62
|
+
nokogiri (>= 1.5.9)
|
63
|
+
mail (2.6.3)
|
64
|
+
mime-types (>= 1.16, < 3)
|
65
|
+
method_source (0.8.2)
|
66
|
+
mime-types (2.4.3)
|
67
|
+
mini_portile (0.6.1)
|
68
|
+
minitest (5.5.0)
|
69
|
+
multi_xml (0.5.5)
|
70
|
+
nokogiri (1.6.5)
|
71
|
+
mini_portile (~> 0.6.0)
|
72
|
+
pry (0.10.1)
|
73
|
+
coderay (~> 1.1.0)
|
74
|
+
method_source (~> 0.8.1)
|
75
|
+
slop (~> 3.4)
|
76
|
+
rack (1.6.0)
|
77
|
+
rack-test (0.6.2)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (4.2.0)
|
80
|
+
actionmailer (= 4.2.0)
|
81
|
+
actionpack (= 4.2.0)
|
82
|
+
actionview (= 4.2.0)
|
83
|
+
activejob (= 4.2.0)
|
84
|
+
activemodel (= 4.2.0)
|
85
|
+
activerecord (= 4.2.0)
|
86
|
+
activesupport (= 4.2.0)
|
87
|
+
bundler (>= 1.3.0, < 2.0)
|
88
|
+
railties (= 4.2.0)
|
89
|
+
sprockets-rails
|
90
|
+
rails-deprecated_sanitizer (1.0.3)
|
91
|
+
activesupport (>= 4.2.0.alpha)
|
92
|
+
rails-dom-testing (1.0.5)
|
93
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
94
|
+
nokogiri (~> 1.6.0)
|
95
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
96
|
+
rails-html-sanitizer (1.0.1)
|
97
|
+
loofah (~> 2.0)
|
98
|
+
railties (4.2.0)
|
99
|
+
actionpack (= 4.2.0)
|
100
|
+
activesupport (= 4.2.0)
|
101
|
+
rake (>= 0.8.7)
|
102
|
+
thor (>= 0.18.1, < 2.0)
|
103
|
+
rake (10.4.2)
|
104
|
+
restspec (0.1)
|
105
|
+
activesupport (~> 4.0)
|
106
|
+
faker (~> 1.4)
|
107
|
+
hashie (~> 3.3)
|
108
|
+
httparty (~> 0.13)
|
109
|
+
rack (~> 1.0)
|
110
|
+
rspec (~> 3.0)
|
111
|
+
rspec-collection_matchers (~> 1.0)
|
112
|
+
rspec-its (~> 1.0)
|
113
|
+
thor (~> 0.19)
|
114
|
+
tilt (~> 2.0)
|
115
|
+
rspec (3.1.0)
|
116
|
+
rspec-core (~> 3.1.0)
|
117
|
+
rspec-expectations (~> 3.1.0)
|
118
|
+
rspec-mocks (~> 3.1.0)
|
119
|
+
rspec-collection_matchers (1.1.2)
|
120
|
+
rspec-expectations (>= 2.99.0.beta1)
|
121
|
+
rspec-core (3.1.7)
|
122
|
+
rspec-support (~> 3.1.0)
|
123
|
+
rspec-expectations (3.1.2)
|
124
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
125
|
+
rspec-support (~> 3.1.0)
|
126
|
+
rspec-its (1.1.0)
|
127
|
+
rspec-core (>= 3.0.0)
|
128
|
+
rspec-expectations (>= 3.0.0)
|
129
|
+
rspec-mocks (3.1.3)
|
130
|
+
rspec-support (~> 3.1.0)
|
131
|
+
rspec-rails (3.1.0)
|
132
|
+
actionpack (>= 3.0)
|
133
|
+
activesupport (>= 3.0)
|
134
|
+
railties (>= 3.0)
|
135
|
+
rspec-core (~> 3.1.0)
|
136
|
+
rspec-expectations (~> 3.1.0)
|
137
|
+
rspec-mocks (~> 3.1.0)
|
138
|
+
rspec-support (~> 3.1.0)
|
139
|
+
rspec-support (3.1.2)
|
140
|
+
slop (3.6.0)
|
141
|
+
sprockets (1.0.2)
|
142
|
+
sprockets-rails (0.0.1)
|
143
|
+
sprockets (>= 1.0.2)
|
144
|
+
sqlite3 (1.3.10)
|
145
|
+
thor (0.19.1)
|
146
|
+
thread_safe (0.3.4)
|
147
|
+
tilt (2.0.0)
|
148
|
+
tzinfo (1.2.2)
|
149
|
+
thread_safe (~> 0.1)
|
150
|
+
|
151
|
+
PLATFORMS
|
152
|
+
ruby
|
153
|
+
|
154
|
+
DEPENDENCIES
|
155
|
+
pry
|
156
|
+
restspec-rails!
|
157
|
+
rspec-rails
|
158
|
+
sqlite3
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Platanus
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# restspec-rails
|
2
|
+
|
3
|
+
Integrates [Restspec](https://github.com/platanus/restspec) inside a Rails application. It won't need any url as with regular restspec use to work because it uses the Rails's internal integration framework to perform mock requests.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add it to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'restspec-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
Install it (note: You need to have installed RSpec first):
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
rails g restspec:install
|
17
|
+
```
|
18
|
+
|
19
|
+
It will generate a similar structure to the regular Restspec one.
|
20
|
+
|
21
|
+
## Some Caveats
|
22
|
+
|
23
|
+
### Rails throws too many Exceptions
|
24
|
+
|
25
|
+
The regular Restspec use usually have lines like this:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
it { should have_status(404) }
|
29
|
+
```
|
30
|
+
|
31
|
+
That assumes that the response will finish correctly. In test and development environments, Rails raises exceptions making RSpec to re-raise it and not allowing the test to finish. It's important, for this kind of tasks, that this setting is activated in `config/test.rb`:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
config.action_dispatch.show_exceptions = true
|
35
|
+
```
|
36
|
+
|
37
|
+
Another possible solution, more complex and difficult, inside this gem (so you don't have to change your `config/test` file) could be discussed in the future.
|
38
|
+
|
39
|
+
### "RSpec Controller Tests are a bit weird"
|
40
|
+
|
41
|
+
Rails controller unit tests can be seen as duplication by some people. So, for this people, you might want to disable the generation of specs alongside controllers. This can be done adding this in your `application.rb` file:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
config.generators do |g|
|
45
|
+
g.controller_specs false
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/dummy/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*.log
|
16
|
+
/tmp
|
data/dummy/.rspec
ADDED
data/dummy/README.rdoc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require turbolinks
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/dummy/bin/bundle
ADDED
data/dummy/bin/rails
ADDED