dolt 0.25.0 → 0.26.0

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.
@@ -20,19 +20,22 @@ require "dolt/sinatra/actions"
20
20
 
21
21
  describe Dolt::Sinatra::Actions do
22
22
  describe "#blob" do
23
- it "delegates to actions" do
24
- actions = Test::Actions.new(Stub::Blob.new)
25
- app = Test::SinatraApp.new(actions, Test::Renderer.new)
26
- app.blob("gitorious", "master", "app/models/repository.rb")
23
+ it "delegates to lookup" do
24
+ lookup = Test::Lookup.new(Stub::Blob.new)
25
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new)
26
+
27
+ dolt.blob("gitorious", "master", "app/models/repository.rb")
27
28
 
28
- assert_equal "gitorious", actions.repo
29
- assert_equal "master", actions.ref
30
- assert_equal "app/models/repository.rb", actions.path
29
+ assert_equal "gitorious", lookup.repo
30
+ assert_equal "master", lookup.ref
31
+ assert_equal "app/models/repository.rb", lookup.path
31
32
  end
32
33
 
33
34
  it "renders the blob template as html" do
34
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
35
- app.blob("gitorious", "master", "app/models/repository.rb")
35
+ app = Test::App.new
36
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
37
+
38
+ dolt.blob("gitorious", "master", "app/models/repository.rb")
36
39
 
37
40
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
38
41
  assert_equal "blob:Blob", app.body
@@ -40,15 +43,18 @@ describe Dolt::Sinatra::Actions do
40
43
 
41
44
  it "renders the blob template with custom data" do
42
45
  renderer = Test::Renderer.new("Blob")
43
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), renderer)
44
- app.blob("gitorious", "master", "app/models/repository.rb", { :who => 42 })
46
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Blob.new), renderer)
47
+
48
+ dolt.blob("gitorious", "master", "app/models/repository.rb", { :who => 42 })
45
49
 
46
50
  assert_equal 42, renderer.data[:who]
47
51
  end
48
52
 
49
53
  it "redirects tree views to tree action" do
50
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
51
- app.blob("gitorious", "master", "app/models")
54
+ app = Test::App.new
55
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
56
+
57
+ dolt.blob("gitorious", "master", "app/models")
52
58
 
53
59
  assert_equal 302, app.response.status
54
60
  assert_equal "/gitorious/tree/master:app/models", app.response["Location"]
@@ -56,16 +62,19 @@ describe Dolt::Sinatra::Actions do
56
62
  end
57
63
 
58
64
  it "unescapes ref" do
59
- actions = Test::Actions.new(Stub::Blob.new)
60
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Blob"))
61
- app.blob("gitorious", "issue-%23221", "app/my documents")
65
+ lookup = Test::Lookup.new(Stub::Blob.new)
66
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Blob"))
67
+
68
+ dolt.blob("gitorious", "issue-%23221", "app/my documents")
62
69
 
63
- assert_equal "issue-#221", actions.ref
70
+ assert_equal "issue-#221", lookup.ref
64
71
  end
65
72
 
66
73
  it "does not redirect ref to oid by default" do
67
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
68
- app.blob("gitorious", "master", "lib/gitorious.rb")
74
+ app = Test::App.new
75
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
76
+
77
+ dolt.blob("gitorious", "master", "lib/gitorious.rb")
69
78
 
70
79
  location = app.response["Location"]
71
80
  refute_equal 302, app.response.status
@@ -73,8 +82,10 @@ describe Dolt::Sinatra::Actions do
73
82
  end
74
83
 
75
84
  it "redirects ref to oid if configured so" do
76
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
77
- app.blob("gitorious", "master", "lib/gitorious.rb")
85
+ app = Test::RedirectingApp.new
86
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
87
+
88
+ dolt.blob("gitorious", "master", "lib/gitorious.rb")
78
89
 
79
90
  location = app.response["Location"]
80
91
  assert_equal 307, app.response.status
@@ -85,18 +96,21 @@ describe Dolt::Sinatra::Actions do
85
96
 
