Sha256: 7566d97f67b42ca94532dfda87bf9316fd57e0ee0d503eccec8d4b4d2eb66b17
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
# coding: utf-8 require File.dirname(__FILE__) + '/../spec_helper' describe 'Retter::Command#preview', clean: :all do let(:command) { Retter::Command.new } let(:preview) { retter_config.retter_home.join('.preview.html').read } let(:wip_file) { retter_config.wip_file } let(:date_file) { retter_config.retter_file(Date.parse(date_str)) } before do Retter.stub!(:config) { retter_config } end context 'no options' do let(:article) { 'w00t!' } before do wip_file.open('w') {|f| f.puts article } Launchy.stub!(:open).with(anything) command.preview end subject { texts_of(preview, 'article p') } it { should == [article] } end context 'with date' do let(:article) { 'おはようございます' } let(:date_str) { '20110101' } before do wip_file.open('w') {|f| f.puts 'おやすみなさい' } date_file.open('w') {|f| f.puts article } Launchy.stub!(:open).with(anything) command.stub!(:options) { {date: date_str} } command.preview end subject { texts_of(preview, 'article p') } it { should_not be_include('おやすみなさい') } it { should be_include(article) } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
retter-0.1.3 | spec/command/preview_spec.rb |
retter-0.1.2 | spec/command/preview_spec.rb |
retter-0.1.1 | spec/command/preview_spec.rb |