Sha256: 3fce2e35de646c6cd0aedc03950518f097960f4509fa0fe6315f802b8c5e79eb

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

require_relative 'spec_helper'

describe TrelloWrapper do

  let!(:settings){ double('settings', developer_public_key: "mykey", member_token: "mytoken") }
  subject { described_class.new(settings) }

  before do
    stub_request(:get, "https://api.trello.com/1/boards/myboard?cards=open&key=mykey&lists=open&token=mytoken").
        to_return(:status => 200, :body => load_test_file("board.json"), :headers => {})
    full_board_mock
  end

  describe '.new' do
    it 'populates settings' do
      expect(subject.instance_variable_get(:@settings)).to be settings
    end

    it 'init trello configuration' do
      expect_any_instance_of(described_class).to receive(:init_trello)
      described_class.new(settings)
    end
  end

  describe '#board' do
    before(:each) do
      expect(subject).to receive(:retrieve_board_data).with('myboard').and_return(:board)
    end

    it 'finds board via Trello' do
      subject.board("myboard")
    end

    it 'instantiate ScrumBoard with trello board and settings' do
      expect(ScrumBoard).to receive(:new).with(:board, subject.instance_variable_get(:@settings))
      subject.board("myboard")
    end

    it 'returns instance of a ScrumBoard' do
      expect(subject.board("myboard")).to be_instance_of(ScrumBoard)
    end

    it 'memoize board object' do
      expect(subject.board("myboard")).to be subject.board("myboard")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trollolo-0.0.5 spec/unit/trello_wrapper_spec.rb
trollolo-0.0.4 spec/unit/trello_wrapper_spec.rb