spec/woopy/client_spec.rb in woopy-0.1.3 vs spec/woopy/client_spec.rb in woopy-0.1.4
- old
+ new
@@ -2,57 +2,29 @@
describe Woopy::Client do
before { @token = 'foo' }
describe '#new' do
+ before {Woopy(token: @token)}
+
it "sets the header token" do
- Woopy(token: @token)
Woopy::Resource.headers['X-WoopleToken'].should eq(@token)
end
- context "production environment" do
- before do
- ENV["RAILS_ENV"] = "production"
- Woopy(token: @token)
- end
-
- it "sets the end point" do
- Woopy::Resource.site.to_s.should eq("https://api.woople.com/services/v1/")
- end
+ it "sets the default Resource.site" do
+ Woopy::Resource.site.to_s.should eq(Woopy::DEFAULT_SITE_BASE)
end
- context "staging environment" do
- before do
- ENV["RAILS_ENV"] = "staging"
- Woopy(token: @token)
- end
+ describe 'site override' do
- it "sets the end point" do
- Woopy::Resource.site.to_s.should eq("https://api.testwoople.com/services/v1/")
- end
- end
+ before { Woopy(token: @token, site: "moof") }
- context "local development environment" do
- before do
- ENV["RAILS_ENV"] = "development"
- Woopy(token: @token)
+ it "overrides the Resource.site" do
+ Woopy::Resource.site.to_s.should eq("moof")
end
- it "sets the end point" do
- Woopy::Resource.site.to_s.should eq("https://api.woople.local:8080/services/v1/")
- end
end
- context "undefined environment" do
- before do
- ENV["RAILS_ENV"] = nil
- Woopy(token: @token)
- end
-
- it "sets the default end point" do
- Woopy::Resource.site.to_s.should eq("https://api.woople.local:8080/services/v1/")
- end
- end
end
describe '#verify' do
context 'given valid token' do