restspec-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +35 -0
  3. data/Gemfile +14 -0
  4. data/Gemfile.lock +158 -0
  5. data/LICENSE +22 -0
  6. data/README.md +48 -0
  7. data/Rakefile +1 -0
  8. data/dummy/.gitignore +16 -0
  9. data/dummy/.rspec +2 -0
  10. data/dummy/README.rdoc +28 -0
  11. data/dummy/Rakefile +6 -0
  12. data/dummy/app/assets/images/.keep +0 -0
  13. data/dummy/app/assets/javascripts/application.js +16 -0
  14. data/dummy/app/assets/stylesheets/application.css +15 -0
  15. data/dummy/app/controllers/application_controller.rb +5 -0
  16. data/dummy/app/controllers/concerns/.keep +0 -0
  17. data/dummy/app/helpers/application_helper.rb +2 -0
  18. data/dummy/app/mailers/.keep +0 -0
  19. data/dummy/app/models/.keep +0 -0
  20. data/dummy/app/models/concerns/.keep +0 -0
  21. data/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/dummy/bin/bundle +3 -0
  23. data/dummy/bin/rails +8 -0
  24. data/dummy/bin/rake +8 -0
  25. data/dummy/bin/spring +18 -0
  26. data/dummy/config.ru +4 -0
  27. data/dummy/config/application.rb +31 -0
  28. data/dummy/config/boot.rb +4 -0
  29. data/dummy/config/database.yml +25 -0
  30. data/dummy/config/environment.rb +5 -0
  31. data/dummy/config/environments/development.rb +37 -0
  32. data/dummy/config/environments/production.rb +78 -0
  33. data/dummy/config/environments/test.rb +39 -0
  34. data/dummy/config/initializers/assets.rb +8 -0
  35. data/dummy/config/initializers/backtrace_silencers.rb +7 -0
  36. data/dummy/config/initializers/cookies_serializer.rb +3 -0
  37. data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  38. data/dummy/config/initializers/inflections.rb +16 -0
  39. data/dummy/config/initializers/mime_types.rb +4 -0
  40. data/dummy/config/initializers/session_store.rb +3 -0
  41. data/dummy/config/initializers/wrap_parameters.rb +14 -0
  42. data/dummy/config/locales/en.yml +23 -0
  43. data/dummy/config/routes.rb +56 -0
  44. data/dummy/config/secrets.yml +22 -0
  45. data/dummy/db/schema.rb +16 -0
  46. data/dummy/db/seeds.rb +7 -0
  47. data/dummy/lib/assets/.keep +0 -0
  48. data/dummy/lib/tasks/.keep +0 -0
  49. data/dummy/log/.keep +0 -0
  50. data/dummy/public/404.html +67 -0
  51. data/dummy/public/422.html +67 -0
  52. data/dummy/public/500.html +66 -0
  53. data/dummy/public/favicon.ico +0 -0
  54. data/dummy/public/robots.txt +5 -0
  55. data/dummy/spec/api/restspec/endpoints.rb +5 -0
  56. data/dummy/spec/api/restspec/requirements.rb +0 -0
  57. data/dummy/spec/api/restspec/restspec_config.rb +13 -0
  58. data/dummy/spec/api/restspec/schemas.rb +3 -0
  59. data/dummy/spec/api/secrets_spec.rb +9 -0
  60. data/dummy/spec/rails_helper.rb +58 -0
  61. data/dummy/spec/spec_helper.rb +85 -0
  62. data/dummy/vendor/assets/javascripts/.keep +0 -0
  63. data/dummy/vendor/assets/stylesheets/.keep +0 -0
  64. data/lib/generators/restspec/install_generator.rb +41 -0
  65. data/lib/generators/restspec/templates/restspec_config.rb +13 -0
  66. data/lib/restspec-rails.rb +12 -0
  67. data/lib/restspec/rails/network_adapter.rb +24 -0
  68. data/lib/restspec/rails/version.rb +5 -0
  69. data/restspec-rails.gemspec +28 -0
  70. metadata +186 -0
