Sha256: b0240ae95c0cdcd533cee0b0d35b42a93fda7ea6cb250a1d60413ba22b381f0a
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true 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 expect(LinkThumbnailer::Grader).to receive(:new).at_least(1).times.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
link_thumbnailer-3.4.0 | spec/models/description_spec.rb |
link_thumbnailer-3.3.2 | spec/models/description_spec.rb |