Sha256: d441af8f181c4865a9a3e20c5e73afd2570178b5f0d724dbcdebdbfeae853c54
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' require_relative '../../lib/sredder/sredderc' describe Sredder::Sredderc do def sample_file File.expand_path('spec/sample.sredderc') end describe 'initialization' do it 'sets the default file_path' do Sredder::Sredderc.new.file_path.should == File.expand_path('~/.sredderc') end end describe '#exists?' do it 'returns true if the file exists' do Sredder::Sredderc.new(sample_file).exists?.should be_true end it 'returns false if the file does not exist' do Sredder::Sredderc.new('/some/path').exists?.should be_false end end describe '#load' do it 'does not open the file if it does not exists' do File.should_receive(:open).never Sredder::Sredderc.new('/some/path').load end it 'loads the token and secret from the file if it exists' do rc = Sredder::Sredderc.new(sample_file) rc.load rc.secret.should == 'secret' rc.token.should == 'token' end end describe '#save' do it 'writes the data to the file' do io_stub = stub('io') io_stub.should_receive(:puts).with('secret') io_stub.should_receive(:puts).with('token') File.stub(:open).and_yield(io_stub) rc = Sredder::Sredderc.new(sample_file) rc.secret = 'secret' rc.token = 'token' rc.save end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sredder-0.0.4 | spec/sredder/sredderc_spec.rb |
sredder-0.0.2 | spec/sredder/sredderc_spec.rb |
sredder-0.0.1 | spec/sredder/sredderc_spec.rb |