86
97
  describe "#tree" do
87
98
  it "delegates to actions" do
88
- actions = Test::Actions.new(Stub::Tree.new)
89
- app = Test::SinatraApp.new(actions, Test::Renderer.new)
90
- app.tree("gitorious", "master", "app/models")
99
+ lookup = Test::Lookup.new(Stub::Tree.new)
100
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new)
101
+
102
+ dolt.tree("gitorious", "master", "app/models")
91
103
 
92
- assert_equal "gitorious", actions.repo
93
- assert_equal "master", actions.ref
94
- assert_equal "app/models", actions.path
104
+ assert_equal "gitorious", lookup.repo
105
+ assert_equal "master", lookup.ref
106
+ assert_equal "app/models", lookup.path
95
107
  end
96
108
 
97
109
  it "renders the tree template as html" do
98
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
99
- app.tree("gitorious", "master", "app/models")
110
+ app = Test::App.new
111
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
112
+
113
+ dolt.tree("gitorious", "master", "app/models")
100
114
 
101
115
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
102
116
  assert_equal "tree:Tree", app.body
@@ -104,15 +118,18 @@ describe Dolt::Sinatra::Actions do
104
118
 
105
119
  it "renders template with custom data" do
106
120
  renderer = Test::Renderer.new("Tree")
107
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), renderer)
108
- app.tree("gitorious", "master", "app/models", { :who => 42 })
121
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Tree.new), renderer)
122
+
123
+ dolt.tree("gitorious", "master", "app/models", { :who => 42 })
109
124
 
110
125
  assert_equal 42, renderer.data[:who]
111
126
  end
112
127
 
113
128
  it "redirects blob views to blob action" do
114
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Tree"))
115
- app.tree("gitorious", "master", "app/models/repository.rb")
129
+ app = Test::App.new
130
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Tree"))
131
+
132
+ dolt.tree("gitorious", "master", "app/models/repository.rb")
116
133
 
117
134
  location = app.response["Location"]
118
135
  assert_equal 302, app.response.status
@@ -121,38 +138,47 @@ describe Dolt::Sinatra::Actions do
121
138
  end
122
139
 
123
140
  it "sets X-UA-Compatible header" do
124
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
125
- app.tree("gitorious", "master", "app/models")
141
+ app = Test::App.new
142
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
143
+
144
+ dolt.tree("gitorious", "master", "app/models")
126
145
 
127
146
  assert_equal "IE=edge", app.response["X-UA-Compatible"]
128
147
  end
129
148
 
130
149
  it "does not set cache-control header for head ref" do
131
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
132
- app.tree("gitorious", "master", "app/models")
150
+ app = Test::App.new
151
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
152
+
153
+ dolt.tree("gitorious", "master", "app/models")
133
154
 
134
155
  assert !app.response.key?("Cache-Control")
135
156
  end
136
157
 
137
158
  it "sets cache headers for full oid ref" do
138
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
139
- app.tree("gitorious", "a" * 40, "app/models")
159
+ app = Test::App.new
160
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
161
+
162
+ dolt.tree("gitorious", "a" * 40, "app/models")
140
163
 
141
164
  assert_equal "max-age=315360000, public", app.response["Cache-Control"]
142
165
  refute_nil app.response["Expires"]
143
166
  end
144
167
 
145
168
  it "unescapes ref" do
146
- actions = Test::Actions.new(Stub::Tree.new)
147
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Tree"))
148
- app.tree("gitorious", "issue-%23221", "app")
169
+ lookup = Test::Lookup.new(Stub::Tree.new)
170
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Tree"))
149
171
 
150
- assert_equal "issue-#221", actions.ref
172
+ dolt.tree("gitorious", "issue-%23221", "app")
173
+
174
+ assert_equal "issue-#221", lookup.ref
151
175
  end
152
176
 
153
177
  it "redirects ref to oid if configured so" do
