Sha256: 3cce49c59c2eca6161fc765e9777ab99742b1be58da41ab60f89142760e40ef1
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' describe ContentBlock, type: :model do let(:bilbo) do described_class.create!( name: ContentBlock::RESEARCHER, value: '<h1>Bilbo Baggins</h1>', created_at: Time.now) end let(:frodo) do described_class.create!( name: ContentBlock::RESEARCHER, value: '<h1>Frodo Baggins</h1>', created_at: 2.hours.ago) end let(:marketing) do described_class.create!( name: ContentBlock::MARKETING, value: '<h1>Marketing Text</h1>') end describe '.recent_researchers' do before do frodo bilbo marketing end subject { described_class.recent_researchers } it 'returns featured_researcher entries in chronological order' do expect(described_class.count).to eq 3 expect(subject).to eq [bilbo, frodo] end end describe '.featured_researcher' do before do frodo bilbo marketing end subject { described_class.featured_researcher } it 'finds the most recent entry for featured_researcher' do expect(subject).to eq bilbo end end end
Version data entries
6 entries across 6 versions & 1 rubygems