Sha256: 5a8ba2b9ca1671d6af251edb1ac197b6933db0c0cc0f51b73c16de1ab73bb0db
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 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 raise SystemExit error" do expect { @subject.run }.to raise_error SystemExit end end context "when ARGV is not empty" do before do @subject.instance_variable_set(:@argv, ["ruby"]) end # should not call api actually pending "should not raise SystemExit error" do expect { @subject.run }.to_not raise_error SystemExit end # should not call api actually pending "should invoked @pinboard.posts" do @subject.run end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pbl-0.0.2 | spec/pbl/cli_spec.rb |