154
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
155
- app.tree("gitorious", "master", "lib")
178
+ app = Test::RedirectingApp.new
179
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
180
+
181
+ dolt.tree("gitorious", "master", "lib")
156
182
 
157
183
  assert_equal 307, app.response.status
158
184
  assert_equal "/gitorious/tree/#{'a' * 40}:lib", app.response["Location"]
@@ -161,8 +187,10 @@ describe Dolt::Sinatra::Actions do
161
187
 
162
188
  describe "#tree_entry" do
163
189
  it "renders trees with the tree template as html" do
164
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
165
- app.tree_entry("gitorious", "master", "app/models")
190
+ app = Test::App.new
191
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
192
+
193
+ dolt.tree_entry("gitorious", "master", "app/models")
166
194
 
167
195
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
168
196
  assert_equal "tree:Tree", app.body
@@ -170,31 +198,37 @@ describe Dolt::Sinatra::Actions do
170
198
 
171
199
  it "renders template with custom data" do
172
200
  renderer = Test::Renderer.new("Tree")
173
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), renderer)
174
- app.tree_entry("gitorious", "master", "app/models", { :who => 42 })
201
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Tree.new), renderer)
202
+
203
+ dolt.tree_entry("gitorious", "master", "app/models", { :who => 42 })
175
204
 
176
205
  assert_equal 42, renderer.data[:who]
177
206
  end
178
207
 
179
208
  it "renders trees with the tree template as html" do
180
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
181
- app.tree_entry("gitorious", "master", "app/models")
209
+ app = Test::App.new
210
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
211
+
212
+ dolt.tree_entry("gitorious", "master", "app/models")
182
213
 
183
214
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
184
215
  assert_equal "blob:Blob", app.body
185
216
  end
186
217
 
187
218
  it "unescapes ref" do
188
- actions = Test::Actions.new(Stub::Tree.new)
189
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Tree"))
190
- app.tree_entry("gitorious", "issue-%23221", "app")
219
+ lookup = Test::Lookup.new(Stub::Tree.new)
220
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Tree"))
221
+
222
+ dolt.tree_entry("gitorious", "issue-%23221", "app")
191
223
 
192
- assert_equal "issue-#221", actions.ref
224
+ assert_equal "issue-#221", lookup.ref
193
225
  end
194
226
 
195
227
  it "redirects ref to oid if configured so" do
196
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
197
- app.tree_entry("gitorious", "master", "lib")
228
+ app = Test::RedirectingApp.new
229
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
230
+
231
+ dolt.tree_entry("gitorious", "master", "lib")
198
232
 
199
233
  assert_equal 307, app.response.status
200
234
  assert_equal "/gitorious/source/#{'a' * 40}:lib", app.response["Location"]
@@ -202,19 +236,22 @@ describe Dolt::Sinatra::Actions do
202
236
  end
203
237
 
204
238
  describe "#raw" do
205
- it "delegates to actions" do
206
- actions = Test::Actions.new(Stub::Blob.new)
207
- app = Test::SinatraApp.new(actions, Test::Renderer.new)
208
- app.raw("gitorious", "master", "app/models/repository.rb")
239
+ it "delegates to lookup" do
240
+ lookup = Test::Lookup.new(Stub::Blob.new)
241
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new)
209
242
 
210
- assert_equal "gitorious", actions.repo
211
- assert_equal "master", actions.ref
212
- assert_equal "app/models/repository.rb", actions.path
243
+ dolt.raw("gitorious", "master", "app/models/repository.rb")
244
+
245
+ assert_equal "gitorious", lookup.repo
246
+ assert_equal "master", lookup.ref
247
+ assert_equal "app/models/repository.rb", lookup.path
213
248
  end
214
249
 
215
250
  it "renders the raw template as text" do
216
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Text"))
217
- app.raw("gitorious", "master", "app/models/repository.rb")
251
+ app = Test::App.new
252
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Text"))
253
+
254
+ dolt.raw("gitorious", "master", "app/models/repository.rb")
218
255
 
