manticore 0.4.2-java → 0.4.3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,14 +5,14 @@ describe Manticore::Cookie do
5
5
  let(:client) { Manticore::Client.new cookies: true }
6
6
  subject {
7
7
  response = client.get(local_server("/cookies/1/2"))
8
- response.final_url.to_s.should == local_server("/cookies/2/2")
8
+ expect(response.final_url.to_s).to eq local_server("/cookies/2/2")
9
9
  response.cookies["x"].first
10
10
  }
11
11
 
12
- its(:name) { should == "x" }
13
- its(:value) { should == "2" }
14
- its(:path) { should == "/" }
15
- its(:domain) { should == "localhost" }
12
+ its(:name) { is_expected.to eq "x" }
13
+ its(:value) { is_expected.to eq "2" }
14
+ its(:path) { is_expected.to eq "/" }
15
+ its(:domain) { is_expected.to eq "localhost" }
16
16
  end
17
17
 
18
18
 
@@ -21,16 +21,16 @@ describe Manticore::Cookie do
21
21
  Manticore::Cookie.new({name: "foo", value: "bar"}.merge(opts))
22
22
  }
23
23
 
24
- its(:secure?) { should be nil }
25
- its(:persistent?) { should be nil }
24
+ its(:secure?) { is_expected.to be nil }
25
+ its(:persistent?) { is_expected.to be nil }
26
26
 
27
27
  context "created as secure" do
28
28
  let(:opts) {{ secure: true }}
29
- its(:secure?) { should be true }
29
+ its(:secure?) { is_expected.to be true }
30
30
  end
31
31
 
32
32
  context "created as persistent" do
33
33
  let(:opts) {{ persistent: true }}
34
- its(:persistent?) { should be true }
34
+ its(:persistent?) { is_expected.to be true }
35
35
  end
36
36
  end
@@ -16,26 +16,26 @@ describe Manticore::Facade do
16
16
  end
17
17
  }
18
18
 
19
- it "should get a response" do
19
+ it "gets a response" do
20
20
  result = JSON.parse extended_class.get(local_server).body
21
- result["method"].should == "GET"
21
+ expect(result["method"]).to eq "GET"
22
22
  end
23
23
 
24
- it "should not use the shared client by default" do
25
- extended_class.instance_variable_get("@manticore_facade").object_id.should_not ==
24
+ it "does not use the shared client by default" do
25
+ expect(extended_class.instance_variable_get("@manticore_facade").object_id).to_not eq \
26
26
  Manticore.instance_variable_get("@manticore_facade").object_id
27
27
  end
28
28
 
29
- it "should be able to use the shared client" do
30
- extended_shared_class.instance_variable_get("@manticore_facade").object_id.should ==
29
+ it "is able to use the shared client" do
30
+ expect(extended_shared_class.instance_variable_get("@manticore_facade").object_id).to eq \
31
31
  Manticore.instance_variable_get("@manticore_facade").object_id
32
32
  end
33
33
  end
34
34
 
35
35
  context "from the default Manticore module" do
36
- it "should get a response" do
36
+ it "gets a response" do
37
37
  result = JSON.parse Manticore.get(local_server).body
38
- result["method"].should == "GET"
38
+ expect(result["method"]).to eq "GET"
39
39
  end
40
40
  end
41
41
  end
@@ -4,36 +4,36 @@ describe Manticore::Response do
4
4
  let(:client) { Manticore::Client.new }
5
5
  subject { client.get( local_server ) }
6
6
 
7
- its(:headers) { should be_a Hash }
8
- its(:body) { should be_a String }
9
- its(:length) { should be_a Fixnum }
7
+ its(:headers) { is_expected.to be_a Hash }
8
+ its(:body) { is_expected.to be_a String }
9
+ its(:length) { is_expected.to be_a Fixnum }
10
10
 
11
- it "should provide response header lookup via #[]" do
12
- subject["Content-Type"].should eq "text/plain"
11
+ it "provides response header lookup via #[]" do
12
+ expect(subject["Content-Type"]).to eq "text/plain"
13
13
  end
14
14
 
15
- it "should read the body" do
16
- subject.body.should match "Manticore"
15
+ it "reads the body" do
16
+ expect(subject.body).to match "Manticore"
17
17
  end
18
18
 
19
- it "should read the status code" do
20
- subject.code.should eq 200
19
+ it "reads the status code" do
20
+ expect(subject.code).to eq 200
21
21
  end
22
22
 
23
- it "should read the status text" do
24
- subject.message.should match "OK"
23
+ it "reads the status text" do
24
+ expect(subject.message).to match "OK"
25
25
  end
26
26
 
27
27
  context "when the client is invoked with a block" do
28
- it "should allow reading the body from a block" do
28
+ it "allows reading the body from a block" do
29
29
  response = client.get(local_server) do |response|
30
- response.body.should match 'Manticore'
30
+ expect(response.body).to match 'Manticore'
31
31
  end
32
32
 
33
- response.body.should match "Manticore"
33
+ expect(response.body).to match "Manticore"
34
34
  end
35
35
 
