Add lambda to the validations that use model constants
In this way when we need modify the constants model value in the model/custom folder, adding lambda it will be possible load the new values.
This commit is contained in:
@@ -17,6 +17,13 @@ describe Activity do
|
||||
expect(build(:activity, action: "dissapear")).not_to be_valid
|
||||
end
|
||||
|
||||
it "dynamically validates valid actions" do
|
||||
stub_const("#{Activity}::VALID_ACTIONS", %w[custom])
|
||||
|
||||
expect(build(:activity, action: "custom")).to be_valid
|
||||
expect(build(:activity, action: "hide")).not_to be_valid
|
||||
end
|
||||
|
||||
describe "log" do
|
||||
it "creates an activity entry" do
|
||||
user = create(:user)
|
||||
|
||||
Reference in New Issue
Block a user