Sha256: 491c60cfe58e5d4796966d5d1fc8b15db35620ddd0b02de3a1e3f6704242856c

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'test_helper'

module DragonflySvg
  module Processors
    describe SetAttribute do

      let(:app) { test_app.configure_with(:svg) }
      let(:processor) { DragonflySvg::Processors::SetAttribute.new }
      let(:analyser) { DragonflySvg::Analysers::SvgProperties.new }
      let(:svg) { Dragonfly::Content.new(app, SAMPLES_DIR.join('sample.svg')) }

      let(:xpath) { "./*[name()='svg']" }
      let(:attribute_name) { 'style' }
      let(:value) { 'margin: 50px;' }

      before do
        processor.call(svg, xpath, attribute_name, value)
      end

      it 'sets attribute' do
        Nokogiri::XML(svg.data).xpath(xpath).count.must_equal 1
        Nokogiri::XML(svg.data).xpath(xpath).first.get_attribute('style').must_equal value
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dragonfly_svg-0.0.3 test/dragonfly_svg/processors/set_attribute_test.rb