Sha256: 44faa5f12372b066ba1369cf0139fb2087746aac50b25b779b552e2bd08ad9cc
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe LinkThumbnailer::Graders::Position do let(:description) { double('description') } let(:instance) { described_class.new(description) } describe '#call' do let(:action) { instance.call } context 'when position is 0' do before do allow(description).to receive(:position).and_return(0) allow(description).to receive(:candidates_number).and_return(1) end it { expect(action).to eq(1.0) } end context 'when position is 1 over 1 candidates' do before do allow(description).to receive(:position).and_return(1) allow(description).to receive(:candidates_number).and_return(1) end it { expect(action).to eq(0.0) } end context 'when position is 1 over more than 1 candidates' do before do allow(description).to receive(:position).and_return(1) allow(description).to receive(:candidates_number).and_return(2) end it { expect(action).to eq(0.5) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
link_thumbnailer-3.4.0 | spec/graders/position_spec.rb |
link_thumbnailer-3.3.2 | spec/graders/position_spec.rb |