Skip to content

Commit 9a90a64

Browse files
committed
fix specs, coerce data into string (i.e. handle nil case)
1 parent 2c66c35 commit 9a90a64

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/rspec_api_documentation/curl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def get_data
4040
end
4141

4242
def post_data
43-
escaped_data = data.gsub("'", "\\u0027")
43+
escaped_data = data.to_s.gsub("'", "\\u0027")
4444
"-d '#{escaped_data}'"
4545
end
4646

spec/curl_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
it { should =~ /^curl/ }
1515
it { should =~ /http:\/\/example\.com\/orders/ }
16-
it { should =~ /-d "order%5Bsize%5D=large&order%5Btype%5D=cart"/ }
16+
it { should =~ /-d 'order%5Bsize%5D=large&order%5Btype%5D=cart'/ }
1717
it { should =~ /-X POST/ }
1818
it { should =~ /-H "Accept: application\/json"/ }
1919
it { should =~ /-H "X-Header: header"/ }
@@ -50,7 +50,7 @@
5050

5151
it { should =~ /^curl/ }
5252
it { should =~ /http:\/\/example\.com\/orders\/1/ }
53-
it { should =~ /-d "size=large"/ }
53+
it { should =~ /-d 'size=large'/ }
5454
it { should =~ /-X PUT/ }
5555
it { should =~ /-H "Accept: application\/json"/ }
5656
it { should =~ /-H "X-Header: header"/ }

0 commit comments

Comments
 (0)