Skip to content

Improve workshop factories - #16481

Merged
mehalshah merged 6 commits into
stagingfrom
improve_workshop_factories
Jul 19, 2017
Merged

Improve workshop factories#16481
mehalshah merged 6 commits into
stagingfrom
improve_workshop_factories

Conversation

@mehalshah

@mehalshah mehalshah commented Jul 18, 2017

Copy link
Copy Markdown
Contributor

We now have simpler factories for creating local workshops with survey responses, as well as teachercon workshops with survey responses.

@mehalshah
mehalshah requested a review from aoby July 18, 2017 23:48
@mehalshah

Copy link
Copy Markdown
Contributor Author

Some tests may break with this. I'm waiting for the circle run to complete, then will fix them

Comment thread dashboard/test/factories/factories.rb Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we sequence name here too for parity with facilitator?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this part better belongs in the pd_teachercon_survey factory, with a trait or transient attribute something for facilitators.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure - I can move it there and make it an after_create. We just need the facilitators from it

@mehalshah mehalshah Jul 19, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Having second thoughts on moving this.

For testing purposes, I'm usually going to be saying "Give me a workshop with a bunch of enrollments and survey responses associated with those enrollments." With the current setup, that's one line with this statement. With what you're proposing, it would instead be

create the workshop
create the enrollments
create the surveys that use workshop data to fill out their contents

I'm not really sure if that's better.

If this isn't a big deal, I'd like to punt on this for the time being because of the time pressure. I'm also anxious about a change that will make me have to rewrite a lot of the existing survey tests - the main motivation for this change is to make it easier for me to make sample data on my localhost

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think you misunderstood my suggestion. I'm talking about encapsulation. The workflow here will remain the same.

This whole section from line 63 - 79 is creating a pd_teachercon_survey based on a set of facilitators. Logically that belongs in the pd_teachercon_survey factory so it can be used on its own. As a new trait or transient attribute that shouldn't affect other tests. Then this section, inside pd_workshop factory can simply call create :pd_teachercon_survey and pass in the list of facilitators.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this looks incomplete

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will fix the error

@mehalshah
mehalshah force-pushed the improve_workshop_factories branch from e0ca6e1 to a05b50e Compare July 19, 2017 18:22
@mehalshah
mehalshah merged commit 48bf752 into staging Jul 19, 2017
@davidsbailey
davidsbailey deleted the improve_workshop_factories branch January 17, 2018 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants