Sha256: 07c8e91130712c35c07ec75465b5ca32b460d9af68e6988b2c75a05de0cf0c83
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
require_relative '../../../test_helper' module Troo describe CreateBoard do let(:described_class) { CreateBoard } let(:board_name) { 'My New Board' } let(:description) { 'A very brief description...' } before do @board = Fabricate(:board, name: board_name, description: description) Persistence::Board.stubs(:for).returns(@board) end after { database_cleanup } describe '.initialize' do subject { described_class.new(board_name, description) } it 'assigns the name to an instance variable' do subject.instance_variable_get('@name').must_equal(board_name) end it 'assigns the description to an instance variable' do subject.instance_variable_get('@description') .must_equal(description) end end describe '.with' do before do VCR.insert_cassette(:create_board, decode_compressed_response: true) end after { VCR.eject_cassette } subject { described_class.with(board_name, description) } context 'when the board was created' do it 'returns the new board' do subject.must_equal(@board) end end context 'when the board was not created' do before { Trello::Board.stubs(:create).raises(Trello::Error) } it { subject.must_equal false } end context 'when the access token is invalid' do before do Trello::Board.stubs(:create) .raises(Trello::InvalidAccessToken) end subject { described_class.with(board_name, description) } it 'catches the exception and re-raises' do proc { subject }.must_raise(Troo::InvalidAccessToken) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.8 | test/lib/troo/actions/create_board_test.rb |