spec/lib/hackpad/cli/store_spec.rb in hackpad-cli-0.1.0 vs spec/lib/hackpad/cli/store_spec.rb in hackpad-cli-0.1.1
- old
+ new
@@ -5,11 +5,16 @@
require 'hackpad/cli/pad'
describe Hackpad::Cli::Store do
let(:configdir) { File.expand_path('../../../../files', __FILE__) }
- let(:options) { { configdir: configdir, workspace: 'default' } }
+ let(:options) { OpenStruct.new(
+ configdir: configdir,
+ workspace: 'default',
+ workspacedir: File.join(configdir, 'default')
+ )
+ }
before :each do
subject.prepare options
end
@@ -23,30 +28,36 @@
it { expect(list[2].id).to eq '23489g' }
it { expect(list[2].title).to eq 'third' }
it { expect(list[2].cached_at).to eq 'some time' }
end
- describe '.exists?' do
+ describe '.exist?' do
context 'when refresh option is set,' do
- let(:options) { { configdir: configdir, workspace: 'default', refresh: true } }
+ let(:options) { OpenStruct.new(
+ configdir: configdir,
+ workspace: 'default',
+ workspacedir: File.join(configdir, 'default'),
+ refresh: true
+ )
+ }
before do
subject.prepare options
FileUtils.touch File.join(configdir, 'default', 'pads', 'txt', 'xxx')
end
after { FileUtils.rm File.join(configdir, 'default', 'pads', 'txt', 'xxx') }
- it { expect(subject.exists? 'txt', 'xxx').to be false }
+ it { expect(subject.exist? 'txt', 'xxx').to be false }
end
context 'when refresh option is not set,' do
context "when config file don't exist," do
- it { expect(subject.exists? 'txt', 'xxx').to be false }
+ it { expect(subject.exist? 'txt', 'xxx').to be false }
end
context 'when configfile exists,' do
before { FileUtils.touch File.join(configdir, 'default', 'pads', 'txt', 'xxx') }
after { FileUtils.rm File.join(configdir, 'default', 'pads', 'txt', 'xxx') }
- it { expect(subject.exists? 'txt', 'xxx').to be true }
+ it { expect(subject.exist? 'txt', 'xxx').to be true }
end
end
end