Sha256: 0f2c93fb9ac1eff26a453dae1ae530e31478c09cdec4de5bb1a09078bab4b939

Contents?: true

Size: 1.38 KB

Versions: 16

Compression:

Stored size: 1.38 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
      expect('the email').to match(/^#{match_email}$/)
    end
    
    it "should match 'the first email'" do
      expect('the first email').to match(/^#{match_email}$/)
    end
    
    it "should match 'the last email'" do
      expect('the last email').to match(/^#{match_email}$/)
    end
    
    it "should match 'the 3rd email'" do
      expect('the 3rd email').to match(/^#{match_email}$/)
    end
    
    it "should match 'an email'" do
      expect('an email').to match(/^#{match_email}$/)
    end
  end
  
  it "#capture_email should just capture match_email" do
    expect(capture_email).to eq("(#{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}$/)
      expect(match[1]).to eq('2nd')
    end
    
    it "should extract nil from 'the email'" do
      match = 'the email'.match(/^#{capture_index_in_email}$/)
      expect(match[1]).to eq(nil)
    end
    
    it "should extract the 'last' from 'the last email'" do
      match = 'the last email'.match(/^#{capture_index_in_email}$/)
      expect(match[1]).to eq('last')
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
pickle-0.9.0 spec/pickle/email/parser_spec.rb
pickle-0.8.0 spec/pickle/email/parser_spec.rb
pickle-0.7.2 spec/pickle/email/parser_spec.rb
pickle-0.7.1 spec/pickle/email/parser_spec.rb
pickle-0.7.0 spec/pickle/email/parser_spec.rb
pickle-0.6.2 spec/pickle/email/parser_spec.rb
pickle-0.6.1 spec/pickle/email/parser_spec.rb
pickle-0.6.0 spec/pickle/email/parser_spec.rb
pickle-0.5.5 spec/pickle/email/parser_spec.rb
pickle-0.5.4 spec/pickle/email/parser_spec.rb
pickle-0.5.3 spec/pickle/email/parser_spec.rb
pickle-0.5.2 spec/pickle/email/parser_spec.rb
spbtv_pickle-0.5.2 spec/pickle/email/parser_spec.rb
spbtv_pickle-0.5.1 spec/pickle/email/parser_spec.rb
pickle-0.5.1 spec/pickle/email/parser_spec.rb
pickle-0.5.0 spec/pickle/email/parser_spec.rb