Sha256: 3f1093da41295289a96a5a2df7b9d33cb540b9685cebb14090fa92a724f319bf

Contents?: true

Size: 865 Bytes

Versions: 15

Compression:

Stored size: 865 Bytes

Contents

module Fixtures
  module HTML
    extend self

    TEMPLATE = <<-HTML
<html>
  <head>
%s
  </head>
  <body>
    <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
      tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
      veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
      commodo consequat.
    </p>
  </body>
</html>
    HTML

    LINK = "<link rel='stylesheet' %s />\n"

    def with_css_links(*files)
      opts = files.last.is_a?(Hash) ? files.pop : {}
      links = []
      files.each do |file|
        attrs = { href: "http://example.com/#{file}" }.merge(opts)
        links << LINK % hash_to_attributes(attrs)
      end

      TEMPLATE % links.join
    end

    def hash_to_attributes(attrs)
      attrs.map { |attr, value| "#{attr}='#{value}'" }.join(' ')
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
premailer-rails-1.12.0 spec/support/fixtures/html.rb
premailer-rails-revived-1.12.0 spec/support/fixtures/html.rb
premailer-rails-1.11.1 spec/support/fixtures/html.rb
premailer-rails-1.11.0 spec/support/fixtures/html.rb
premailer-rails-1.10.3 spec/support/fixtures/html.rb
premailer-rails-1.10.2 spec/support/fixtures/html.rb
premailer-rails-1.10.1 spec/support/fixtures/html.rb
premailer-rails-1.10.0 spec/support/fixtures/html.rb
premailer-rails-1.9.7 spec/support/fixtures/html.rb
premailer-rails-1.9.6 spec/support/fixtures/html.rb
premailer-rails-1.9.5 spec/support/fixtures/html.rb
premailer-rails-1.9.4 spec/support/fixtures/html.rb
premailer-rails-1.9.3 spec/support/fixtures/html.rb
premailer-rails-1.9.2 spec/support/fixtures/html.rb
premailer-rails-1.9.1 spec/support/fixtures/html.rb