Sha256: 3e8b495aad4a1b2296e5fe2d50772ed20c720db5144c9b7f63ed3582b75a4925

Contents?: true

Size: 1.01 KB

Versions: 19

Compression:

Stored size: 1.01 KB

Contents

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(0) }

    context 'when current node does not match attribute' do

      before do
        instance.stub(:attribute?).and_return(false)
      end

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

    end

    context 'when current node has a negative attribute' do

      before do
        instance.stub(:attribute?).and_return(true)
        instance.stub(:negative?).and_return(true)
        instance.stub(:positive?).and_return(false)
      end

      it { expect(action).to eq(-25) }

    end

    context 'when current node has a positive attribute' do

      before do
        instance.stub(:attribute?).and_return(true)
        instance.stub(:negative?).and_return(false)
        instance.stub(:positive?).and_return(true)
      end

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

    end

  end

end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
link_thumbnailer-2.6.1 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.6.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.5.2 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.5.1 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.5.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.4.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.3.2 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.3.1 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.3.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.2.3 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.2.2 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.2.1 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.2.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.1.0 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.0.4 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.0.3 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.0.2 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.0.1 spec/graders/html_attribute_spec.rb
link_thumbnailer-2.0.0 spec/graders/html_attribute_spec.rb