test/fastly-rails_test.rb in fastly-rails-0.1.2 vs test/fastly-rails_test.rb in fastly-rails-0.1.3
- old
+ new
@@ -5,10 +5,11 @@
let(:api_key) { 'test' }
let(:user) { nil }
let(:password) { nil }
let(:max_age) { 100000 }
let(:configuration) { FastlyRails.configuration }
+ let(:service_id) { 'someserviceid' }
let(:client) { FastlyRails.client }
it 'should be a module' do
assert_kind_of Module, FastlyRails
end
@@ -16,16 +17,18 @@
describe 'credentials not provided' do
it 'should raise an error if configuration is not authenticatable' do
assert_equal false, configuration.authenticatable?
+ assert_equal true, configuration.invalid_service_id?
assert_raises FastlyRails::NoAuthCredentialsProvidedError do
client
end
-
+ assert_raises FastlyRails::NoServiceIdProvidedError do
+ FastlyRails.service_id
+ end
end
-
end
describe 'credentials provided' do
before do
@@ -33,10 +36,11 @@
FastlyRails.configure do |c|
c.api_key = api_key
c.user = user
c.password = password
c.max_age = max_age
+ c.service_id = service_id
end
end
@@ -44,9 +48,10 @@
assert_equal api_key, configuration.api_key
assert_equal user, configuration.user
assert_equal password, configuration.password
assert_equal max_age, configuration.max_age
+ assert_equal service_id, configuration.service_id
end
it 'should return a valid client' do
assert_instance_of FastlyRails::Client, client