Sha256: e7797503d4514c09d450c7740ebeb693efb64c8fa9e0758653498ec77e9c575b

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 KB

Contents

require_relative "../../../test_helper"

module Troo
  describe RefreshAll do
    let(:described_class) { RefreshAll }
    let(:options) { { } }

    before do
      @board = Fabricate(:board)
      @list = Fabricate(:list)
      @card = Fabricate(:card)

      External::Board.stubs(:fetch_all).returns([@board])
      External::List.stubs(:fetch).returns([@list])
      External::Card.stubs(:fetch).returns([@card])
      External::Comment.stubs(:fetch).returns([])
      External::Member.stubs(:fetch).returns([])
    end

    after { database_cleanup }

    describe ".initialize" do
      subject { described_class.new(@board, options) }

      it "assigns the board to an instance variable" do
        subject.instance_variable_get("@board").must_equal(@board)
      end

      it "assigns the options to an instance variable" do
        subject.instance_variable_get("@options").must_equal(options)
      end
    end

    describe ".all" do
      let(:board) { nil }

      subject { described_class.all(board, options) }

      it "returns true when successful" do
        subject.must_equal(true)
      end
    end

    describe ".default" do
      subject { described_class.default(@board, options) }

      it "returns true when successful" do
        subject.must_equal(true)
      end
    end

    describe ".lists" do
      subject { described_class.lists(@board, options) }

      it "refreshes the lists for the board specified" do
        subject.size.must_equal(1)
      end
    end

    describe ".cards" do
      subject { described_class.cards(@board, options) }

      it "refreshes the cards for the board specified" do
        subject.size.must_equal(1)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
troo-0.0.7 test/lib/troo/actions/refresh_all_test.rb
troo-0.0.6 test/lib/troo/actions/refresh_all_test.rb
troo-0.0.5 test/lib/troo/actions/refresh_all_test.rb
troo-0.0.4 test/lib/troo/actions/refresh_all_test.rb
troo-0.0.3 test/lib/troo/actions/refresh_all_test.rb
troo-0.0.2 test/lib/troo/actions/refresh_all_test.rb