test_track_rails_client 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +62 -7
  3. data/Rakefile +8 -4
  4. data/app/models/test_track/analytics/mixpanel_client.rb +2 -5
  5. data/app/models/test_track/analytics/safe_wrapper.rb +4 -4
  6. data/app/models/test_track/config_updater.rb +2 -2
  7. data/app/models/test_track/fake/split_registry.rb +2 -2
  8. data/app/models/test_track/notify_assignment_job.rb +3 -4
  9. data/app/models/test_track/offline_session.rb +6 -4
  10. data/app/models/test_track/remote/split_registry.rb +2 -2
  11. data/app/models/test_track/remote/visitor.rb +2 -2
  12. data/app/models/test_track/session.rb +12 -73
  13. data/app/models/test_track/unsynced_assignments_notifier.rb +2 -4
  14. data/app/models/test_track/vary_dsl.rb +5 -1
  15. data/app/models/test_track/visitor.rb +0 -11
  16. data/lib/test_track_rails_client/version.rb +1 -1
  17. data/vendor/gems/fakeable_her/fakeable_her.gemspec +2 -3
  18. data/vendor/gems/her/her.gemspec +4 -5
  19. data/vendor/gems/her/lib/her/api.rb +1 -1
  20. data/vendor/gems/her/lib/her/model/associations/association_proxy.rb +1 -2
  21. data/vendor/gems/her/lib/her/model/orm.rb +41 -29
  22. data/vendor/gems/her/lib/her/model/parse.rb +1 -0
  23. data/vendor/gems/her/lib/her/model/relation.rb +21 -6
  24. data/vendor/gems/her/lib/her/version.rb +1 -1
  25. metadata +52 -139
  26. data/app/models/test_track/create_alias_job.rb +0 -18
  27. data/vendor/gems/her/CONTRIBUTING.md +0 -26
  28. data/vendor/gems/her/Gemfile +0 -10
  29. data/vendor/gems/her/README.md +0 -1023
  30. data/vendor/gems/her/Rakefile +0 -11
  31. data/vendor/gems/her/UPGRADE.md +0 -101
  32. data/vendor/gems/her/gemfiles/Gemfile.activemodel-3.2.x +0 -7
  33. data/vendor/gems/her/gemfiles/Gemfile.activemodel-4.0 +0 -7
  34. data/vendor/gems/her/gemfiles/Gemfile.activemodel-4.1 +0 -7
  35. data/vendor/gems/her/gemfiles/Gemfile.activemodel-4.2 +0 -7
  36. data/vendor/gems/her/spec/api_spec.rb +0 -114
  37. data/vendor/gems/her/spec/collection_spec.rb +0 -26
  38. data/vendor/gems/her/spec/error_collection_spec.rb +0 -33
  39. data/vendor/gems/her/spec/json_api/model_spec.rb +0 -168
  40. data/vendor/gems/her/spec/middleware/accept_json_spec.rb +0 -10
  41. data/vendor/gems/her/spec/middleware/first_level_parse_json_spec.rb +0 -62
  42. data/vendor/gems/her/spec/middleware/json_api_parser_spec.rb +0 -32
  43. data/vendor/gems/her/spec/middleware/second_level_parse_json_spec.rb +0 -35
  44. data/vendor/gems/her/spec/model/associations/association_proxy_spec.rb +0 -31
  45. data/vendor/gems/her/spec/model/associations_spec.rb +0 -504
  46. data/vendor/gems/her/spec/model/attributes_spec.rb +0 -404
  47. data/vendor/gems/her/spec/model/callbacks_spec.rb +0 -145
  48. data/vendor/gems/her/spec/model/dirty_spec.rb +0 -110
  49. data/vendor/gems/her/spec/model/http_spec.rb +0 -165
  50. data/vendor/gems/her/spec/model/introspection_spec.rb +0 -76
  51. data/vendor/gems/her/spec/model/nested_attributes_spec.rb +0 -134
  52. data/vendor/gems/her/spec/model/orm_spec.rb +0 -791
  53. data/vendor/gems/her/spec/model/parse_spec.rb +0 -372
  54. data/vendor/gems/her/spec/model/paths_spec.rb +0 -347
  55. data/vendor/gems/her/spec/model/relation_spec.rb +0 -226
  56. data/vendor/gems/her/spec/model/validations_spec.rb +0 -42
  57. data/vendor/gems/her/spec/model_spec.rb +0 -31
  58. data/vendor/gems/her/spec/spec_helper.rb +0 -27
  59. data/vendor/gems/her/spec/support/extensions/array.rb +0 -5
  60. data/vendor/gems/her/spec/support/extensions/hash.rb +0 -5
  61. data/vendor/gems/her/spec/support/macros/her_macros.rb +0 -17
  62. data/vendor/gems/her/spec/support/macros/model_macros.rb +0 -36
  63. data/vendor/gems/her/spec/support/macros/request_macros.rb +0 -27
  64. data/vendor/gems/publicsuffix-ruby/CHANGELOG.md +0 -236
  65. data/vendor/gems/publicsuffix-ruby/Gemfile +0 -3
  66. data/vendor/gems/publicsuffix-ruby/LICENSE.txt +0 -22
  67. data/vendor/gems/publicsuffix-ruby/README.md +0 -151
  68. data/vendor/gems/publicsuffix-ruby/Rakefile +0 -109
  69. data/vendor/gems/publicsuffix-ruby/lib/definitions.txt +0 -11467
  70. data/vendor/gems/publicsuffix-ruby/lib/public_suffix/domain.rb +0 -387
  71. data/vendor/gems/publicsuffix-ruby/lib/public_suffix/errors.rb +0 -53
  72. data/vendor/gems/publicsuffix-ruby/lib/public_suffix/list.rb +0 -302
  73. data/vendor/gems/publicsuffix-ruby/lib/public_suffix/rule.rb +0 -373
  74. data/vendor/gems/publicsuffix-ruby/lib/public_suffix/version.rb +0 -23
  75. data/vendor/gems/publicsuffix-ruby/lib/public_suffix.rb +0 -131
  76. data/vendor/gems/publicsuffix-ruby/public_suffix.gemspec +0 -39
  77. data/vendor/gems/publicsuffix-ruby/test/acceptance_test.rb +0 -42
  78. data/vendor/gems/publicsuffix-ruby/test/test_helper.rb +0 -6
  79. data/vendor/gems/publicsuffix-ruby/test/unit/domain_test.rb +0 -170
  80. data/vendor/gems/publicsuffix-ruby/test/unit/errors_test.rb +0 -23
  81. data/vendor/gems/publicsuffix-ruby/test/unit/list_test.rb +0 -179
  82. data/vendor/gems/publicsuffix-ruby/test/unit/public_suffix_test.rb +0 -115
  83. data/vendor/gems/publicsuffix-ruby/test/unit/rule_test.rb +0 -307
  84. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/capybara_configuration.rb +0 -98
  85. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/matchers.rb +0 -151
  86. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/rspec_configuration.rb +0 -34
  87. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/rubocop/cop/betterment/html_safe.rb +0 -15
  88. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/rubocop/cop/betterment/raw.rb +0 -15
  89. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/rubocop/cop/betterment/safe_concat.rb +0 -15
  90. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/rubocop.rb +0 -3
  91. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/shared_examples/betterment_application_examples.rb +0 -43
  92. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/shared_examples.rb +0 -1
  93. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/site_prism_configuration.rb +0 -42
  94. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/site_prism_dropdown.rb +0 -17
  95. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/version.rb +0 -3
  96. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers/webmock_configuration.rb +0 -8
  97. data/vendor/gems/ruby_spec_helpers/lib/ruby_spec_helpers.rb +0 -2
  98. data/vendor/gems/ruby_spec_helpers/ruby_spec_helpers.gemspec +0 -25