219
256
  assert_equal "text/plain", app.response["Content-Type"]
220
257
  assert_equal "raw:Text", app.body
@@ -222,15 +259,18 @@ describe Dolt::Sinatra::Actions do
222
259
 
223
260
  it "renders template with custom data" do
224
261
  renderer = Test::Renderer.new("Text")
225
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), renderer)
226
- app.raw("gitorious", "master", "app/models/repository.rb", { :who => 42 })
262
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Blob.new), renderer)
263
+
264
+ dolt.raw("gitorious", "master", "app/models/repository.rb", { :who => 42 })
227
265
 
228
266
  assert_equal 42, renderer.data[:who]
229
267
  end
230
268
 
231
269
  it "redirects tree views to tree action" do
232
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
233
- app.raw("gitorious", "master", "app/models")
270
+ app = Test::App.new
271
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
272
+
273
+ dolt.raw("gitorious", "master", "app/models")
234
274
 
235
275
  location = app.response["Location"]
236
276
  assert_equal 302, app.response.status
@@ -239,16 +279,19 @@ describe Dolt::Sinatra::Actions do
239
279
  end
240
280
 
241
281
  it "unescapes ref" do
242
- actions = Test::Actions.new(Stub::Blob.new)
243
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Blob"))
244
- app.raw("gitorious", "issue-%23221", "app/models/repository.rb")
282
+ lookup = Test::Lookup.new(Stub::Blob.new)
283
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Blob"))
284
+
285
+ dolt.raw("gitorious", "issue-%23221", "app/models/repository.rb")
245
286
 
246
- assert_equal "issue-#221", actions.ref
287
+ assert_equal "issue-#221", lookup.ref
247
288
  end
248
289
 
249
290
  it "redirects ref to oid if configured so" do
250
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
251
- app.raw("gitorious", "master", "lib/gitorious.rb")
291
+ app = Test::RedirectingApp.new
292
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
293
+
294
+ dolt.raw("gitorious", "master", "lib/gitorious.rb")
252
295
 
253
296
  assert_equal 307, app.response.status
254
297
  assert_equal "/gitorious/raw/#{'a' * 40}:lib/gitorious.rb", app.response["Location"]
@@ -256,19 +299,22 @@ describe Dolt::Sinatra::Actions do
256
299
  end
257
300
 
258
301
  describe "#blame" do
259
- it "delegates to actions" do
260
- actions = Test::Actions.new(Stub::Blob.new)
261
- app = Test::SinatraApp.new(actions, Test::Renderer.new)
262
- app.blame("gitorious", "master", "app/models/repository.rb")
302
+ it "delegates to lookup" do
303
+ lookup = Test::Lookup.new(Stub::Blob.new)
304
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new)
305
+
306
+ dolt.blame("gitorious", "master", "app/models/repository.rb")
263
307
 
264
- assert_equal "gitorious", actions.repo
265
- assert_equal "master", actions.ref
266
- assert_equal "app/models/repository.rb", actions.path
308
+ assert_equal "gitorious", lookup.repo
309
+ assert_equal "master", lookup.ref
310
+ assert_equal "app/models/repository.rb", lookup.path
267
311
  end
268
312
 
269
313
  it "renders the blame template as html" do
270
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Text"))
271
- app.blame("gitorious", "master", "app/models/repository.rb")
314
+ app = Test::App.new
315
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Text"))
316
+
317
+ dolt.blame("gitorious", "master", "app/models/repository.rb")
272
318
 
273
319
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
274
320
  assert_equal "blame:Text", app.body
@@ -276,23 +322,27 @@ describe Dolt::Sinatra::Actions do
276
322
 
277
323
  it "renders template with custom data" do
278
324
  renderer = Test::Renderer.new("Text")
279
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), renderer)
280
- app.blame("gitorious", "master", "app/models/repository.rb", { :who => 42 })
325
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Blob.new), renderer)
326
+
327
+ dolt.blame("gitorious", "master", "app/models/repository.rb", { :who => 42 })
281
328
 
