Sha256: 7fc5f73a5d56c66cdc4f01a93aad6332ecd4e026f10c208416b570ed4d0c8133

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe LinkThumbnailer::Graders::HtmlAttribute do

  let(:description) { double('description') }
  let(:instance)    { described_class.new(description, :class) }

  describe '#call' do

    let(:action) { instance.call }

    context 'when current node does not match attribute' do

      before do
        allow(instance).to receive(:attribute?).and_return(false)
      end

      it { expect(action).to eq(1.0) }

    end

    context 'when current node has a negative attribute' do

      before do
        allow(instance).to receive(:attribute?).and_return(true)
        allow(instance).to receive(:negative?).and_return(true)
        allow(instance).to receive(:positive?).and_return(false)
      end

      it { expect(action).to eq(0.0) }

    end

    context 'when current node has a positive attribute' do

      before do
        allow(instance).to receive(:attribute?).and_return(true)
        allow(instance).to receive(:negative?).and_return(false)
        allow(instance).to receive(:positive?).and_return(true)
      end

      it { expect(action).to eq(1.0) }

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
link_thumbnailer-3.4.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-3.3.2 spec/graders/html_attribute_spec.rb