Sha256: 3b281431a1317798b28e3504831a3a0366cbcbb87ff983a501718be9f209994f

Contents?: true

Size: 988 Bytes

Versions: 3

Compression:

Stored size: 988 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, :body => "hello")
      lambda { parse_email_for_link(email, "non-existent text") }.should raise_error(Spec::Expectations::ExpectationNotMetError)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
email_spec-0.6.6 spec/email_spec/helpers_spec.rb
email_spec-0.6.5 spec/email_spec/helpers_spec.rb
email_spec-0.6.4 spec/email_spec/helpers_spec.rb