282
329
  assert_equal 42, renderer.data[:who]
283
330
  end
284
331
 
285
332
  it "unescapes ref" do
286
- actions = Test::Actions.new(Stub::Blob.new)
287
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Blob"))
288
- app.blame("gitorious", "issue-%23221", "app/models/repository.rb")
333
+ lookup = Test::Lookup.new(Stub::Blob.new)
334
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Blob"))
335
+
336
+ dolt.blame("gitorious", "issue-%23221", "app/models/repository.rb")
289
337
 
290
- assert_equal "issue-#221", actions.ref
338
+ assert_equal "issue-#221", lookup.ref
291
339
  end
292
340
 
293
341
  it "redirects ref to oid if configured so" do
294
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
295
- app.blame("gitorious", "master", "lib/gitorious.rb")
342
+ app = Test::RedirectingApp.new
343
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
344
+
345
+ dolt.blame("gitorious", "master", "lib/gitorious.rb")
296
346
 
297
347
  assert_equal 307, app.response.status
298
348
  assert_equal "/gitorious/blame/#{'a' * 40}:lib/gitorious.rb", app.response["Location"]
@@ -300,19 +350,21 @@ describe Dolt::Sinatra::Actions do
300
350
  end
301
351
 
302
352
  describe "#history" do
303
- it "delegates to actions" do
304
- actions = Test::Actions.new(Stub::Blob.new)
305
- app = Test::SinatraApp.new(actions, Test::Renderer.new)
306
- app.history("gitorious", "master", "app/models/repository.rb", 10)
353
+ it "delegates to lookup" do
354
+ lookup = Test::Lookup.new(Stub::Blob.new)
355
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new)
356
+ dolt.history("gitorious", "master", "app/models/repository.rb", 10)
307
357
 
308
- assert_equal "gitorious", actions.repo
309
- assert_equal "master", actions.ref
310
- assert_equal "app/models/repository.rb", actions.path
358
+ assert_equal "gitorious", lookup.repo
359
+ assert_equal "master", lookup.ref
360
+ assert_equal "app/models/repository.rb", lookup.path
311
361
  end
312
362
 
313
363
  it "renders the commits template as html" do
314
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Text"))
315
- app.history("gitorious", "master", "app/models/repository.rb", 10)
364
+ app = Test::App.new
365
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Text"))
366
+
367
+ dolt.history("gitorious", "master", "app/models/repository.rb", 10)
316
368
 
317
369
  assert_equal "text/html; charset=utf-8", app.response["Content-Type"]
318
370
  assert_equal "commits:Text", app.body
@@ -320,23 +372,27 @@ describe Dolt::Sinatra::Actions do
320
372
 
321
373
  it "renders template with custom data" do
322
374
  renderer = Test::Renderer.new("Text")
323
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), renderer)
324
- app.history("gitorious", "master", "app/models/repository.rb", 10, { :who => 42 })
375
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Blob.new), renderer)
376
+
377
+ dolt.history("gitorious", "master", "app/models/repository.rb", 10, { :who => 42 })
325
378
 
326
379
  assert_equal 42, renderer.data[:who]
327
380
  end
328
381
 
329
382
  it "unescapes ref" do
330
- actions = Test::Actions.new(Stub::Blob.new)
331
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Blob"))
332
- app.history("gitorious", "issue-%23221", "lib/gitorious.rb", 10)
383
+ lookup = Test::Lookup.new(Stub::Blob.new)
384
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Blob"))
333
385
 
334
- assert_equal "issue-#221", actions.ref
386
+ dolt.history("gitorious", "issue-%23221", "lib/gitorious.rb", 10)
387
+
388
+ assert_equal "issue-#221", lookup.ref
335
389
  end
336
390
 
337
391
  it "redirects ref to oid if configured so" do
338
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("Blob"))
339
- app.history("gitorious", "master", "lib/gitorious.rb", 10)
392
+ app = Test::RedirectingApp.new
393
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("Blob"))
394
+
395
+ dolt.history("gitorious", "master", "lib/gitorious.rb", 10)
340
396
 
