2014-08-30 17:38:47 +00:00
|
|
|
require 'rails_helper'
|
2014-01-18 13:53:15 +00:00
|
|
|
|
2014-02-01 00:26:58 +00:00
|
|
|
describe BareAsciicastPagePresenter do
|
2014-02-01 09:29:49 +00:00
|
|
|
|
2014-01-18 13:53:15 +00:00
|
|
|
describe '.build' do
|
|
|
|
subject { described_class.build(asciicast, playback_options) }
|
|
|
|
|
|
|
|
let(:asciicast) { stub_model(Asciicast, decorate: decorated_asciicast) }
|
|
|
|
let(:playback_options) { { speed: 3.0 } }
|
2014-07-01 20:35:47 +00:00
|
|
|
let(:decorated_asciicast) { double('decorated_asciicast', theme_name: 'foo') }
|
2014-01-18 13:53:15 +00:00
|
|
|
|
2014-02-01 09:29:49 +00:00
|
|
|
it "builds presenter with given asciicast decorated" do
|
2014-01-18 13:53:15 +00:00
|
|
|
expect(subject.asciicast).to be(decorated_asciicast)
|
|
|
|
end
|
|
|
|
|
2014-02-01 09:29:49 +00:00
|
|
|
it "builds presenter with given playback options" do
|
2014-01-18 13:53:15 +00:00
|
|
|
expect(subject.playback_options.speed).to eq(3.0)
|
2014-07-01 20:35:47 +00:00
|
|
|
expect(subject.playback_options.theme).to eq('foo')
|
2014-01-18 13:53:15 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:presenter) { described_class.new(asciicast, nil) }
|
|
|
|
let(:asciicast) { stub_model(Asciicast, id: 123) }
|
|
|
|
|
|
|
|
describe '#asciicast_id' do
|
|
|
|
subject { presenter.asciicast_id }
|
|
|
|
|
|
|
|
it { should eq(123) }
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|