Sha256: 73efd0df9e9059327efbe37ea57f26ada004b7307f60c2675adae72c2ce7c8d0

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

describe "Any object" do
  it "should be able to convert itself to IMAP date format" do
    "20-12-1988".to_imap_date.should == "20-December-1988"
  end
  
  %w[new new!].each do |method|
    it "##{method} should properly connect with GMail service and return valid connection object" do
      gmail = Gmail.send(method, *TEST_ACCOUNT)
      gmail.should be_kind_of(Gmail::Client)
      gmail.connection.should_not be_nil
      gmail.should be_logged_in
    end
    
    it "##{method} should connect with client and give it context when block given" do
      Gmail.send(method, *TEST_ACCOUNT) do |gmail|
        gmail.should be_kind_of(Gmail::Client)
        gmail.connection.should_not be_nil
        gmail.should be_logged_in
      end
    end
  end
  
  it "#new should not raise error when couldn't connect with given account" do
    lambda { 
      gmail = Gmail.new("foo", "bar")
      gmail.should_not be_logged_in 
    }.should_not raise_error(Gmail::Client::AuthorizationError)
  end

  it "#new! should raise error when couldn't connect with given account" do
    lambda { 
      gmail = Gmail.new!("foo", "bar")
      gmail.should_not be_logged_in 
    }.should raise_error(Gmail::Client::AuthorizationError)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gmail-0.3.4 spec/gmail_spec.rb
gmail-0.3.3 spec/gmail_spec.rb
gmail-0.3.2 spec/gmail_spec.rb
gmail-0.3.0 spec/gmail_spec.rb