Sha256: 630d0dae9f98bc2f104e7729a7905e5922b9021d1383660b04b9e27441e5784d

Contents?: true

Size: 970 Bytes

Versions: 5

Compression:

Stored size: 970 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe EmailSpec::Helpers do
  include EmailSpec::Helpers
  describe "#parse_email_for_link" do
    it "properly finds links with text" do
      email = stub(:has_body_text? => true,
                   :body => %(<a href="/path/to/page">Click Here</a>))
      parse_email_for_link(email, "Click Here").should == "/path/to/page"
    end

    it "recognizes img alt properties as text" do
      email = stub(:has_body_text? => true,
                   :body => %(<a href="/path/to/page"><img src="http://host.com/images/image.gif" alt="an image" /></a>))
      parse_email_for_link(email, "an image").should == "/path/to/page"
    end

    it "causes a spec to fail if the body doesn't contain the text specified to click" do
      email = stub(:has_body_text? => false)
      lambda { parse_email_for_link(email, "non-existent text") }.should raise_error(Spec::Expectations::ExpectationNotMetError)
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
email_spec-tricycle-0.6.3 spec/email_spec/helpers_spec.rb
email_spec-0.6.3 spec/email_spec/helpers_spec.rb
opsb-email_spec-0.6.2 spec/email_spec/helpers_spec.rb
email_spec-0.6.2 spec/email_spec/helpers_spec.rb
email_spec-0.6.1 spec/email_spec/helpers_spec.rb