Sha256: f18a7c36e27f9e6975248111e3fb6280c39182b6a2a003b3b1bcfccdaa1c6a0d

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'gnawrnip/step_screenshot'

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

    describe '.build' do
      before :each do
        allow(template).to receive(:develop).and_return('')
      end

      let(:step) do
        metadata = { gnawrnip: { screenshot: paths } }

        double('step', example: { metadata: metadata }).tap do |step|
          allow(step).to receive_message_chain(:example, :metadata) { metadata }
        end
      end

      subject { template.build(step) }

      context 'has multiple data' do
        let(:paths) do
          [
            double(path: '/path/to/A.png'),
            double(path: '/path/to/B.png'),
            double(path: '/path/to/C.png')
          ]
        end

        it 'should get image tag and source that base64 encoded' do
          should include '<div class="screenshot animation">'
          should include '<div class="nav">'
        end
      end

      context 'has single data' do
        let(:paths) { [double(path: '/path/to/A.png')] }
        it do
          should include '<div class="screenshot">'
          should_not include '<div class="nav">'
        end
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gnawrnip-0.8.0 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.7.0 spec/gnawrnip/step_screenshot_spec.rb
gnawrnip-0.6.0 spec/gnawrnip/step_screenshot_spec.rb