Sha256: 4a4bad534f21876704065f8e7336f3fedf92153ada35fe8a363ff8a1dc52a367

Contents?: true

Size: 912 Bytes

Versions: 3

Compression:

Stored size: 912 Bytes

Contents

require 'spec_helper'

describe "A Gmail mailbox" do
  subject { Gmail::Mailbox }

  context "on initialize" do
    it "should set client and name" do
      within_gmail do |gmail|
        mailbox = subject.new(gmail, "TEST")
        mailbox.instance_variable_get("@gmail").should == gmail
        mailbox.name.should == "TEST"
      end
    end

    it "should work in INBOX by default" do
      within_gmail do |gmail|
        mailbox = subject.new(@gmail)
        mailbox.name.should == "INBOX"
      end
    end
  end

  context "instance" do

    it "should be able to count all emails" do
      mock_mailbox do |mailbox|
        mailbox.count.should > 0
      end
    end

    it "should be able to find messages" do
      mock_mailbox do |mailbox|
        message = mailbox.emails.first
        mailbox.emails(:all, :from => message.from.first.name) == message.from.first.name
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gmail-0.3.4 spec/mailbox_spec.rb
gmail-0.3.3 spec/mailbox_spec.rb
gmail-0.3.2 spec/mailbox_spec.rb