Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify creating associations in specs #3732

Merged
merged 14 commits into from
Sep 30, 2019
Merged

Simplify creating associations in specs #3732

merged 14 commits into from
Sep 30, 2019

Conversation

javierm
Copy link
Member

@javierm javierm commented Sep 26, 2019

Objectives

  • Make tests easier to read
  • Reduce the number of useless assignment warnings given by the Ruby interpreter

@javierm javierm added the Specs label Sep 26, 2019
@javierm javierm self-assigned this Sep 26, 2019
@javierm javierm added this to Reviewing in Roadmap via automation Sep 26, 2019
spec/models/proposal_spec.rb Outdated Show resolved Hide resolved
spec/models/proposal_spec.rb Outdated Show resolved Hide resolved
spec/models/proposal_spec.rb Outdated Show resolved Hide resolved
spec/models/proposal_spec.rb Outdated Show resolved Hide resolved
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/lib/graphql_spec.rb Show resolved Hide resolved
spec/lib/graphql_spec.rb Show resolved Hide resolved
spec/lib/graphql_spec.rb Show resolved Hide resolved
spec/lib/graphql_spec.rb Show resolved Hide resolved
spec/features/budgets/investments_spec.rb Show resolved Hide resolved
spec/features/budgets/ballots_spec.rb Outdated Show resolved Hide resolved
spec/models/budget/investment_spec.rb Outdated Show resolved Hide resolved
spec/models/budget/investment_spec.rb Outdated Show resolved Hide resolved
@javierm javierm changed the title Simplify creating voters and followers in specs Simplify creating voters, balloters and followers in specs Sep 26, 2019
@javierm javierm changed the title Simplify creating voters, balloters and followers in specs Simplify creating vote, ballots and follows in specs Sep 26, 2019
@javierm javierm force-pushed the voters_in_specs branch 2 times, most recently from bbf2fe7 to a48bada Compare September 27, 2019 00:56
@javierm javierm changed the title Simplify creating vote, ballots and follows in specs Simplify creating votes, ballots and follows in specs Sep 27, 2019
@javierm javierm changed the title Simplify creating votes, ballots and follows in specs Simplify creating associations in specs Sep 27, 2019
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/models/budget/investment_spec.rb Show resolved Hide resolved
spec/features/budgets/investments_spec.rb Show resolved Hide resolved
spec/lib/email_digests_spec.rb Show resolved Hide resolved
spec/lib/email_digests_spec.rb Show resolved Hide resolved
spec/lib/email_digests_spec.rb Show resolved Hide resolved
@javierm javierm changed the base branch from array_specs to master September 29, 2019 22:37
While in theory we wouldn't need to use the `transient` nor the
`after(:create)` because there's already a `has_many :through`
association with followers, Factory Bot / ActiveRecord don't
automatically associate the followable, resulting in an invalid record
exception.
Note we usually cannot make it simple because officer assignments are
usually assigned to both a poll and a booth, and on a certain date.
However, in the few cases where the booth nor the date don't matter, we
can make the code a bit easier to read.
We were only using it in a few places.

I've left the current `final: true` statement in a few places where
using a trait would break vertical alignment, just in case.
Unless we're using the booth assignment for something else in the test,
when creating a voter from booth, specifying the poll and the booth is
enough to create a booth assignment.
@javierm javierm merged commit 59e3e32 into master Sep 30, 2019
Roadmap automation moved this from Reviewing to Release 1.1.0 Sep 30, 2019
@javierm javierm deleted the voters_in_specs branch September 30, 2019 12:38
smarques pushed a commit to venetochevogliamo/consul that referenced this pull request Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Roadmap
  
Release 1.1.0
Development

Successfully merging this pull request may close these issues.

None yet

2 participants