mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Use AR enums in reviewables related code
This is the first patch of many to replace our custom enums in Ruby by the ones provided by `ActiveRecord`.
This commit is contained in:
committed by
Loïc Guitaut
parent
0c743a591f
commit
26fe047724
@@ -14,8 +14,8 @@ RSpec.describe ReviewableHistory, type: :model do
|
||||
history = reviewable.history
|
||||
expect(history.size).to eq(3)
|
||||
|
||||
expect(history[0].reviewable_history_type).to eq(ReviewableHistory.types[:created])
|
||||
expect(history[0].status).to eq(Reviewable.statuses[:pending])
|
||||
expect(history[0]).to be_created
|
||||
expect(history[0]).to be_pending
|
||||
expect(history[0].created_by).to eq(admin)
|
||||
end
|
||||
|
||||
@@ -26,12 +26,12 @@ RSpec.describe ReviewableHistory, type: :model do
|
||||
|
||||
history = reviewable.history
|
||||
expect(history.size).to eq(3)
|
||||
expect(history[1].reviewable_history_type).to eq(ReviewableHistory.types[:transitioned])
|
||||
expect(history[1].status).to eq(Reviewable.statuses[:approved])
|
||||
expect(history[1]).to be_transitioned
|
||||
expect(history[1]).to be_approved
|
||||
expect(history[1].created_by).to eq(moderator)
|
||||
|
||||
expect(history[2].reviewable_history_type).to eq(ReviewableHistory.types[:transitioned])
|
||||
expect(history[2].status).to eq(Reviewable.statuses[:pending])
|
||||
expect(history[2]).to be_transitioned
|
||||
expect(history[2]).to be_pending
|
||||
expect(history[2].created_by).to eq(admin)
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ RSpec.describe ReviewableHistory, type: :model do
|
||||
history = reviewable.history
|
||||
expect(history.size).to eq(2)
|
||||
|
||||
expect(history[1].reviewable_history_type).to eq(ReviewableHistory.types[:edited])
|
||||
expect(history[1]).to be_edited
|
||||
expect(history[1].created_by).to eq(moderator)
|
||||
expect(history[1].edited).to eq("category_id" => [old_category.id, nil])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user