1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00
Commit graph

14 commits

Author SHA1 Message Date
Andy Brody
2e072dcbb2 Test with an image in the public domain. (#607)
Switch to using NASA photo S130-E-012142 of the ISS. It is in the public
domain because it is a work created solely by NASA.

Fixes: #606
2017-07-05 01:40:21 -04:00
Andy Brody
36c80d8b32 Fix up Payload generation to be slightly nicer.
- If Payload.generate() receives a Payload::Base or subclass, then
  return it as is rather than pointlessly wrapping it in a
  Payload::Streamed.
- Add a `.closed?` method to Payload::Base that wraps the underlying
  stream's `.closed?` method.
2017-05-22 01:31:06 -04:00
Andy Brody
950e25191d Add test and history note for ParamsArray payload. 2017-05-22 01:05:53 -04:00
Nikolay Shebanov
c353f286a6 Allow passing ParamsArray as a payload 2016-07-05 11:56:27 +03:00
Andy Brody
4971d1a6e1 Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 3.2.2 with the following command:
    transpec

* 317 conversions
    from: obj.should
      to: expect(obj).to

* 160 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 100 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 30 conversions
    from: lambda { }.should
      to: expect { }.to

* 22 conversions
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 4 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 2 conversions
    from: == expected
      to: eq(expected)

* 1 conversion
    from: expect(collection).to have_at_least(n).items
      to: expect(collection.size).to be >= n

* 1 conversion
    from: obj.unstub(:message)
      to: allow(obj).to receive(:message).and_call_original

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2016-06-05 19:52:16 -04:00
Andy Brody
055f3c5cbe Add ParamsArray support to has_file? method. 2015-11-26 22:35:11 -05:00
Andy Brody
014e421bfc Merge remote-tracking branch 'pchambino/payload_to_s' into ab-urlparams
Conflicts:
	lib/restclient/payload.rb
2015-11-16 02:42:14 -08:00
Andy Brody
2630cc3d3a Remove some unused vestigial code.
Remove Request#process_payload, which hasn't actually been used in ages.
Also rewrite the tests that called it to actually test code that is in
use, even though they are bad unit tests.

Remove HashMapForTesting, which was never used.
2015-11-16 02:32:09 -08:00
Andy Brody
0d5674d84a Switch to multipart boundary with more entropy.
The previous boundary used a random number up to 1,000,000 as the
boundary. This is extremely low entropy compared to what most major
browsers use (20 bits). Instead, use a convention more like WebKit.

RestClient previously would be completely unable to upload a file
generated like so, containing `--0--` through `--1000000--`:

    File.open('foo.txt', 'w') {|f|
      1_000_000.times {|i| f.write("--#{i}--\n") }}

Instead, the boundary now looks like this, with about 95 bits of entropy:
    `----RubyFormBoundaryFg2MqiXXQlT5RkUF`
2015-11-15 22:15:51 -08:00
Andy Brody
66b05f9cac Rewrite tests to match the new implementation. 2015-11-12 03:34:06 -08:00
Andy Brody
5ce0c6ebde Fix up tests for encoding changes.
Add a `.to_hash => {}` for the Net HTTP response mocks.
2015-03-13 18:00:51 -07:00
Andy Brody
440b8256e5 Appease rubocop for a few rules. 2014-11-28 00:25:53 -05:00
Pedro Chambino
a200e4facf Calling Payload::Base.to_s returns empty on the second call 2014-04-01 19:46:20 +01:00
Larry Gilbert
d7a11503af Reorganize specs
* Put unit and integration specs into separate subdirectories
* Consolidate all requires of 'webmock/rspec' into spec_helper.rb
* Use WebMock.{disable!,enable!} for specs calling live server
2013-08-30 18:45:06 -07:00
Renamed from spec/payload_spec.rb (Browse further)