require 'spec_helper' module Alchemy shared_examples_for "having a hint" do describe '#hint' do context 'with hint as text' do before do expect(subject).to receive(:definition).and_return({'hint' => 'The hint'}) end it "returns the hint" do expect(subject.hint).to eq('The hint') end end context 'with hint set to true' do before do expect(subject).to receive(:definition).and_return({'hint' => true}) expect(I18n).to receive(:t).and_return('The hint') end it "returns the hint from translation" do expect(subject.hint).to eq('The hint') end end end end end