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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df87b935a638c2038e83e801e28641077a711fbe
4
- data.tar.gz: 642d5c8ddc31c41e3770b8523b54c35b0ba800ba
3
+ metadata.gz: 451bcf6ce5445a6b1b6e82405f8c09e0a1c6a03d
4
+ data.tar.gz: 911261ff25e1fca55e20c54a1f4aac62bb93fc6d
5
5
  SHA512:
6
- metadata.gz: 558870fb92e474692d10b01955ec8ff012ad5b461b9ed3605a24d9c0edb154ea9ece9e2c5a165bad76269e81277797fafe6033c7635472f1690d8a37bf65c5f0
7
- data.tar.gz: c591fcba3305d303b20fe08052727ad998400ea09795fa4d6fea2d98814b5fbc9e0a9acfb66d360d575c40e3235435bb73b6189f40d6124fd3820bebe1cfb381
6
+ metadata.gz: 7254c4134bd9cc4b0b16f26b7ce703c4854fe9a191fa98dcd3df59cba5777f0d282600d465af57063a18c5d58205b06dc2484bbcdf663e6f995d080d2d51f10f
7
+ data.tar.gz: ac25fd2bbaa21def1c3833dba3aab9448ee9be2569bee23f3581a66a4e2060ce034579957a7381d2c21b5975fdc278fbe05533fba3485af3f029cefcb8cef791
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Dredd
2
2
  module Rack
3
- VERSION = '0.4.0'
3
+ VERSION = '0.5.0'
4
4
  end
5
5
  end
@@ -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.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-03-22 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara