spec/lib/caramelize/page_spec.rb in caramelize-1.0.0 vs spec/lib/caramelize/page_spec.rb in caramelize-1.1.0

- old
+ new

@@ -2,12 +2,13 @@ describe Caramelize::Page do let(:message) { 'Dinosaurs really had feathers, do not forget!' } let(:author) { OpenStruct.new(name: 'Jeff Goldblum', email: 'jeff.g@example.com') } + let(:title){ 'Feathered Dinosaurs' } subject(:page) do - Caramelize::Page.new( title: 'Feathered Dinosaurs', + Caramelize::Page.new(title: title, message: message, time: Time.parse('2015-02-12'), body: 'Dinosaurs are awesome and have feathers!', author: author ) end @@ -28,9 +29,26 @@ expect(page.author.name).to eql(author.name) expect(page.author.email).to eql(author.email) end end end + + describe '#path' do + context "title is 'Home'" do + let(:title) { 'Home' } + it { expect(page.path).to eq 'Home'} + end + + context "title is 'Feathered Dinosaurs'" do + it { expect(page.path).to eq 'Feathered Dinosaurs'} + end + + context "title is 'Space/Feathered Dinosaurs'" do + let(:title) { 'Space/Feathered Dinosaurs' } + it { expect(page.path).to eq 'Space/feathered dinosaurs'} + end + end + describe '#commit_message' do context 'page has message' do it 'uses page.title' do expect(page.commit_message).to eq 'Dinosaurs really had feathers, do not forget!'