Sha256: 4fed919b907345daaeff8f0e62cad0109bacf248acc8998f04ce530271a27c31

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe Caramelize::GollumOutput do

  describe :revisions_by_author do
    let(:wiki) { Caramelize::Wiki.new }
    context 'revisions is empty' do
      context 'and titles is empty' do
        it 'returns empty array' do
          allow(wiki).to receive(:titles).and_return []
          expect(wiki.revisions_by_title('title')).to eq []
        end
      end
    end
    context 'revisions are given' do
      context 'and title given' do
        it 'returns empty array' do
          pages = []
          home_1 = OpenStruct.new(title: 'Home', time: Time.parse('2015-01-23'))
          pages << home_1
          pages << OpenStruct.new(title: 'Example', time: Time.parse('2015-01-20'))
          pages << OpenStruct.new(title: 'Authors', time: Time.parse('2015-01-30'))
          home_2 = OpenStruct.new(title: 'Home', time: Time.parse('2014-01-23'))
          pages << home_2
          allow(wiki).to receive(:revisions).and_return pages
          expect(wiki.revisions_by_title('Home')).to eq [home_2, home_1]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caramelize-0.3.0 spec/lib/caramelize/wiki/wiki_spec.rb