Sha256: c678b18831e1dec32e32ca0ce7579d7027a4c1aa2265f11747401850ce87fc30

Contents?: true

Size: 1019 Bytes

Versions: 3

Compression:

Stored size: 1019 Bytes

Contents

require 'spec_helper'

describe SPV::Element do
  let(:node)    { double('node of DOM') }
  let(:parent)  { double('parent element') }
  let(:applier) { instance_double('SPV::Applier', apply_vcr: true) }

  before do
    SPV::Applier.stub(:new).and_return(applier)
  end

  describe '.new' do
    it 'initializes the fixtures applier' do
      expect(SPV::Applier).to receive(:new).with(
        parent
      )

      b1 = proc { }

      described_class.new(nil, parent)
    end
  end

  describe '#click_and_apply_vcr' do
    subject { described_class.new(nil, parent) }

    before do
      subject.stub(:click)
      subject.stub(:shift_event).and_yield.and_return(applier)
    end

    it 'shifts a click event to the applier' do
      expect(subject).to receive(:shift_event).and_yield.and_return(applier)
      expect(subject).to receive(:click)

      subject.click_and_apply_vcr
    end

    it 'applies vcr' do
      expect(applier).to receive(:apply_vcr)

      subject.click_and_apply_vcr
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
site_prism.vcr-0.1.2 spec/unit/element_spec.rb
site_prism.vcr-0.1.1 spec/unit/element_spec.rb
site_prism.vcr-0.1.0 spec/unit/element_spec.rb