spec/unit/configuration/setup_spec.rb in imap-backup-1.0.10 vs spec/unit/configuration/setup_spec.rb in imap-backup-1.0.11

- old
+ new

@@ -18,11 +18,12 @@ let(:data) { {:accounts => [account1]} } let(:store) do double( 'Imap::Backup::Configuration::Store', :data => data, - :path => '/base/path' + :path => '/base/path', + :save => nil ) end before :each do allow(Imap::Backup::Configuration::Store).to receive(:new).and_return(store) @@ -43,19 +44,19 @@ end end end it 'clears the screen' do - subject.should_receive(:system).with('clear') - subject.run + + expect(subject).to have_received(:system).with('clear') end it 'should list accounts' do subject.run - @output.string.should =~ /account@example.com/ + expect(@output.string).to match /account@example.com/ end context 'adding accounts' do let(:blank_account) do { @@ -78,17 +79,18 @@ expect(data[:accounts][1]).to eq(blank_account) end end it 'should save the configuration' do - @input.should_receive(:gets).with().and_return("save\n") - store.should_receive(:save).with() + allow(@input).to receive(:gets).and_return("save\n") subject.run + + expect(store).to have_received(:save) end it 'should exit' do - @input.should_receive(:gets).with().and_return("quit\n") + allow(@input).to receive(:gets).and_return("quit\n") subject.run end end end