Sha256: 69394b6c36de77f6c3577846fc064fdb4806704a1151c2262a6964825e1b9654

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require 'spec_helper'
require 'gnawrnip/step_screenshot'

module Gnawrnip
  describe StepScreenshot do
    let(:template) { StepScreenshot }

    it 'exists failure step template' do
      expect(TurnipFormatter::Step::Failure.templates).to have_key template
    end

    describe '.build' do
      subject { template.build(data_list) }

      context 'has multiple data' do
        let(:data_list) do
          [
            GnawrnipTest.image('aiueo'),
            GnawrnipTest.image('12345'),
            GnawrnipTest.image('abcde')
          ]
        end

        it 'should get image tag and source that base64 encoded' do
          data1 = Base64.strict_encode64('aiueo')
          data2 = Base64.strict_encode64('12345')
          data3 = Base64.strict_encode64('abcde')
          should include '<div class="screenshot animation">'
          should include '<img src="data:image/png;base64,' + data1 + '"/>'
          should include '<img src="data:image/png;base64,' + data2 + '"/>'
          should include '<img src="data:image/png;base64,' + data3 + '"/></div>'
        end
      end

      context 'has single data' do
        let(:data_list) { [GnawrnipTest.image('aiueo')] }
        it {
          data = Base64.strict_encode64('aiueo')
          should include '<div class="screenshot">'
          should include '<img src="data:image/png;base64,' + data + '"/></div>'
        }
      end

      context 'has no data' do
        let(:data_list) { [] }
        it { should eq '' }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnawrnip-0.1.3 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.1.2 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.1.1 spec/gnawrnip/step_screenshot_spec.rb