spec/unit/auth_spec.rb in ably-0.7.6 vs spec/unit/auth_spec.rb in ably-0.8.0
- old
+ new
@@ -63,6 +63,23 @@
it 'raises an argument error' do
expect { subject.client_id }.to raise_error ArgumentError, /must be a String/
end
end
end
+
+ context 'defaults' do
+ let(:one_hour) { 60 * 60 }
+ let(:all_capabilities) { { "*" => ["*"] } }
+
+ it 'should default TTL to 1 hour' do
+ expect(Ably::Auth::TOKEN_DEFAULTS.fetch(:ttl)).to eql(one_hour)
+ end
+
+ it 'should default capability to all' do
+ expect(Ably::Auth::TOKEN_DEFAULTS.fetch(:capability)).to eql(all_capabilities)
+ end
+
+ it 'should only have defaults for :ttl and :capability' do
+ expect(Ably::Auth::TOKEN_DEFAULTS.keys).to contain_exactly(:ttl, :capability)
+ end
+ end
end