spec/unit/cli_spec.rb in trollolo-0.0.5 vs spec/unit/cli_spec.rb in trollolo-0.0.6

- old
+ new

@@ -1,26 +1,17 @@ require_relative 'spec_helper' include GivenFilesystemSpecHelpers describe Cli do - use_given_filesystem before(:each) do Cli.settings = dummy_settings @cli = Cli.new - - allow(STDOUT).to receive(:puts) end - - it "fetches burndown data" do - expect_any_instance_of(BurndownData).to receive(:fetch) - - @cli.fetch_burndown_data - end - + it "fetches burndown data from board-list" do full_board_mock dir = given_directory @cli.options = {"board-list" => "spec/data/board-list.yaml", "output" => dir} @@ -33,6 +24,76 @@ expect_any_instance_of(Backup).to receive(:backup) @cli.options = {"board-id" => "1234"} @cli.backup end + it "gets lists" do + full_board_mock + @cli.options = {"board-id" => "53186e8391ef8671265eba9d"} + expected_output = <<EOT +Sprint Backlog +Doing +Done Sprint 10 +Done Sprint 9 +Done Sprint 8 +Legend +EOT + expect { + @cli.get_lists + }.to output(expected_output).to_stdout + end + + it "gets cards" do + full_board_mock + @cli.options = {"board-id" => "53186e8391ef8671265eba9d"} + expected_output = <<EOT +Sprint 3 +(3) P1: Fill Backlog column +(5) P4: Read data from Trollolo +(3) P5: Save read data as reference data +Waterline +(8) P6: Celebrate testing board +(2) P2: Fill Doing column +(1) Fix emergency +Burndown chart +Sprint 10 +(3) P3: Fill Done columns +(2) Some unplanned work +Burndown chart +Sprint 9 +(2) P1: Explain purpose +(2) P2: Create Scrum columns +Burndown chart +Sprint 8 +(1) P1: Create Trello Testing Board +(5) P2: Add fancy background +(1) P4: Add legend +Purpose +Background image +EOT + expect { + @cli.get_cards + }.to output(expected_output).to_stdout + end + + it "gets checklists" do + full_board_mock + @cli.options = {"board-id" => "53186e8391ef8671265eba9d"} + expected_output = <<EOT +Tasks +Tasks +Tasks +Tasks +Tasks +Feedback +Tasks +Tasks +Tasks +Tasks +Tasks +Tasks +EOT + expect { + @cli.get_checklists + }.to output(expected_output).to_stdout + end end