dredd-rack 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dredd/rack/rake_task.rb +7 -1
- data/lib/dredd/rack/version.rb +1 -1
- data/spec/lib/dredd/rack/rake_task_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 451bcf6ce5445a6b1b6e82405f8c09e0a1c6a03d
|
4
|
+
data.tar.gz: 911261ff25e1fca55e20c54a1f4aac62bb93fc6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7254c4134bd9cc4b0b16f26b7ce703c4854fe9a191fa98dcd3df59cba5777f0d282600d465af57063a18c5d58205b06dc2484bbcdf663e6f995d080d2d51f10f
|
7
|
+
data.tar.gz: ac25fd2bbaa21def1c3833dba3aab9448ee9be2569bee23f3581a66a4e2060ce034579957a7381d2c21b5975fdc278fbe05533fba3485af3f029cefcb8cef791
|
data/lib/dredd/rack/rake_task.rb
CHANGED
@@ -53,10 +53,12 @@ module Dredd
|
|
53
53
|
@runner = Dredd::Rack::Runner.new(ENV['API_HOST'])
|
54
54
|
|
55
55
|
desc description unless ::Rake.application.last_comment
|
56
|
-
task name, *args do |task_args|
|
56
|
+
rake_task = task name, *args do |task_args|
|
57
57
|
task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
|
58
58
|
run_task(runner)
|
59
59
|
end
|
60
|
+
|
61
|
+
integrate_with_rails!(rake_task)
|
60
62
|
end
|
61
63
|
|
62
64
|
private
|
@@ -122,6 +124,10 @@ module Dredd
|
|
122
124
|
#{Rainbow('Verify the API conformance against its blueprint.').blue}
|
123
125
|
eos
|
124
126
|
end
|
127
|
+
|
128
|
+
def integrate_with_rails!(rake_task)
|
129
|
+
rake_task.enhance([:environment]) if Rake::Task.task_defined? :environment
|
130
|
+
end
|
125
131
|
end
|
126
132
|
end
|
127
133
|
end
|
data/lib/dredd/rack/version.rb
CHANGED
@@ -18,6 +18,14 @@ describe Dredd::Rack::RakeTask do
|
|
18
18
|
expect(subject).to respond_to :name
|
19
19
|
end
|
20
20
|
|
21
|
+
context 'when initialized' do
|
22
|
+
|
23
|
+
it 'ensures integration with Rails', protected: true do
|
24
|
+
allow_any_instance_of(Dredd::Rack::RakeTask).to receive(:integrate_with_rails!).and_raise 'Integration with Rails was ensured.'
|
25
|
+
expect{ Dredd::Rack::RakeTask.new }.to raise_error 'Integration with Rails was ensured.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
21
29
|
describe '#runner', public: true do
|
22
30
|
|
23
31
|
it 'is a default Dredd::Rack runner' do
|
@@ -58,4 +66,18 @@ describe Dredd::Rack::RakeTask do
|
|
58
66
|
end
|
59
67
|
end
|
60
68
|
end
|
69
|
+
|
70
|
+
describe '#integrate_with_rails!', private: true do
|
71
|
+
|
72
|
+
context 'when the :environment Rake task is available' do
|
73
|
+
|
74
|
+
it 'defines it as a prerequisite to load the Rails environment', focus: true do
|
75
|
+
allow(Rake::Task).to receive(:task_defined?).with(:environment).and_return(true)
|
76
|
+
|
77
|
+
rake_task = double
|
78
|
+
expect(rake_task).to receive(:enhance).with([:environment])
|
79
|
+
subject.send(:integrate_with_rails!, rake_task)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
61
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dredd-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Bulnes Guilpain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|