@@ -0,0 +1,13 @@
1
+ Restspec.configure do |config|
2
+ config.schema_definition = "#{File.dirname __FILE__}/schemas.rb"
3
+ config.endpoints_definition = "#{File.dirname __FILE__}/endpoints.rb"
4
+ config.requirements_definition = "#{File.dirname __FILE__}/requirements.rb"
5
+
6
+ # This is important for Rails :)
7
+ config.request.network_adapter = ->{ Restspec::Rails::NetworkAdapter.new }
8
+
9
+ #
10
+ # => to add custom headers, use config.request.headers like this:
11
+ #
12
+ # config.request.headers['AUTHORIZATION'] = "Token token=\"#{config.custom.api_key}\""
13
+ end
@@ -0,0 +1,12 @@
1
+ require 'rails'
2
+
3
+ require_relative './generators/restspec/install_generator'
4
+ require_relative './restspec/rails/network_adapter'
5
+
6
+ module Restspec
7
+ module Rails
8
+ end
9
+ end
10
+
11
+ class Restspec::Rails::Engine < Rails::Engine
12
+ end
@@ -0,0 +1,24 @@
1
+ module Restspec
2
+ module Rails
3
+ class NetworkAdapter
4
+ include ActionDispatch::Integration::Runner
5
+
6
+ def initialize
7
+ @app = ::Rails.application
8
+ end
9
+
10
+ def request(request_object)
11
+ send request_object.method,
12
+ request_object.url,
13
+ request_object.payload,
14
+ request_object.headers
15
+
16
+ [response.code.to_i, response.headers, response.body]
17
+ end
18
+
19
+ def reset_template_assertion
20
+ nil
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ module Restspec
2
+ module Rails
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require 'restspec/rails/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "restspec-rails"
9
+ spec.version = Restspec::Rails::VERSION
10
+ spec.authors = ["juliogarciag"]
11
+ spec.email = ["julioggonz@gmail.com"]
12
+ spec.summary = %q{Integration between Restspec and Rails}
13
+ spec.description = %q{Integration between Restspec and Rails}
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = []
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "restspec", "~> 0.1"
23
+ spec.add_dependency "rails", [">= 4"]
24
+
25
+ spec.add_development_dependency "sqlite3"
26
+ spec.add_development_dependency "rspec-rails"
27
+ spec.add_development_dependency "pry"
28
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: restspec-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - juliogarciag
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: restspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
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
+ description: Integration between Restspec and Rails
84
+ email:
85
+ - julioggonz@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE
94
+ - README.md
95
+ - Rakefile
96
+ - dummy/.gitignore
97
+ - dummy/.rspec
98
+ - dummy/README.rdoc
99
+ - dummy/Rakefile
100
+ - dummy/app/assets/images/.keep
101
+ - dummy/app/assets/javascripts/application.js
102
+ - dummy/app/assets/stylesheets/application.css
103
+ - dummy/app/controllers/application_controller.rb
104
+ - dummy/app/controllers/concerns/.keep
105
+ - dummy/app/helpers/application_helper.rb
106
+ - dummy/app/mailers/.keep
107
+ - dummy/app/models/.keep
108
+ - dummy/app/models/concerns/.keep
109
+ - dummy/app/views/layouts/application.html.erb
110
+ - dummy/bin/bundle
111
+ - dummy/bin/rails
112
+ - dummy/bin/rake
113
+ - dummy/bin/spring
114
+ - dummy/config.ru
115
+ - dummy/config/application.rb
116
+ - dummy/config/boot.rb
117
+ - dummy/config/database.yml
118
+ - dummy/config/environment.rb
119
+ - dummy/config/environments/development.rb
120
+ - dummy/config/environments/production.rb
121
+ - dummy/config/environments/test.rb
122
+ - dummy/config/initializers/assets.rb
123
+ - dummy/config/initializers/backtrace_silencers.rb
124
+ - dummy/config/initializers/cookies_serializer.rb
125
+ - dummy/config/initializers/filter_parameter_logging.rb
126
+ - dummy/config/initializers/inflections.rb
127
+ - dummy/config/initializers/mime_types.rb
128
+ - dummy/config/initializers/session_store.rb
129
+ - dummy/config/initializers/wrap_parameters.rb
130
+ - dummy/config/locales/en.yml
131
+ - dummy/config/routes.rb
132
+ - dummy/config/secrets.yml
133
+ - dummy/db/schema.rb
134
+ - dummy/db/seeds.rb
135
+ - dummy/lib/assets/.keep
136
+ - dummy/lib/tasks/.keep
137
+ - dummy/log/.keep
138
+ - dummy/public/404.html
139
+ - dummy/public/422.html
140
+ - dummy/public/500.html
141
+ - dummy/public/favicon.ico
142
+ - dummy/public/robots.txt
143
+ - dummy/spec/api/restspec/endpoints.rb
144
+ - dummy/spec/api/restspec/requirements.rb
145
+ - dummy/spec/api/restspec/restspec_config.rb
146
+ - dummy/spec/api/restspec/schemas.rb
147
+ - dummy/spec/api/secrets_spec.rb
148
+ - dummy/spec/rails_helper.rb
149
+ - dummy/spec/spec_helper.rb
150
+ - dummy/vendor/assets/javascripts/.keep
151
+ - dummy/vendor/assets/stylesheets/.keep
152
+ - lib/.DS_Store
153
+ - lib/generators/.DS_Store
154
+ - lib/generators/restspec/.DS_Store
155
+ - lib/generators/restspec/install_generator.rb
156
+ - lib/generators/restspec/templates/restspec_config.rb
157
+ - lib/restspec-rails.rb
158
+ - lib/restspec/.DS_Store
159
+ - lib/restspec/rails/network_adapter.rb
160
+ - lib/restspec/rails/version.rb
161
+ - restspec-rails.gemspec
162
+ homepage: ''
163
+ licenses:
164
+ - MIT
165
+ metadata: {}
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - '>='
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.0.14
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Integration between Restspec and Rails
186
+ test_files: []