Sha256: fb81e6e70ee14e4baa33552596aee78c6a23802c4521707f220d144ce53935cc
Contents?: true
Size: 1.21 KB
Versions: 10
Compression:
Stored size: 1.21 KB
Contents
require 'spec_helper' describe LinkThumbnailer::Models::Description do let(:text) { 'bar' } let(:grader) { double(call: 0) } let(:node) { double(text: 'bar') } let(:instance) { described_class.new(node, text) } before do ::LinkThumbnailer::Grader.should_receive(:new).at_least(1).and_return(grader) end describe '#to_s' do let(:action) { instance.to_s } it { expect(action).to eq(text) } end describe '#<=>' do let(:another_instance) { described_class.new(node, text) } let(:probability) { 0.5 } let(:action) { instance <=> another_instance } before do another_instance.probability = probability end context 'when instance probability is lower' do before do instance.probability = probability - 0.5 end it { expect(action).to eq(-1) } end context 'when instance probability is equal' do before do instance.probability = probability end it { expect(action).to eq(0) } end context 'when instance probability is greater' do before do instance.probability = probability + 0.5 end it { expect(action).to eq(1) } end end end
Version data entries
10 entries across 10 versions & 1 rubygems