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

Split Detail Remote Model #26

Merged
merged 13 commits into from Apr 10, 2017

Conversation

agirlnamedsophia
Copy link
Contributor

/domain @Betterment/test_track_core
/platform @dschaub @samandmoore

  • This adds a SplitDetail remote model that hits the split_details endpoint in test_track
  • relies on this PR to be merged first

@nanda-prbot
Copy link

Needs somebody from @Betterment/test_track_core to claim domain review.
Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

attributes :name

def self.from_name(name)
raise "must provide a name" unless name.present?
Copy link
Contributor

Choose a reason for hiding this comment

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

is this necessary? if you pass a blank value you'll get a 404, and if you leave the argument out you'll get a ruby error


def self.fake_instance_attributes(_)
{
split_name: "fake_visitor_id",
Copy link
Contributor

Choose a reason for hiding this comment

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

fake_split_name?

description: "fake_description",
owner: "fake_retail",
location: "fake_activity",
platform: "fake_mobile"
Copy link
Contributor

Choose a reason for hiding this comment

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

that should be mobile cause it can only be one of two values, right?

expect(subject.description).to eq("fake_description")
expect(subject.owner).to eq("fake_retail")
expect(subject.location).to eq("fake_activity")
expect(subject.platform).to eq("fake_mobile")
Copy link
Contributor

Choose a reason for hiding this comment

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

s/fake_mobile/mobile/

@dschaub
Copy link
Contributor

dschaub commented Apr 6, 2017

<< domain tafn

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@agirlnamedsophia agirlnamedsophia changed the title Spit Detail Remote Model Split Detail Remote Model Apr 6, 2017
@agirlnamedsophia
Copy link
Contributor Author

nanda?

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@agirlnamedsophia
Copy link
Contributor Author

agirlnamedsophia commented Apr 6, 2017

accidental click :(


collection_path '/api/v1/split_details'

attributes :name
Copy link
Contributor

Choose a reason for hiding this comment

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

missed this, i think we want all of the other attributes here too

Copy link
Contributor

@dschaub dschaub left a comment

Choose a reason for hiding this comment

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

some initial thoughts on the new stuff

@@ -0,0 +1,34 @@
class TestTrack::Fake::SchemaLoading
Copy link
Contributor

Choose a reason for hiding this comment

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

we could probably just name this Schema

Copy link
Contributor

Choose a reason for hiding this comment

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

also, worth it to make this a singleton? otherwise if we have multiple uses it'll load the same schema file twice, right?


def initialize
@split_hash = _split_hash
end
Copy link
Contributor

@dschaub dschaub Apr 7, 2017

Choose a reason for hiding this comment

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

can we make this a public method called split_hash that memoizes the result of _split_hash? (or uses the begin...end style)

class TestTrack::Fake::Split
def self.instance
@instance ||= new
end
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just use Singleton for this?

describe '#show' do
it 'returns fake split details' do
get :show, format: :json
expect(response_json).to eq TestTrack::FakeServer.split_details
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to list out the expected values? this seems like it's just asserting that a variable is equal to itself

@agirlnamedsophia
Copy link
Contributor Author

nanda?

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

Copy link
Member

@samandmoore samandmoore left a comment

Choose a reason for hiding this comment

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

A few comments about the specifics on the implementation, but in general this looks great. Let's just catch up re: fake data offline. We should be able to get on the same page and then ship this!

platform: "desktop"
owner: "hat makers"
assignment_criteria: "user has bought one hat"
description: "promotion test to see if users will buy more hats"
Copy link
Member

Choose a reason for hiding this comment

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

is this actually getting dumped into the schema.yml now? i don't think that it is and i don't think that it should be.

the schema.yml is only meant to track the critical details of splits, their variants, and the associated weighting. we don't want it to include any of the optional split detail data that is inputted through the admin ui.


def _split_details
split_hash = TestTrack::Fake::Schema.instance.split_hash
{ "name" => "banner_color" }.merge(split_hash["banner_color"].except("weights"))
Copy link
Member

Choose a reason for hiding this comment

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

going along with the comment i left elsewhere about not putting the split details in the schema.yml file, i think that we should just have this return fake data just like we do in the fake_instance_attributes method.

i am also noticing that this fake doesn't include any of the details about the variants in this split. is that an intentional omission?

@@ -0,0 +1,14 @@
class TestTrack::Fake::Split
Copy link
Member

Choose a reason for hiding this comment

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

i think this is actually SplitDetail, right?

@agirlnamedsophia
Copy link
Contributor Author

nanda?

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@agirlnamedsophia
Copy link
Contributor Author

alright, I think I've got it!

nanda?

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@dschaub
Copy link
Contributor

dschaub commented Apr 10, 2017

domain lgtm

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@samandmoore
Copy link
Member

samandmoore commented Apr 10, 2017

<<domainlgtm

@samandmoore
Copy link
Member

nanda?

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@samandmoore
Copy link
Member

<<domainlgtm again

@nanda-prbot
Copy link

Needs somebody from @dschaub and @samandmoore to claim platform review.

Use the shovel operator to claim, e.g.:

@myname << domain && platform

@samandmoore
Copy link
Member

oh. i can't read. sigh.

<<platformlgtm

@nanda-prbot
Copy link

Ready to merge! 🔩 🙆‍♀️ ⚡

@agirlnamedsophia agirlnamedsophia merged commit 510bde9 into master Apr 10, 2017
@agirlnamedsophia agirlnamedsophia deleted the sr/master/split-detail-remote-model branch April 10, 2017 20:53
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.

None yet

4 participants