Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tidy up the specs... sorta

  • Loading branch information...
commit 3a27bce83c2071ca87024dc813ccd83cc2f498b0 1 parent ab938a1
@jherdman jherdman authored
View
45 spec/five_mobile_push/client_spec.rb
@@ -7,21 +7,16 @@
subject { FiveMobilePush::Client.new :api_token => api_token, :application_uid => application_uid }
- it "connects using the fivemobile endpoint" do
- connection = subject.send(:connection).build_url(nil).to_s
- connection.should == described_class.default_endpoint.to_s
- end
-
describe "#device" do
-
+
it "initializes a Device" do
subject.device('abc').should be_kind_of(FiveMobilePush::Device)
end
-
- end
-
+
+ end
+
describe "#notifier" do
-
+
it "initializes a Notifier" do
subject.notifier.should be_kind_of(FiveMobilePush::Notifier)
end
@@ -35,37 +30,37 @@
end
end
-
+
context "response code is 400" do
-
- let(:path) { (described_class.default_endpoint + "some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
-
+
+ let(:path) { (described_class::DEFAULT_ENDPOINT + "/some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
+
it "raises a GeneralError" do
stub_request(:any, path).to_return(:body => "something broken", :status => 400)
expect { subject.get(path) }.to raise_error(FiveMobilePush::GeneralError)
end
-
+
end
-
+
context "response code is 401" do
-
- let(:path) { (described_class.default_endpoint + "some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
-
+
+ let(:path) { (described_class::DEFAULT_ENDPOINT + "/some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
+
it "raises a GeneralError" do
stub_request(:any, path).to_return(:body => "something broken", :status => 401)
expect { subject.get(path) }.to raise_error(FiveMobilePush::UnauthorizedError)
end
-
+
end
-
+
context "response code is 500" do
-
- let(:path) { (described_class.default_endpoint + "some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
-
+
+ let(:path) { (described_class::DEFAULT_ENDPOINT + "/some_endpoint?api_token=#{api_token}&application_id=#{application_uid}").to_s }
+
it "raises a GeneralError" do
stub_request(:any, path).to_return(:body => "something broken", :status => 500)
expect { subject.get(path) }.to raise_error(FiveMobilePush::ServerError)
end
-
+
end
end
View
4 spec/five_mobile_push/device_spec.rb
@@ -16,7 +16,7 @@
{
:manufacturer => 'Apple',
:model => 'iPhone 4',
- :platform => 'iOS',
+ :platform => 'iPhone OS',
:platform_ver => 'iOS 4.3'
}
}
@@ -98,7 +98,7 @@
end
def device_endpoint(name)
- (FiveMobilePush::Client.default_endpoint + "device/#{name}").to_s
+ (FiveMobilePush::Client::DEFAULT_ENDPOINT + "/device/#{name}").to_s
end
end
View
2  spec/five_mobile_push/notifier_spec.rb
@@ -52,6 +52,6 @@
end
def notifier_endpoint(name)
- (FiveMobilePush::Client.default_endpoint + "notify/#{name}").to_s
+ (FiveMobilePush::Client::DEFAULT_ENDPOINT + "notify/#{name}").to_s
end
end
View
2  spec/five_mobile_push/tags_spec.rb
@@ -50,7 +50,7 @@
end
def tag_endpoint(name)
- (FiveMobilePush::Client.default_endpoint + "tags/#{name}").to_s
+ (FiveMobilePush::Client::DEFAULT_ENDPOINT + "tags/#{name}").to_s
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.