Sha256: 8abcc6c9202c4a3888917f1756437f044e14c505a687568baaadc4f3f9dce2aa

Contents?: true

Size: 571 Bytes

Versions: 6

Compression:

Stored size: 571 Bytes

Contents

require 'spec_helper'

describe LinkThumbnailer::Grader do

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

  describe '#call' do

    let(:probability)   { 0.5 }
    let(:weight) { 2 }
    let(:grader)  { double('grader', call: probability, weight: weight) }
    let(:lambda)  { ->(_) { grader } }
    let(:graders) { [lambda, lambda] }
    let(:action)  { instance.call }

    before do
      instance.stub(:graders).and_return(graders)
    end

    it { expect(action).to eq((0.5 * 0.5) ** weight) }

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
link_thumbnailer-3.3.0 spec/grader_spec.rb
link_thumbnailer-3.2.1 spec/grader_spec.rb
link_thumbnailer-3.2.0 spec/grader_spec.rb
link_thumbnailer-3.1.2 spec/grader_spec.rb
link_thumbnailer-3.1.1 spec/grader_spec.rb
link_thumbnailer-3.1.0 spec/grader_spec.rb