Sha256: 46ae5fc697fd06322544656edb930400dba0f9903aa55c239ab88dc67bbefeb7
Contents?: true
Size: 1.85 KB
Versions: 1
Compression:
Stored size: 1.85 KB
Contents
# -*- coding: utf-8 -*- require File.expand_path('../../spec_helper', __FILE__) describe Pbl::CLI do before do @config = { username: "foo", password: "bar" } Pit.stub(:get).and_return(@config) end describe "#initialize" do subject { described_class.new } it { expect(subject).to be_an_instance_of(Pbl::CLI) } it "should invoked Pit.get" do Pit.should_receive(:get) .with(:pinboard, {:require=>{:username=>"your_account_in_pinboard", :password=>"your_password_in_pinboard"}}) .and_return({username: "foo", password: "bar"}) subject end it "should invoked Pinboard::Client.new" do Pit.stub(:get).and_return(@config) Pinboard::Client.should_receive(:new).with(@config) subject end it "should assign @pinboard" do Pit.stub(:get).and_return(@config) expect(subject.instance_eval { @pinboard }).to be_an_instance_of(Pinboard::Client) end end describe ".run" do subject { described_class.run } it "should invoked Pbl::Cli.new.run" do described_class.any_instance.should_receive(:run) subject end end describe "#run" do before do @subject = described_class.new end context "when ARGV is empty" do before do @subject.instance_variable_set(:@argv, []) end it "should invoke $stdout.puts at least once" do VCR.use_cassette 'pinboard_empty_requests' do $stdout.should_receive(:puts).at_least(:once) @subject.run end end end context "when ARGV is not empty" do before do @subject.instance_variable_set(:@argv, ["ruby"]) end it "should invoke $stdout.puts at least once" do VCR.use_cassette 'pinboard_requests' do $stdout.should_receive(:puts).at_least(:once) @subject.run end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pbl-0.0.6 | spec/pbl/cli_spec.rb |