341
397
  assert_equal 307, app.response.status
342
398
  assert_equal "/gitorious/history/#{'a' * 40}:lib/gitorious.rb", app.response["Location"]
@@ -345,8 +401,10 @@ describe Dolt::Sinatra::Actions do
345
401
 
346
402
  describe "#refs" do
347
403
  it "renders the refs template as json" do
348
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), Test::Renderer.new("JSON"))
349
- app.refs("gitorious")
404
+ app = Test::App.new
405
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Blob.new), Test::Renderer.new("JSON"))
406
+
407
+ dolt.refs("gitorious")
350
408
 
351
409
  assert_equal "application/json", app.response["Content-Type"]
352
410
  assert_equal "refs:JSON", app.body
@@ -354,8 +412,9 @@ describe Dolt::Sinatra::Actions do
354
412
 
355
413
  it "renders template with custom data" do
356
414
  renderer = Test::Renderer.new("Text")
357
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Blob.new), renderer)
358
- app.refs("gitorious", { :who => 42 })
415
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Blob.new), renderer)
416
+
417
+ dolt.refs("gitorious", { :who => 42 })
359
418
 
360
419
  assert_equal 42, renderer.data[:who]
361
420
  end
@@ -363,8 +422,10 @@ describe Dolt::Sinatra::Actions do
363
422
 
364
423
  describe "#tree_history" do
365
424
  it "renders the tree_history template as json" do
366
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("JSON"))
367
- app.tree_history("gitorious", "master", "", 1)
425
+ app = Test::App.new
426
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("JSON"))
427
+
428
+ dolt.tree_history("gitorious", "master", "", 1)
368
429
 
369
430
  assert_equal "application/json", app.response["Content-Type"]
370
431
  assert_equal "tree_history:JSON", app.body
@@ -372,23 +433,27 @@ describe Dolt::Sinatra::Actions do
372
433
 
373
434
  it "renders template with custom data" do
374
435
  renderer = Test::Renderer.new("Text")
375
- app = Test::SinatraApp.new(Test::Actions.new(Stub::Tree.new), renderer)
376
- app.tree_history("gitorious", "master", "app/models", 1, { :who => 42 })
436
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, Test::Lookup.new(Stub::Tree.new), renderer)
437
+
438
+ dolt.tree_history("gitorious", "master", "app/models", 1, { :who => 42 })
377
439
 
378
440
  assert_equal 42, renderer.data[:who]
379
441
  end
380
442
 
381
443
  it "unescapes ref" do
382
- actions = Test::Actions.new(Stub::Tree.new)
383
- app = Test::SinatraApp.new(actions, Test::Renderer.new("Tree"))
384
- app.tree_history("gitorious", "issue-%23221", "app/models")
444
+ lookup = Test::Lookup.new(Stub::Tree.new)
445
+ dolt = Dolt::Sinatra::Actions.new(Test::App.new, lookup, Test::Renderer.new("Tree"))
385
446
 
386
- assert_equal "issue-#221", actions.ref
447
+ dolt.tree_history("gitorious", "issue-%23221", "app/models")
448
+
449
+ assert_equal "issue-#221", lookup.ref
387
450
  end
388
451
 
389
452
  it "redirects ref to oid if configured so" do
390
- app = Test::RedirectingSinatraApp.new(Test::Actions.new(Stub::Tree.new), Test::Renderer.new("Tree"))
391
- app.tree_history("gitorious", "master", "lib", 10)
453
+ app = Test::RedirectingApp.new
454
+ dolt = Dolt::Sinatra::Actions.new(app, Test::Lookup.new(Stub::Tree.new), Test::Renderer.new("Tree"))
455
+
456
+ dolt.tree_history("gitorious", "master", "lib", 10)
392
457
 
393
458
  assert_equal 307, app.response.status
394
459
  assert_equal "/gitorious/tree_history/#{'a' * 40}:lib", app.response["Location"]