Sha256: bfbc935d350dc7c570cb543e0955f51a9e4ea3d0ed4cd066eca466c07d9985bf
Contents?: true
Size: 1.05 KB
Versions: 12
Compression:
Stored size: 1.05 KB
Contents
require 'spec_helper' describe LinkThumbnailer::Graders::LinkDensity do let(:description) { double('description') } let(:instance) { described_class.new(description) } describe '#call' do let(:previous_score) { 1 } let(:action) { instance.call(previous_score) } context 'when density_ratio is 0' do before do instance.stub(:density_ratio).and_return(0) end it { expect(action).to eq(0) } end context 'when density is not 0' do before do instance.stub(:density_ratio).and_return(10) end it { expect(action).to eq(10) } end end describe '#density' do let(:links) { ['foo'] } let(:action) { instance.send(:density) } before do instance.stub(:links).and_return(links) instance.stub(:text).and_return(text) end context 'with text' do let(:text) { 'abcd' } it { expect(action).to eq(0.25) } end context 'without text' do let(:text) { '' } it { expect(action).to eq(0) } end end end
Version data entries
12 entries across 12 versions & 1 rubygems