@@ -1,165 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
-
4
- describe Her::Model::HTTP do
5
- context "binding a model with an API" do
6
- let(:api1) { Her::API.new :url => "https://api1.example.com" }
7
- let(:api2) { Her::API.new :url => "https://api2.example.com" }
8
-
9
- before do
10
- spawn_model("Foo::User")
11
- spawn_model("Foo::Comment")
12
- Her::API.setup :url => "https://api.example.com"
13
- end
14
-
15
- context "when binding a model to its superclass' her_api" do
16
- before do
17
- spawn_model "Foo::Superclass"
18
- Foo::Superclass.uses_api api1
19
- Foo::Subclass = Class.new(Foo::Superclass)
20
- end
21
-
22
- specify { Foo::Subclass.her_api.should == Foo::Superclass.her_api }
23
- end
24
-
25
- context "when changing her_api without changing the parent class' her_api" do
26
- before do
27
- spawn_model "Foo::Superclass"
28
- Foo::Subclass = Class.new(Foo::Superclass)
29
- Foo::Superclass.uses_api api1
30
- Foo::Subclass.uses_api api2
31
- end
32
-
33
- specify { Foo::Subclass.her_api.should_not == Foo::Superclass.her_api }
34
- end
35
- end
36
-
37
- context "making HTTP requests" do
38
- before do
39
- Her::API.setup :url => "https://api.example.com" do |builder|
40
- builder.use Her::Middleware::FirstLevelParseJSON
41
- builder.use Faraday::Request::UrlEncoded
42
- builder.adapter :test do |stub|
43
- stub.get("/users") { |env| [200, {}, [{ :id => 1 }].to_json] }
44
- stub.get("/users/1") { |env| [200, {}, { :id => 1 }.to_json] }
45
- stub.get("/users/2") { |env| [500, {}, nil] }
46
- stub.get("/users/popular") do |env|
47
- if env[:params]["page"] == "2"
48
- [200, {}, [{ :id => 3 }, { :id => 4 }].to_json]
49
- else
50
- [200, {}, [{ :id => 1 }, { :id => 2 }].to_json]
51
- end
52
- end
53
- end
54
- end
55
-
56
- spawn_model "Foo::User"
57
- end
58
-
59
- describe :get do
60
- subject { Foo::User.get(:popular) }
61
- its(:length) { should == 2 }
62
- specify { subject.first.id.should == 1 }
63
- end
64
-
65
- describe :get_raw do
66
- context "with a block" do
67
- specify do
68
- Foo::User.get_raw("/users") do |parsed_data, response|
69
- parsed_data[:data].should == [{ :id => 1 }]
70
- end
71
- end
72
- end
73
-
74
- context "with a return value" do
75
- subject { Foo::User.get_raw("/users") }
76
- specify { subject[:parsed_data][:data].should == [{ :id => 1 }] }
77
- end
78
- end
79
-
80
- describe :get_collection do
81
- context "with a String path" do
82
- subject { Foo::User.get_collection("/users/popular") }
83
- its(:length) { should == 2 }
84
- specify { subject.first.id.should == 1 }
85
- end
86
-
87
- context "with a Symbol" do
88
- subject { Foo::User.get_collection(:popular) }
89
- its(:length) { should == 2 }
90
- specify { subject.first.id.should == 1 }
91
- end
92
-
93
- context "with extra parameters" do
94
- subject { Foo::User.get_collection(:popular, :page => 2) }
95
- its(:length) { should == 2 }
96
- specify { subject.first.id.should == 3 }
97
- end
98
- end
99
-
100
- describe :get_resource do
101
- context "with a String path" do
102
- subject { Foo::User.get_resource("/users/1") }
103
- its(:id) { should == 1 }
104
- end
105
-
106
- context "with a Symbol" do
107
- subject { Foo::User.get_resource(:"1") }
108
- its(:id) { should == 1 }
109
- end
110
- end
111
-
112
- describe :get_raw do
113
- specify do
114
- Foo::User.get_raw(:popular) do |parsed_data, response|
115
- parsed_data[:data].should == [{ :id => 1 }, { :id => 2 }]
116
- end
117
- end
118
- end
119
-
120
- context 'remote server error' do
121
- it 'throws an exception that includes the requested class name and the HTTP error code' do
122
- expect { Foo::User.get_resource("/users/2") }.to raise_error(Her::Errors::RemoteServerError, /Foo::User returned a 500/)
123
- end
124
- end
125
- end
126
-
127
- context "setting custom HTTP requests" do
128
- before do
129
- Her::API.setup :url => "https://api.example.com" do |connection|
130
- connection.use Her::Middleware::FirstLevelParseJSON
131
- connection.adapter :test do |stub|
132
- stub.get("/users/popular") { |env| [200, {}, [{ :id => 1 }, { :id => 2 }].to_json] }
133
- stub.post("/users/from_default") { |env| [200, {}, { :id => 4 }.to_json] }
134
- end
135
- end
136
-
137
- spawn_model "Foo::User"
138
- end
139
-
140
- subject { Foo::User }
141
-
142
- describe :custom_get do
143
- context "without cache" do
144
- before { Foo::User.custom_get :popular, :recent }
145
- it { should respond_to(:popular) }
146
- it { should respond_to(:recent) }
147
-
148
- context "making the HTTP request" do
149
- subject { Foo::User.popular }
150
- its(:length) { should == 2 }
151
- end
152
- end
153
- end
154
-
155
- describe :custom_post do
156
- before { Foo::User.custom_post :from_default }
157
- it { should respond_to(:from_default) }
158
-
159
- context "making the HTTP request" do
160
- subject { Foo::User.from_default(:name => "Tobias Fünke") }
161
- its(:id) { should == 4 }
162
- end
163
- end
164
- end
165
- end
@@ -1,76 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
-
4
- describe Her::Model::Introspection do
5
- context "introspecting a resource" do
6
- before do
7
- Her::API.setup :url => "https://api.example.com" do |builder|
8
- builder.use Her::Middleware::FirstLevelParseJSON
9
- builder.use Faraday::Request::UrlEncoded
10
- builder.adapter :test do |stub|
11
- stub.post("/users") { |env| [200, {}, { :id => 1, :name => "Tobias Funke" }.to_json] }
12
- stub.get("/users/1") { |env| [200, {}, { :id => 1, :name => "Tobias Funke" }.to_json] }
13
- stub.put("/users/1") { |env| [200, {}, { :id => 1, :name => "Tobias Funke" }.to_json] }
14
- stub.delete("/users/1") { |env| [200, {}, { :id => 1, :name => "Tobias Funke" }.to_json] }
15
- stub.get("/projects/1/comments") { |env| [200, {}, [{ :id => 1, :body => "Hello!" }].to_json] }
16
- end
17
- end
18
-
19
- spawn_model "Foo::User"
20
- spawn_model "Foo::Comment" do
21
- collection_path "projects/:project_id/comments"
22
- end
23
- end
24
-
25
- describe "#inspect" do
26
- it "outputs resource attributes for an existing resource" do
27
- @user = Foo::User.find(1)
28
- ["#<Foo::User(users/1) name=\"Tobias Funke\" id=1>", "#<Foo::User(users/1) id=1 name=\"Tobias Funke\">"].should include(@user.inspect)
29
- end
30
-
31
- it "outputs resource attributes for an not-saved-yet resource" do
32
- @user = Foo::User.new(:name => "Tobias Funke")
33
- @user.inspect.should == "#<Foo::User(users) name=\"Tobias Funke\">"
34
- end
35
-
36
- it "outputs resource attributes using getters" do
37
- @user = Foo::User.new(:name => "Tobias Funke", :password => "Funke")
38
- @user.instance_eval {def password; 'filtered'; end}
39
- @user.inspect.should include("name=\"Tobias Funke\"")
40
- @user.inspect.should include("password=\"filtered\"")
41
- @user.inspect.should_not include("password=\"Funke\"")
42
- end
43
-
44
- it "support dash on attribute" do
45
- @user = Foo::User.new(:'life-span' => "3 years")
46
- @user.inspect.should include("life-span=\"3 years\"")
47
- end
48
- end
49
-
50
- describe "#inspect with errors in resource path" do
51
- it "prints the resource path as “unknown”" do
52
- @comment = Foo::Comment.where(:project_id => 1).first
53
- path = '<unknown path, missing `project_id`>'
54
- ["#<Foo::Comment(#{path}) body=\"Hello!\" id=1>", "#<Foo::Comment(#{path}) id=1 body=\"Hello!\">"].should include(@comment.inspect)
55
- end
56
- end
57
- end
58
-
59
- describe "#her_nearby_class" do
60
- context "for a class inside of a module" do
61
- before do
62
- spawn_model "Foo::User"
63
- spawn_model "Foo::AccessRecord"
64
- spawn_model "AccessRecord"
65
- spawn_model "Log"
66
- end
67
-
68
- it "returns a sibling class, if found" do
69
- Foo::User.her_nearby_class("AccessRecord").should == Foo::AccessRecord
70
- AccessRecord.her_nearby_class("Log").should == Log
71
- Foo::User.her_nearby_class("Log").should == Log
72
- Foo::User.her_nearby_class("X").should be_nil
73
- end
74
- end
75
- end
76
- end
@@ -1,134 +0,0 @@
1
- # encoding: utf-8
2
- require File.join(File.dirname(__FILE__), "../spec_helper.rb")
3
-
4
- describe Her::Model::NestedAttributes do
5
- context "with a belongs_to association" do
6
- before do
7
- Her::API.setup :url => "https://api.example.com" do |builder|
8
- builder.use Her::Middleware::FirstLevelParseJSON
9
- builder.use Faraday::Request::UrlEncoded
10
- end
11
-
12
- spawn_model "Foo::User" do
13
- belongs_to :company, :path => "/organizations/:id", :foreign_key => :organization_id
14
- accepts_nested_attributes_for :company
15
- end
16
-
17
- spawn_model "Foo::Company"
18
-
19
- @user_with_data_through_nested_attributes = Foo::User.new :name => "Test", :company_attributes => { :name => "Example Company" }
20
- end
21
-
22
- context "when child does not yet exist" do
23
- it "creates an instance of the associated class" do
24
- @user_with_data_through_nested_attributes.company.should be_a(Foo::Company)
25
- @user_with_data_through_nested_attributes.company.name.should == "Example Company"
26
- end
27
- end
28
-
29
- context "when child does exist" do
30
- it "updates the attributes of the associated object" do
31
- @user_with_data_through_nested_attributes.company_attributes = { :name => "Fünke's Company" }
32
- @user_with_data_through_nested_attributes.company.should be_a(Foo::Company)
33
- @user_with_data_through_nested_attributes.company.name.should == "Fünke's Company"
34
- end
35
- end
36
- end
37
-
38
- context "with a has_one association" do
39
- before do
40
- Her::API.setup :url => "https://api.example.com" do |builder|
41
- builder.use Her::Middleware::FirstLevelParseJSON
42
- builder.use Faraday::Request::UrlEncoded
43
- end
44
-
45
- spawn_model "Foo::User" do
46
- has_one :pet
47
- accepts_nested_attributes_for :pet
48
- end
49
-
50
- spawn_model "Foo::Pet"
51
-
52
- @user_with_data_through_nested_attributes = Foo::User.new :name => "Test", :pet_attributes => { :name => "Hasi" }
53
- end
54
-
55
- context "when child does not yet exist" do
56
- it "creates an instance of the associated class" do
57
- @user_with_data_through_nested_attributes.pet.should be_a(Foo::Pet)
58
- @user_with_data_through_nested_attributes.pet.name.should == "Hasi"
59
- end
60
- end
61
-
62
- context "when child does exist" do
63
- it "updates the attributes of the associated object" do
64
- @user_with_data_through_nested_attributes.pet_attributes = { :name => "Rodriguez" }
65
- @user_with_data_through_nested_attributes.pet.should be_a(Foo::Pet)
66
- @user_with_data_through_nested_attributes.pet.name.should == "Rodriguez"
67
- end
68
- end
69
- end
70
-
71
- context "with a has_many association" do
72
- before do
73
- Her::API.setup :url => "https://api.example.com" do |builder|
74
- builder.use Her::Middleware::FirstLevelParseJSON
75
- builder.use Faraday::Request::UrlEncoded
76
- end
77
-
78
- spawn_model "Foo::User" do
79
- has_many :pets
80
- accepts_nested_attributes_for :pets
81
- end
82
-
83
- spawn_model "Foo::Pet"
84
-
85
- @user_with_data_through_nested_attributes = Foo::User.new :name => "Test", :pets_attributes => [{ :name => "Hasi" }, { :name => "Rodriguez" }]
86
- end
87
-
88
- context "when children do not yet exist" do
89
- it "creates an instance of the associated class" do
90
- @user_with_data_through_nested_attributes.pets.length.should == 2
91
- @user_with_data_through_nested_attributes.pets[0].should be_a(Foo::Pet)
92
- @user_with_data_through_nested_attributes.pets[1].should be_a(Foo::Pet)
93
- @user_with_data_through_nested_attributes.pets[0].name.should == "Hasi"
94
- @user_with_data_through_nested_attributes.pets[1].name.should == "Rodriguez"
95
- end
96
- end
97
- end
98
-
99
- context "with a has_many association as a Hash" do
100
- before do
101
- Her::API.setup :url => "https://api.example.com" do |builder|
102
- builder.use Her::Middleware::FirstLevelParseJSON
103
- builder.use Faraday::Request::UrlEncoded
104
- end
105
-
106
- spawn_model "Foo::User" do
107
- has_many :pets
108
- accepts_nested_attributes_for :pets
109
- end
110
-
111
- spawn_model "Foo::Pet"
112
-
113
- @user_with_data_through_nested_attributes_as_hash = Foo::User.new :name => "Test", :pets_attributes => { '0' => { :name => "Hasi" }, '1' => { :name => "Rodriguez" }}
114
- end
115
-
116
- context "when children do not yet exist" do
117
- it "creates an instance of the associated class" do
118
- @user_with_data_through_nested_attributes_as_hash.pets.length.should == 2
119
- @user_with_data_through_nested_attributes_as_hash.pets[0].should be_a(Foo::Pet)
120
- @user_with_data_through_nested_attributes_as_hash.pets[1].should be_a(Foo::Pet)
121
- @user_with_data_through_nested_attributes_as_hash.pets[0].name.should == "Hasi"
122
- @user_with_data_through_nested_attributes_as_hash.pets[1].name.should == "Rodriguez"
123
- end
124
- end
125
- end
126
-
127
- context "with an unknown association" do
128
- it "raises an error" do
129
- expect {
130
- spawn_model("Foo::User") { accepts_nested_attributes_for :company }
131
- }.to raise_error(Her::Errors::AssociationUnknownError, 'Unknown association name :company')
132
- end
133
- end
134
- end