Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix decision factories to take into account STI
- Loading branch information
Showing
8 changed files
with
26 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 1 addition & 9 deletions
10
src/api/spec/factories/decisions.rb → src/api/spec/factories/decision_cleared.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
FactoryBot.define do | ||
factory :decision do | ||
factory :decision_cleared do | ||
moderator factory: [:user] | ||
reason { Faker::Markdown.emphasis } | ||
|
||
after(:build) do |decision| | ||
decision.reports << create(:report, reason: 'This is spam!') if decision.reports.empty? | ||
end | ||
|
||
trait :cleared do | ||
type { 'DecisionCleared' } | ||
end | ||
|
||
trait :favored do | ||
type { 'DecisionFavored' } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FactoryBot.define do | ||
factory :decision_favored do | ||
moderator factory: [:user] | ||
reason { Faker::Markdown.emphasis } | ||
|
||
after(:build) do |decision| | ||
decision.reports << create(:report, reason: 'This is spam!') if decision.reports.empty? | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters