Skip to content

Commit

Permalink
add action_item model specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaiprivalov committed Oct 18, 2019
1 parent a5ca4e6 commit 0b66833
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/models/action_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,24 @@
it { is_expected.to transition_from(:done).to(:pending).on_event(:reopen) }
end
end

describe '#move!' do
let_it_be(:prev_board) { create(:board) }
let_it_be(:new_board) { create(:board) }
let_it_be(:action_item) { create(:action_item, board: prev_board) }

subject { action_item.move!(new_board) }

it 'changes action_item board_id to the newly provided one' do
expect { subject }.to change { action_item.board_id }.from(prev_board.id).to(new_board.id)
end

it 'increments times moved' do
expect { subject }.to change { action_item.times_moved }.by(1)
end

it 'does not create new action item record' do
expect { subject }.to_not change { ActionItem.count }
end
end
end

0 comments on commit 0b66833

Please sign in to comment.