36
- it "should not read the body implicitly if called with a block" do
36
+ it "does not read the body implicitly if called with a block" do
37
37
  response = client.get(local_server) {}
38
38
  expect { response.body }.to raise_exception(Manticore::StreamClosedException)
39
39
  end
@@ -42,7 +42,7 @@ describe Manticore::Response do
42
42
  context "when an entity fails to read" do
43
43
  it "releases the connection" do
44
44
  stats_before = client.pool_stats
45
- Manticore::EntityConverter.any_instance.should_receive(:read_entity).and_raise(Manticore::StreamClosedException)
45
+ expect_any_instance_of(Manticore::EntityConverter).to receive(:read_entity).and_raise(Manticore::StreamClosedException)
46
46
  expect { client.get(local_server).call rescue nil }.to_not change { client.pool_stats[:available] }
47
47
  end
48
48
  end
@@ -13,32 +13,37 @@ describe Manticore::StubbedResponse do
13
13
  ).call
14
14
  }
15
15
 
16
- it { should be_a Manticore::Response }
17
- its(:body) { should == "test body" }
18
- its(:code) { should == 200 }
16
+ it { is_expected.to be_a Manticore::Response }
17
+ its(:body) { is_expected.to eq "test body" }
18
+ its(:code) { is_expected.to eq 200 }
19
19
 
20
- it "should persist the set headers" do
21
- subject.headers["content-type"].should == "text/plain"
20
+ it "persists the set headers" do
21
+ expect(subject.headers["content-type"]).to eq "text/plain"
22
22
  end
23
23
 
24
- it "should set content-length from the body" do
25
- subject.headers["content-length"].should == 9
24
+ it "sets content-length from the body" do
25
+ expect(subject.headers["content-length"]).to eq "9"
26
26
  end
27
27
 
28
- it "should persist cookies passed as explicit cookie objects" do
29
- subject.cookies["test"].first.value.should == "something"
28
+ it "persists cookies passed as explicit cookie objects" do
29
+ expect(subject.cookies["test"].first.value).to eq "something"
30
30
  end
31
31
 
32
- it "should call on_success handlers" do
32
+ it "calls on_success handlers" do
33
33
  called = false
34
34
  Manticore::StubbedResponse.stub.on_success {|resp| called = true }.call
35
- called.should be true
35
+ expect(called).to be true
36
36
  end
37
37
 
38
38
  it "should persist cookies passed in set-cookie" do
39
- subject.cookies["k"].map(&:value).should =~ ["v", "v"]
40
- subject.cookies["k"].map(&:path).should =~ ["/", "/sub"]
41
- subject.cookies["k"].map(&:domain).should =~ ["localhost", "sub.localhost"]
42
- subject.cookies["k2"].first.value.should == "v2"
39
+ expect(subject.cookies["k"].map(&:value)).to match_array ["v", "v"]
40
+ expect(subject.cookies["k"].map(&:path)).to match_array ["/", "/sub"]
41
+ expect(subject.cookies["k"].map(&:domain)).to match_array ["localhost", "sub.localhost"]
42
+ expect(subject.cookies["k2"].first.value).to eq "v2"
43
+ end
44
+
45
+ it "passes bodies to blocks for streaming reads" do
46
+ total = ""; subject.body {|chunk| total << chunk }
47
+ expect(total).to eq("test body")
43
48
  end
44
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manticore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: java
6
6
  authors:
7
7
  - Chris Heald
@@ -30,12 +30,12 @@ cert_chain:
30
30
  cnyabLOcGIKZNxvnSfwOuCBnjgoSOyJi/n48n1s+OPB/OmPJoWmhKu2DO4sUb4+K
31
31
  /3Mhp5UWSl9SmDR1
32
32
  -----END CERTIFICATE-----
33
- date: 2015-07-02 00:00:00.000000000 Z
33
+ date: 2015-08-07 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.3'
41
41
  name: addressable
@@ -43,13 +43,13 @@ dependencies:
43
43
  type: :runtime
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.3'
49
49
  - !ruby/object:Gem::Dependency
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.3'
55
55
  name: bundler
@@ -57,13 +57,13 @@ dependencies:
57
57
  type: :development
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.3'
63
63
  - !ruby/object:Gem::Dependency
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  name: rake
@@ -71,7 +71,7 @@ dependencies:
71
71
  type: :development
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  description: Manticore is an HTTP client built on the Apache HttpCore components
@@ -81,8 +81,8 @@ executables: []
81
81
  extensions: []
82
82
  extra_rdoc_files: []
83
83
  files:
84
- - .gitignore
85
- - .travis.yml
84
+ - ".gitignore"
85
+ - ".travis.yml"
86
86
  - APACHE-LICENSE-2.0.txt
87
87
  - CHANGELOG.md
88
88
  - Gemfile
@@ -127,12 +127,12 @@ require_paths:
127
127
  - lib
128
128
  required_ruby_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - '>='
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  required_rubygems_version: !ruby/object:Gem::Requirement
134
134
  requirements:
135
- - - '>='
135
+ - - ">="
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
metadata.gz.sig CHANGED
Binary file