-
-
Save bricker/318f78e10e2d63f3f79d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
shared_examples "extended_definition" do | |
it "must contain original definition" do | |
expect(sense.extended_definition).to include(sense.definition) | |
end | |
it "must contain both sample texts" do | |
expect( | |
sense.samples.pluck(:sample).collect { |t| sense.extended_definition.include? t }.inject(:&) | |
).to be_truthy | |
end | |
end | |
describe WordSense do | |
context "dictionary word 'test'" do | |
let(:sense) { Word.find_by_name('test').senses.first } | |
include_examples 'extended_definition' | |
end | |
context "mocked word 'fnord'" do | |
let(:sense) { instance_double('WordSense', :definition => 'original definition') } | |
before do | |
sense.samples << instance_double('WordSampleDefinition', :sample => 'first sample definition') | |
sense.samples << instance_double('WordSampleDefinition', :sample => 'second sample definition') | |
end | |
include_examples 'extended_definition' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment