test/lib/troo/cli/default_cli_test.rb in troo-0.0.3 vs test/lib/troo/cli/default_cli_test.rb in troo-0.0.4
- old
+ new
@@ -3,75 +3,81 @@
module Troo
module CLI
describe Default do
let(:described_class) { Default }
- let(:board_id) { "526d8e130a14a9d846001d96" }
- let(:card_id) { "526d8f19ddb279532e005259" }
- let(:list_id) { "526d8e130a14a9d846001d97" }
- before do
- @board = Fabricate.build(:board)
- @list = Fabricate.build(:list)
- @card = Fabricate.build(:card)
-
- Troo::BoardRetrieval.stubs(:retrieve).returns(@board)
- Troo::CardRetrieval.stubs(:retrieve).returns(@card)
- Troo::ListRetrieval.stubs(:retrieve).returns(@list)
- end
-
- after { database_cleanup }
-
describe "#board" do
- subject { capture_io { described_class.new.board(board_id) }.join }
+ let(:id) { "526d8e130a14a9d846001d96" }
- context "when the board_id cannot be found" do
+ subject { capture_io { described_class.new.board(id) }.join }
+
+ context "when the id cannot be found" do
before { Troo::BoardRetrieval.stubs(:retrieve).returns(nil) }
it "returns a polite message" do
subject.must_match /Board cannot be found/
end
end
- context "when the board_id was found" do
+ context "when the id was found" do
+ before do
+ @board = Fabricate.build(:board)
+ Troo::BoardRetrieval.stubs(:retrieve).returns(@board)
+ end
+
it "returns a polite message" do
- subject.must_match /Board '#{@board.name}' set to default/
+ subject.must_match /'#{@board.name}' set as default/
end
end
end
describe "#card" do
- subject { capture_io { described_class.new.card(card_id) }.join }
+ let(:id) { "526d8f19ddb279532e005259" }
- context "when the card_id cannot be found" do
+ before do
+ @card = Fabricate.build(:card)
+ Troo::CardRetrieval.stubs(:retrieve).returns(@card)
+ end
+
+ subject { capture_io { described_class.new.card(id) }.join }
+
+ context "when the id cannot be found" do
before { Troo::CardRetrieval.stubs(:retrieve).returns(nil) }
it "returns a polite message" do
subject.must_match /Card cannot be found/
end
end
- context "when the card_id was found" do
+ context "when the id was found" do
it "returns a polite message" do
- subject.must_match /Card '#{@card.name}' set to default/
+ subject.must_match /'#{@card.name}' set as default/
end
end
end
describe "#list" do
- subject { capture_io { described_class.new.list(list_id) }.join }
+ let(:id) { "526d8e130a14a9d846001d97" }
- context "when the list_id cannot be found" do
+ subject { capture_io { described_class.new.list(id) }.join }
+
+ context "when the id cannot be found" do
before { Troo::ListRetrieval.stubs(:retrieve).returns(nil) }
it "returns a polite message" do
subject.must_match /List cannot be found/
end
end
- context "when the list_id was found" do
+ context "when the id was found" do
+ before do
+ @list = Fabricate.build(:list)
+ Troo::ListRetrieval.stubs(:retrieve).returns(@list)
+ end
+
it "returns a polite message" do
- subject.must_match /List '#{@list.name}' set to default/
+ subject.must_match /'#{@list.name}' set as default/
end
end
end
end
end