Files
grecia/spec/models/dashboard/executed_action_spec.rb
Juan Salvador Pérez García 50f73abb0c Fixes #voodoorai2000 comments
Fixes some comments from #voodoorai2000 for the PR to consul
2018-07-27 16:30:03 +02:00

30 lines
932 B
Ruby

require 'rails_helper'
describe Dashboard::ExecutedAction do
let(:proposal) { create :proposal }
let(:action) do
create :dashboard_action, request_to_administrators: true, link: Faker::Internet.url
end
it 'is invalid when proposal is nil' do
action = build(:dashboard_executed_action, proposal: nil)
expect(action).not_to be_valid
end
it 'is invalid when action is nil' do
action = build(:dashboard_executed_action, action: nil)
expect(action).not_to be_valid
end
it 'is invalid when executed_at is nil' do
action = build(:dashboard_executed_action, executed_at: nil)
expect(action).not_to be_valid
end
it 'when action has been already executed it is invalid' do
_executed = create(:dashboard_executed_action, proposal: proposal, action: action)
action = build(:dashboard_executed_action, proposal: proposal, action: action)
expect(action).not_to be_valid
end
end