summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-22 16:53:07 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-02-23 10:43:29 -0300
commit28097398c5087c3ffc7dc6cd63cd7f8304d3dae9 (patch)
tree46dd2f1a06f1ccae484aacef3cf64d31333d1f1d /spec
parentf5be56710f0e71042df98f7f7eefbcfed72d912d (diff)
downloadgitlab-ce-28097398c5087c3ffc7dc6cd63cd7f8304d3dae9.tar.gz
Does not raise an error when Todo is already marked as done
Diffstat (limited to 'spec')
-rw-r--r--spec/models/todo_spec.rb (renamed from spec/models/todo_spec.rb.rb)34
1 files changed, 7 insertions, 27 deletions
diff --git a/spec/models/todo_spec.rb.rb b/spec/models/todo_spec.rb
index ac481bf9fbd..fe9ea7e7d1e 100644
--- a/spec/models/todo_spec.rb.rb
+++ b/spec/models/todo_spec.rb
@@ -37,20 +37,6 @@ describe Todo, models: true do
it { is_expected.to validate_presence_of(:user) }
end
- describe '#action_name' do
- it 'returns proper message when action is an assigment' do
- subject.action = Todo::ASSIGNED
-
- expect(subject.action_name).to eq 'assigned'
- end
-
- it 'returns proper message when action is a mention' do
- subject.action = Todo::MENTIONED
-
- expect(subject.action_name).to eq 'mentioned you on'
- end
- end
-
describe '#body' do
before do
subject.target = build(:issue, title: 'Bugfix')
@@ -69,21 +55,15 @@ describe Todo, models: true do
end
end
- describe '#target_iid' do
- let(:issue) { build(:issue, id: 1, iid: 5) }
-
- before do
- subject.target = issue
- end
-
- it 'returns target.iid when target respond to iid' do
- expect(subject.target_iid).to eq 5
+ describe '#done!' do
+ it 'changes state to done' do
+ todo = create(:todo, state: :pending)
+ expect { todo.done! }.to change(todo, :state).from('pending').to('done')
end
- it 'returns target_id when target does not respond to iid' do
- allow(issue).to receive(:respond_to?).with(:iid).and_return(false)
-
- expect(subject.target_iid).to eq 1
+ it 'does not raise error when is already done' do
+ todo = create(:todo, state: :done)
+ expect { todo.done! }.not_to raise_error
end
end
end