Sha256: bc072158ce50826131d56eb8a11eae2043eefe10f9bc75376b6617aacd6db786

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

require 'pickle/email/parser'

describe Pickle::Email::Parser do
  include Pickle::Parser::Matchers
  include Pickle::Email::Parser
  
  describe "#match_email" do
    it "should match 'the email'" do
      'the email'.should match(/^#{match_email}$/)
    end
    
    it "should match 'the first email'" do
      'the first email'.should match(/^#{match_email}$/)
    end
    
    it "should match 'the last email'" do
      'the last email'.should match(/^#{match_email}$/)
    end
    
    it "should match 'the 3rd email'" do
      'the 3rd email'.should match(/^#{match_email}$/)
    end
    
    it "should match 'an email'" do
      'an email'.should match(/^#{match_email}$/)
    end
  end
  
  it "#capture_email should just capture match_email" do
    capture_email.should == "(#{match_email})"
  end
  
  describe "#capture_index_in_email" do
    it "should extract the '2nd' from 'the 2nd email'" do
      match = 'the 2nd email'.match(/^#{capture_index_in_email}$/)
      match[1].should == '2nd'
    end
    
    it "should extract nil from 'the email'" do
      match = 'the email'.match(/^#{capture_index_in_email}$/)
      match[1].should == nil
    end
    
    it "should extract the 'last' from 'the last email'" do
      match = 'the last email'.match(/^#{capture_index_in_email}$/)
      match[1].should == 'last'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pickle-0.4.11 spec/pickle/email/parser_spec.rb
pickle-0.4.10 spec/pickle/email/parser_spec.rb
pickle-0.4.9 spec/pickle/email/parser_spec.rb
pickle-0.4.8 spec/pickle/email/parser_spec.rb
pickle-0.4.7 spec/pickle/email/parser_spec.rb
pickle-0.4.6 spec/pickle/email/parser_spec.rb
pickle-0.4.5 spec/pickle/email/parser_spec.rb