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

Remove redundant code #3719

Merged
merged 8 commits into from
Sep 25, 2019
Merged

Remove redundant code #3719

merged 8 commits into from
Sep 25, 2019

Conversation

javierm
Copy link
Member

@javierm javierm commented Sep 24, 2019

References

Objectives

  • Reduce the complexity of the code creating data in specs
  • Make it easier to further refactor specs to remove unused variables
  • Remove a redundant scope in the I18nContent model

Since two records cannot have the same key, having a scope that will
always return just one record is the same as using `find_by_key`.
The factory creating assignments automatically assigns a poll to it, so
we don't use the poll for anything else, there's no need to explicitely
create it.
The factories creating proposals and debates automatically create an
author.
One test was testing regular users can't access results, and another one
was testing neither regular users nor managers can. So the second test
can just test the admin scenario, and we're still covering everything.
This data was added in commit 62088bc, but the changes in that commit
don't seem to be related to the number of questions in a poll.
Questions are automatically created by the poll_question_answer factory.
@javierm javierm self-assigned this Sep 24, 2019
@javierm javierm added this to Reviewing in Roadmap via automation Sep 24, 2019
@@ -434,8 +434,7 @@

scenario "Display links to vote on groups with no investments voted yet" do
group = create(:budget_group, budget: budget)
heading = create(:budget_heading, name: "District 1", group: group, price: 100)

heading = create(:budget_heading, group: group, price: 100)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UselessAssignment: Useless assignment to variable - heading. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will remove it in a different pull request.

The "name" attribute is automatically generated by the budget heading
factory. And the "price" attribute is out of context and not needed
since this test doesn't create investments.
@javierm javierm changed the base branch from remove_obsolete_code to master September 25, 2019 09:46
@javierm javierm merged commit 4ee494a into master Sep 25, 2019
Roadmap automation moved this from Reviewing to Release 1.1.0 Sep 25, 2019
@javierm javierm deleted the remove_redundant_code branch September 25, 2019 09:55
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
Projects
No open projects
Roadmap
  
Release 1.1.0
Development

Successfully merging this pull request may close these issues.

None yet

2 participants