rspec_api_documentation 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require 'rack/test'
2
2
  require 'webmock'
3
+ require 'rspec/core/formatters/base_formatter'
3
4
 
4
5
  module RspecApiDocumentation
5
6
  module DSL
@@ -62,7 +63,12 @@ module RspecApiDocumentation
62
63
  end
63
64
 
64
65
  def example_request(description, params = {}, &block)
65
- example(description) do
66
+ file_path = caller.first[0, caller.first =~ /:/]
67
+
68
+ location = caller.first[0, caller.first =~ /(:in|$)/]
69
+ location = RSpec::Core::Formatters::BaseFormatter::relative_path(location)
70
+
71
+ example description, :location => location, :file_path => file_path do
66
72
  do_request(params)
67
73
  instance_eval &block if block_given?
68
74
  end
@@ -215,3 +221,4 @@ end
215
221
 
216
222
  RSpec.configuration.include RspecApiDocumentation::DSL, :api_docs_dsl => true
217
223
  RSpec.configuration.include Rack::Test::Methods, :api_docs_dsl => true
224
+ RSpec.configuration.backtrace_clean_patterns << %r{lib/rspec_api_documentation/dsl\.rb}
@@ -19,7 +19,7 @@ module RspecApiDocumentation
19
19
  super || example.metadata.has_key?(method_sym) || example.respond_to?(method_sym, include_private)
20
20
  end
21
21
 
22
- def method
22
+ def http_method
23
23
  metadata[:method]
24
24
  end
25
25
 
@@ -45,8 +45,6 @@ module RspecApiDocumentation
45
45
  end
46
46
 
47
47
  class HtmlExample < Mustache
48
- delegate :method, :to => :@example
49
-
50
48
  def initialize(example, configuration)
51
49
  @example = example
52
50
  @host = configuration.curl_host
@@ -59,8 +59,6 @@ module RspecApiDocumentation
59
59
  end
60
60
 
61
61
  class JsonExample
62
- delegate :method, :to => :@example
63
-
64
62
  def initialize(example, configuration)
65
63
  @example = example
66
64
  @host = configuration.curl_host
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec_api_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-03-09 00:00:00.000000000Z
14
+ date: 2012-03-28 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec
18
- requirement: &70168848825740 !ruby/object:Gem::Requirement
18
+ requirement: &70309790793000 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 2.6.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70168848825740
26
+ version_requirements: *70309790793000
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
- requirement: &70168848825040 !ruby/object:Gem::Requirement
29
+ requirement: &70309790792540 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 3.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70168848825040
37
+ version_requirements: *70309790792540
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: i18n
40
- requirement: &70168848824520 !ruby/object:Gem::Requirement
40
+ requirement: &70309790792060 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 0.1.0
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70168848824520
48
+ version_requirements: *70309790792060
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rack-test
51
- requirement: &70168848823840 !ruby/object:Gem::Requirement
51
+ requirement: &70309790791600 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 0.5.5
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *70168848823840
59
+ version_requirements: *70309790791600
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: mustache
62
- requirement: &70168848823040 !ruby/object:Gem::Requirement
62
+ requirement: &70309790774380 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 0.99.0
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *70168848823040
70
+ version_requirements: *70309790774380
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: webmock
73
- requirement: &70168848822260 !ruby/object:Gem::Requirement
73
+ requirement: &70309790773820 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 1.7.0
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *70168848822260
81
+ version_requirements: *70309790773820
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: json
84
- requirement: &70168848821420 !ruby/object:Gem::Requirement
84
+ requirement: &70309790773260 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 1.4.0
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *70168848821420
92
+ version_requirements: *70309790773260
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: fakefs
95
- requirement: &70168848820680 !ruby/object:Gem::Requirement
95
+ requirement: &70309790772820 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,10 +100,10 @@ dependencies:
100
100
  version: '0'
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *70168848820680
103
+ version_requirements: *70309790772820
104
104
  - !ruby/object:Gem::Dependency
105
105
  name: sinatra
106
- requirement: &70168848820160 !ruby/object:Gem::Requirement
106
+ requirement: &70309790772320 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ! '>='
@@ -111,10 +111,10 @@ dependencies:
111
111
  version: '0'
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *70168848820160
114
+ version_requirements: *70309790772320
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: builder
117
- requirement: &70168848819680 !ruby/object:Gem::Requirement
117
+ requirement: &70309790771800 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ! '>='
@@ -122,10 +122,10 @@ dependencies:
122
122
  version: '0'
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *70168848819680
125
+ version_requirements: *70309790771800
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: aruba
128
- requirement: &70168848819180 !ruby/object:Gem::Requirement
128
+ requirement: &70309790771320 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ! '>='
@@ -133,10 +133,10 @@ dependencies:
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
- version_requirements: *70168848819180
136
+ version_requirements: *70309790771320
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: capybara
139
- requirement: &70168848818700 !ruby/object:Gem::Requirement
139
+ requirement: &70309790770900 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ! '>='
@@ -144,7 +144,18 @@ dependencies:
144
144
  version: '0'
145
145
  type: :development
146
146
  prerelease: false
147
- version_requirements: *70168848818700
147
+ version_requirements: *70309790770900
148
+ - !ruby/object:Gem::Dependency
149
+ name: rake
150
+ requirement: &70309790769980 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: *70309790769980
148
159
  description: Generate API docs from your test suite
149
160
  email:
150
161
  - chris@smartlogicsolutions.com
@@ -189,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
200
  version: 1.3.6
190
201
  requirements: []
191
202
  rubyforge_project:
192
- rubygems_version: 1.8.10
203
+ rubygems_version: 1.8.15
193
204
  signing_key:
194
205
  specification_version: 3
195
206
  summary: A double black belt for your docs