2020-07-01 06:39:02 +02:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
|
|
RSpec.describe TaskRequest, type: :model do
|
|
|
|
|
describe "associations" do
|
|
|
|
|
it { is_expected.to belong_to(:project) }
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-20 13:28:40 +00:00
|
|
|
describe "validations" do
|
|
|
|
|
it { should validate_numericality_of(:time_allowed).only_integer.is_greater_than_or_equal_to(2).allow_nil }
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-01 06:39:02 +02:00
|
|
|
describe "enums" do
|
|
|
|
|
it { is_expected.to define_enum_for(:status).with_values([:pending, :completed, :cancelled]) }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "#order_by_recent" do
|
|
|
|
|
subject { described_class }
|
|
|
|
|
it { is_expected.to respond_to(:order_by_recent) }
|
|
|
|
|
end
|
|
|
|
|
end
|