Sha256: 6df1a3a449c638a65918561e981edeaba37e539c88dcde82e592224120ca6d86

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 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
          [
            double(to_base64: 'aiueo', width: 640, height: 480),
            double(to_base64: '12345', width: 512, height: 200),
            double(to_base64: 'abcde', width: 640, height: 320)
          ]
        end

        it 'should get image tag and source that base64 encoded' do
          should include '<div class="screenshot animation">'
          should include '<img width="640" height="480" src="data:image/png;base64,aiueo"/>'
          should include '<img width="512" height="200" src="data:image/png;base64,12345"/>'
          should include '<img width="640" height="320" src="data:image/png;base64,abcde"/>'
          should include '<div class="nav">'
        end
      end

      context 'has single data' do
        let(:data_list) { [ double(to_base64: 'abcde', width: 640, height: 480) ] }
        it {
          should include '<div class="screenshot">'
          should include '<img width="640" height="480" src="data:image/png;base64,abcde"/></div>'
          should_not include '<div class="nav">'
        }
      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.2.5 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.2.4 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.2.3 spec/gnawrnip/step_screenshot_spec.rb