dredd-rack 0.7.0 → 0.7.1

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: c904b6d073280b27d7a3516c46f073b338e88b5f
4
- data.tar.gz: 03b46167be66ab247f7e163f3bc79cbccfa21414
3
+ metadata.gz: fd65fed5ec681a52bc8e7578637ce2b26ee43291
4
+ data.tar.gz: 7ede3f46cefa429a2ca32b1bda3b296650d293e4
5
5
  SHA512:
6
- metadata.gz: bc64eba1db78bdf29e7810e1a1537ed17697cfe4a0d37c28507f4a719fd23f4d1a06b7830264e0c6484b0c91465c52e31be5d8f3ede8874cf8c1d511156ece0b
7
- data.tar.gz: 80a094a0b0eeca53f8d4e584f12e3ddaf8740ac4f10de566b6d2a12f99d6326e47245917b092f73fcd1ac039e92da6524d62bfa38d77a91e0c42522b08264893
6
+ metadata.gz: 12e40e215b4b12519550d616680ccd0c517e93c9452647793e5eeef916305cd348939a02693a81dcfabd4855fa82d7ec1f1e79f2286a0bb1d90a787f3c9082dc
7
+ data.tar.gz: 383688eac212f4eff6e22a61d0d22349d3c90fe7ba44f62cd4e9b0ffdb0bee05eb6bd2d210cacad9cdfb469ca6fc9ec08ba0bad1589a70045137eb422ce10141
@@ -137,7 +137,7 @@ module Dredd
137
137
 
138
138
  option_flag = name.to_s.gsub('_', '-').gsub('!', '').prepend('--')
139
139
  command_parts = self.command_parts.push option_flag
140
- command_parts = self.command_parts.push args.slice(0).to_s if SINGLE_ARGUMENT_OPTIONS.include? name
140
+ command_parts = self.command_parts.push args.slice(0).to_s.quote! if SINGLE_ARGUMENT_OPTIONS.include? name
141
141
  self
142
142
  end
143
143
 
@@ -174,6 +174,19 @@ class String
174
174
  def has_at_least_two_arguments?
175
175
  split('--').first.split(' ').length >= 3
176
176
  end
177
+
178
+ # Include quotes as part of the string
179
+ #
180
+ # Examples:
181
+ #
182
+ # "Hello, world!".quote! # => "\"Hello, world!\""
183
+ # "Hello, world!".size # => 13
184
+ # "Hello, world!".quote!.size # => 15
185
+ #
186
+ # Returns a String, whose first and last characters are quotes.
187
+ def quote!
188
+ '"' + self + '"'
189
+ end
177
190
  end
178
191
 
179
192
  Anderson = Dredd # Anderson::Rack::Runner.new runs just as fast as Dredd
@@ -1,5 +1,5 @@
1
1
  module Dredd
2
2
  module Rack
3
- VERSION = '0.7.0'
3
+ VERSION = '0.7.1'
4
4
  end
5
5
  end
@@ -123,7 +123,7 @@ describe Dredd::Rack::Runner do
123
123
 
124
124
  expect(subject.command).to match /http:\/\/localhost:4567/
125
125
  expect(subject.command).to match /blueprints\/\*\.apib doc\/\*\.apib/
126
- expect(subject.command).to match /--level silly/
126
+ expect(subject.command).to match /--level "silly"/
127
127
  expect(subject.command).to match /--no-color/
128
128
 
129
129
  expect(subject.command).not_to match /http:\/\/localhost:3000/
@@ -256,6 +256,9 @@ describe String, public: true do
256
256
  expect(subject).to respond_to :has_at_least_two_arguments?
257
257
  end
258
258
 
259
+ it 'responds to :quote!' do
260
+ expect(subject).to respond_to :quote!
261
+ end
259
262
 
260
263
  describe '#has_at_least_two_arguments?' do
261
264
 
@@ -287,4 +290,14 @@ describe String, public: true do
287
290
  end
288
291
  end
289
292
  end
293
+
294
+ describe '#quote!' do
295
+
296
+ let(:string) { "some string" }
297
+
298
+ it 'returns the string content surrounded by quotes' do
299
+ expect(string.quote!).to match /some string/
300
+ expect(string.quote!).to match /^".*"$/
301
+ end
302
+ end
290
303
  end
@@ -7,6 +7,14 @@ RSpec.shared_examples 'a single-argument option' do |option, args|
7
7
 
8
8
  expect{ subject.send(option, args.slice(0), args.slice(1)) }.to change{
9
9
  subject.command
10
- }.to(end_with "#{option_flag} #{args.slice(0)}")
10
+ }.to(end_with "#{option_flag} \"#{args.slice(0)}\"")
11
+ end
12
+
13
+ it 'surrounds its flag argument with quotes' do
14
+ option_flag = option.to_s.gsub('_', '-').prepend('--')
15
+
16
+ expect{ subject.send(option, args.slice(0), args.slice(1)) }.to change{
17
+ subject.command
18
+ }.to(end_with "\"#{args.slice(0)}\"")
11
19
  end
12
20
  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.7.0
4
+ version: 0.7.1
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-08-06 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -111,7 +111,7 @@ files:
111
111
  - spec/support/specs_for_single_argument_options.rb
112
112
  homepage: https://github.com/gonzalo-bulnes/dredd-rack
113
113
  licenses:
114
- - GPLv3
114
+ - GPL-3.0+
115
115
  metadata: {}
116
116
  post_install_message:
117
117
  rdoc_options: []
@@ -129,19 +129,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.4.8
132
+ rubygems_version: 2.5.1
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Convenient API blueprint testing with Apiary Dredd for Rack applications.
136
136
  test_files:
137
- - spec/lib/dredd/rack/runner_spec.rb
138
- - spec/lib/dredd/rack/configuration_spec.rb
139
- - spec/lib/dredd/rack/rake_task_spec.rb
140
- - spec/lib/dredd/rack_spec.rb
141
137
  - spec/spec_helper.rb
142
- - spec/support/specs_for_negatable_boolean_options.rb
143
- - spec/support/specs_for_options.rb
144
- - spec/support/spec_for_configuration_option_interface.rb
145
138
  - spec/support/specs_for_boolean_options.rb
146
139
  - spec/support/specs_for_single_argument_options.rb
140
+ - spec/support/spec_for_configuration_option_interface.rb
141
+ - spec/support/specs_for_options.rb
142
+ - spec/support/specs_for_negatable_boolean_options.rb
143
+ - spec/lib/dredd/rack/runner_spec.rb
144
+ - spec/lib/dredd/rack/rake_task_spec.rb
145
+ - spec/lib/dredd/rack/configuration_spec.rb
146
+ - spec/lib/dredd/rack_spec.rb
147
147
  has_rdoc: