bubble-wrap 1.5.0 → 1.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,45 +0,0 @@
1
- describe BubbleWrap::HTTP::Response do
2
-
3
- before do
4
- @response = BubbleWrap::HTTP::Response.new({ status_code: 200, url: 'http://localhost' })
5
- end
6
-
7
- it 'should turn the initialization Hash to instance variables' do
8
- @response.instance_variable_get(:@status_code).should == 200
9
- @response.instance_variable_get(:@url).should == 'http://localhost'
10
- end
11
-
12
- it "says OK status code 2xx" do
13
- @response.ok?.should.equal true
14
- (200..211).each do |code|
15
- BubbleWrap::HTTP::Response.new(status_code: code).ok?.should.be.true
16
- end
17
- [100..101, 300..307, 400..417, 500..505].inject([]){|codes, rg| codes + rg.to_a}.each do |code|
18
- BubbleWrap::HTTP::Response.new(status_code: code).ok?.should.be.false
19
- end
20
- end
21
-
22
- it "updates the status description" do
23
- @response.status_description.should.equal 'no error'
24
- end
25
-
26
- it "updates ivars when calling update" do
27
- @response.update(one: 'one', two: 'two')
28
- @response.instance_variable_get(:@one).should.equal 'one'
29
- @response.instance_variable_get(:@two).should.equal 'two'
30
-
31
- @response.update(one: 'three', two: 'four')
32
- @response.instance_variable_get(:@one).should.equal 'three'
33
- @response.instance_variable_get(:@two).should.equal 'four'
34
- end
35
-
36
- it "has appropriate attributes" do
37
- @response.should.respond_to :body
38
- @response.should.respond_to :headers
39
- @response.should.respond_to :url
40
- @response.should.respond_to :status_code=
41
- @response.should.respond_to :error_message=
42
- @response.should.respond_to :error=
43
- end
44
-
45
- end
@@ -1,57 +0,0 @@
1
- describe "HTTP" do
2
-
3
- before do
4
- @localhost_url = 'http://localhost'
5
- @fake_url = 'http://fake.url'
6
- end
7
-
8
- describe "Core HTTP method calls" do
9
-
10
- def test_http_method(method)
11
- called = false
12
- delegator = Proc.new { |r, q| @the_response = r; @the_query = q; called = true }
13
- query = BubbleWrap::HTTP.send(method, @localhost_url, { name: 'bubble-wrap', action: delegator })
14
- query.should.not.equal nil
15
- query.method.should.equal method.to_s.upcase
16
- query.options[:name].should.equal 'bubble-wrap'
17
- query.instance_variable_get(:@delegator).should.equal delegator
18
-
19
- query.connectionDidFinishLoading(query.connection)
20
- query.should.be.same_as @the_query
21
- query.response.should.be.same_as @the_response
22
- called.should.equal true
23
- end
24
-
25
- it ".get .post .put .delete .head .patch should properly generate the HTTP::Query" do
26
- [:get, :post, :put, :delete, :head, :patch].each do |method|
27
- test_http_method method
28
- end
29
- end
30
-
31
- it "uses the block instead of :action if both were given" do
32
- [:get, :post, :put, :delete, :head, :patch].each do |method|
33
- called = false
34
- expected_delegator = Proc.new {|response| called = true }
35
-
36
- query = BubbleWrap::HTTP.send(method, @localhost_url, { action: 'not_valid' }, &expected_delegator)
37
- query.connectionDidFinishLoading(query.connection)
38
-
39
- query.instance_variable_get(:@delegator).should.equal expected_delegator
40
- called.should.equal true
41
- end
42
- end
43
-
44
- it "works with classic blocks as well" do
45
- [:get, :post, :put, :delete, :head, :patch].each do |method|
46
- called = false
47
- query = BubbleWrap::HTTP.send(method, @localhost_url, { action: 'not_valid' } ) do
48
- called = true
49
- end
50
- query.connectionDidFinishLoading(query.connection)
51
- called.should.equal true
52
- end
53
- end
54
-
55
- end
56
-
57
- end
data/travis.sh DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- bundle install &&
4
- bundle exec rake clean &&
5
- bundle exec rake spec &&
6
- bundle exec rake clean &&
7
- bundle exec rake spec osx=true