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
Split Detail Remote Model #26
Conversation
Needs somebody from @Betterment/test_track_core to claim domain review. Use the shovel operator to claim, e.g.:
|
attributes :name | ||
|
||
def self.from_name(name) | ||
raise "must provide a name" unless name.present? |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/fake_mobile/mobile/
<< domain tafn |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
nanda? |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
accidental click :( |
|
||
collection_path '/api/v1/split_details' | ||
|
||
attributes :name |
There was a problem hiding this comment.
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
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
app/models/test_track/fake/split.rb
Outdated
class TestTrack::Fake::Split | ||
def self.instance | ||
@instance ||= new | ||
end |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
nanda? |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
There was a problem hiding this 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!
spec/dummy/db/test_track_schema.yml
Outdated
platform: "desktop" | ||
owner: "hat makers" | ||
assignment_criteria: "user has bought one hat" | ||
description: "promotion test to see if users will buy more hats" |
There was a problem hiding this comment.
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.
app/models/test_track/fake/split.rb
Outdated
|
||
def _split_details | ||
split_hash = TestTrack::Fake::Schema.instance.split_hash | ||
{ "name" => "banner_color" }.merge(split_hash["banner_color"].except("weights")) |
There was a problem hiding this comment.
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?
app/models/test_track/fake/split.rb
Outdated
@@ -0,0 +1,14 @@ | |||
class TestTrack::Fake::Split |
There was a problem hiding this comment.
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?
nanda? |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
… the endpoint works
alright, I think I've got it! nanda? |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
domain lgtm |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
<<domainlgtm |
nanda? |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
<<domainlgtm again |
Needs somebody from @dschaub and @samandmoore to claim platform review. Use the shovel operator to claim, e.g.:
|
oh. i can't read. sigh. <<platformlgtm |
Ready to merge! 🔩 🙆♀️ ⚡ |
/domain @Betterment/test_track_core
/platform @dschaub @samandmoore
split_details
endpoint in test_track