bubble-wrap 1.5.0 → 1.6.0.rc1
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.
- checksums.yaml +4 -4
- data/.travis.yml +6 -1
- data/Gemfile.lock +3 -1
- data/README.md +98 -5
- data/Rakefile +1 -1
- data/bubble-wrap.gemspec +1 -0
- data/lib/bubble-wrap/all.rb +1 -1
- data/lib/bubble-wrap/http.rb +5 -5
- data/lib/bubble-wrap/network-indicator.rb +6 -0
- data/lib/bubble-wrap/ui.rb +1 -0
- data/lib/bubble-wrap/version.rb +1 -1
- data/motion/core.rb +3 -0
- data/motion/core/ios/app.rb +14 -2
- data/motion/core/string.rb +4 -0
- data/motion/location/location.rb +31 -1
- data/motion/network-indicator/network-indicator.rb +67 -0
- data/motion/reactor/eventable.rb +6 -4
- data/motion/ui/ui_activity_view_controller_wrapper.rb +51 -0
- data/motion/util/constants.rb +10 -5
- data/spec/motion/core/ios/app_spec.rb +27 -0
- data/spec/motion/core/string_spec.rb +13 -2
- data/spec/motion/location/location_spec.rb +65 -0
- data/spec/motion/network-indicator/network_indicator_spec.rb +112 -0
- data/spec/motion/reactor/eventable_spec.rb +54 -2
- data/spec/motion/ui/ui_activity_view_controller_wrapper_spec.rb +58 -0
- data/spec/motion/util/constants_spec.rb +6 -0
- metadata +29 -20
- data/motion/http.rb +0 -34
- data/motion/http/query.rb +0 -393
- data/motion/http/response.rb +0 -32
- data/spec/motion/http/query_spec.rb +0 -808
- data/spec/motion/http/response_spec.rb +0 -45
- data/spec/motion/http_spec.rb +0 -57
- data/travis.sh +0 -7
@@ -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
|
data/spec/motion/http_spec.rb
DELETED
@@ -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
|