Sha256: eca2504d24b8c9404d59a7683c4c1a79ff6272dad85f835d1bfde8c77ae94d3f
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
require 'spec_helper' describe MailUp::API do context 'initialization' do # Make sure a hash is provided it 'requires credentials' do expect{ MailUp::API.new }.to raise_error(MailUp::Error, 'MailUp credentials missing') end # Validate the credentials hash keys [:client_id, :client_secret, :oauth].each do |key| it "requires credentials to have a '#{key}' key" do @credentials.delete_if{ |k,v| k == key } expect{ MailUp::API.new(@credentials) }.to raise_error(MailUp::Error, "MailUp credentials must include a #{key} key") end end # Make sure the oauth key is a hash it 'requires credentials to have an oauth hash' do @credentials[:oauth] = nil expect{ MailUp::API.new(@credentials).merge!(token: true) }.to raise_error(MailUp::Error, "MailUp credentials :oauth must be a hash") end # Validate the oauth hash keys [:token, :refresh_token, :expires_at].each do |key| it "requires credentials with an oauth hash containing a '#{key}' key" do @credentials[:oauth].delete_if{ |k,v| k == key } expect{ MailUp::API.new(@credentials) }.to raise_error(MailUp::Error, "MailUp credentials :oauth hash must include a #{key} key") end end end # Add a context for sending a request # Verify that each verb method sends the right message. # Verify that the objects exist. end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mailup-1.2.0 | spec/mailup/mailup_spec.rb |
mailup-1.1.0 | spec/mailup/mailup_spec.rb |