Sha256: 0460204bc23b83bf0fa46d8e814f6293e322863721c04c6baa2dd4f8c520ca36

Contents?: true

Size: 1.37 KB

Versions: 28

Compression:

Stored size: 1.37 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper'))

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

28 entries across 28 versions & 4 rubygems

Version Path
ianwhite-pickle-0.1.10 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.11 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.12 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.13 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.14 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.15 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.6 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.8 spec/lib/pickle_email_parser_spec.rb
ianwhite-pickle-0.1.9 spec/lib/pickle_email_parser_spec.rb
mrflip-pickle-0.1.13 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.5 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.4 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.3 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.2 spec/lib/pickle_email_parser_spec.rb
kbaum-pickle-0.2.1.4 spec/lib/pickle_email_parser_spec.rb
kbaum-pickle-0.2.1.3 spec/lib/pickle_email_parser_spec.rb
kbaum-pickle-0.2.1.2 spec/lib/pickle_email_parser_spec.rb
kbaum-pickle-0.2.1.1 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.1 spec/lib/pickle_email_parser_spec.rb
pickle-0.2.0 spec/lib/pickle_email_parser_spec.rb