split_cat 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +21 -11
- data/app/controllers/split_cat/experiments_controller.rb +45 -7
- data/app/helpers/split_cat/experiments_helper.rb +1 -4
- data/app/models/split_cat/experiment.rb +3 -21
- data/app/views/split_cat/experiments/_form.html.erb +31 -12
- data/app/views/split_cat/experiments/_search.html.erb +8 -0
- data/app/views/split_cat/experiments/edit.html.erb +6 -0
- data/app/views/split_cat/experiments/index.html.erb +4 -0
- data/app/views/split_cat/experiments/new.html.erb +5 -0
- data/config/locales/en.yml +0 -2
- data/config/routes.rb +1 -1
- data/lib/split_cat/helpers.rb +8 -0
- data/lib/split_cat/version.rb +1 -1
- data/spec/controllers/split_cat/experiments_controller_spec.rb +146 -50
- data/spec/data/helpers/experiment_info.html +1 -1
- data/spec/data/helpers/experiment_info.html.tmp +1 -1
- data/spec/data/helpers/experiment_table.html +1 -1
- data/spec/data/helpers/experiment_table.html.tmp +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1008 -0
- data/spec/dummy/log/test.log +58637 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/pids/server.pid +1 -0
- data/spec/helpers/split_cat/experiments_helper_spec.rb +1 -1
- data/spec/models/split_cat/experiment_spec.rb +5 -44
- data/spec/routing/split_cat/experiments_routing_spec.rb +39 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/support/stub_view_routes.rb +3 -1
- data/spec/views/split_cat/experiments/edit.html.erb_spec.rb +16 -0
- data/spec/views/split_cat/experiments/index.html.erb_spec.rb +8 -7
- data/spec/views/split_cat/experiments/new.html.erb_spec.rb +16 -0
- data/spec/views/split_cat/experiments/show.html.erb_spec.rb +6 -8
- metadata +24 -55
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
66363
|
@@ -130,7 +130,7 @@ describe SplitCat::ExperimentsHelper do
|
|
130
130
|
it 'renders the _form partial with locals' do
|
131
131
|
name = 'foo'
|
132
132
|
active = true
|
133
|
-
helper.should_receive( :render ).with( :partial => '
|
133
|
+
helper.should_receive( :render ).with( :partial => 'search', :locals => { :name => name, :active => active } )
|
134
134
|
helper.experiment_search_form( name, active )
|
135
135
|
end
|
136
136
|
|
@@ -77,42 +77,6 @@ module SplitCat
|
|
77
77
|
|
78
78
|
context 'instance methods' do
|
79
79
|
|
80
|
-
#############################################################################
|
81
|
-
# #active?
|
82
|
-
|
83
|
-
describe '#active?' do
|
84
|
-
|
85
|
-
context 'when experiment is not configured' do
|
86
|
-
|
87
|
-
it 'returns false' do
|
88
|
-
experiment_created.active?.should be_false
|
89
|
-
end
|
90
|
-
|
91
|
-
end
|
92
|
-
|
93
|
-
context 'when experiment is configured' do
|
94
|
-
|
95
|
-
before( :each ) do
|
96
|
-
config.experiment( experiment_created.name ) do |c|
|
97
|
-
experiment_created.hypotheses.each { |h| c.hypothesis( h.name, h.weight ) }
|
98
|
-
experiment_created.goals.each { |g| c.goal( g.name ) }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'returns true if experiment has same structure as configuration' do
|
103
|
-
experiment_created.should_receive( :same_structure? ).and_return( true )
|
104
|
-
experiment_created.active?.should be_true
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'returns false if experiment has different structure as configuration' do
|
108
|
-
experiment_created.should_receive( :same_structure? ).and_return( false )
|
109
|
-
experiment_created.active?.should be_false
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
80
|
#############################################################################
|
117
81
|
# Experiment#choose_hypothesis
|
118
82
|
|
@@ -450,11 +414,10 @@ module SplitCat
|
|
450
414
|
Experiment.factory( :does_not_exist ).should be_nil
|
451
415
|
end
|
452
416
|
|
453
|
-
it '
|
454
|
-
|
455
|
-
Experiment.factory(
|
417
|
+
it 'returns database version' do
|
418
|
+
experiment = Experiment.create( :name => 'foo' )
|
419
|
+
Experiment.factory( experiment.name ).should eql( experiment )
|
456
420
|
end
|
457
|
-
|
458
421
|
end
|
459
422
|
|
460
423
|
context 'when experiment is configured' do
|
@@ -484,9 +447,8 @@ module SplitCat
|
|
484
447
|
Experiment.factory( experiment_created.name ).should be( experiment_created )
|
485
448
|
end
|
486
449
|
|
487
|
-
it 'returns
|
450
|
+
it 'returns the config structure if the db and config do not match' do
|
488
451
|
experiment_created.should_receive( :same_structure? ).and_return( false )
|
489
|
-
Rails.logger.should_receive( :error )
|
490
452
|
Experiment.factory( experiment_created.name ).should be_nil
|
491
453
|
end
|
492
454
|
|
@@ -505,10 +467,9 @@ module SplitCat
|
|
505
467
|
Experiment.factory( experiment.name ).should be( experiment )
|
506
468
|
end
|
507
469
|
|
508
|
-
it 'returns nil
|
470
|
+
it 'returns nil if it is unable to save' do
|
509
471
|
config.should_receive( :template ).with( experiment.name ).and_return( experiment )
|
510
472
|
experiment.should_receive( :save ).and_return( false )
|
511
|
-
Rails.logger.should_receive( :error )
|
512
473
|
Experiment.factory( experiment.name ).should be( nil )
|
513
474
|
end
|
514
475
|
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module SplitCat
|
4
|
+
describe ExperimentsController do
|
5
|
+
describe 'routing' do
|
6
|
+
|
7
|
+
routes { SplitCat::Engine.routes }
|
8
|
+
|
9
|
+
it 'routes to #index' do
|
10
|
+
get('/experiments').should route_to('split_cat/experiments#index')
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'routes to #new' do
|
14
|
+
get('/experiments/new').should route_to('split_cat/experiments#new')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'routes to #show' do
|
18
|
+
get('/experiments/1').should route_to('split_cat/experiments#show', :id => '1')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'routes to #edit' do
|
22
|
+
get('/experiments/1/edit').should route_to('split_cat/experiments#edit', :id => '1')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'routes to #create' do
|
26
|
+
post('/experiments').should route_to('split_cat/experiments#create')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'routes to #update' do
|
30
|
+
put('/experiments/1').should route_to('split_cat/experiments#update', :id => '1')
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'routes to #destroy' do
|
34
|
+
delete('/experiments/1').should route_to('split_cat/experiments#destroy', :id => '1')
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
ENV['RAILS_ENV'] ||= 'test'
|
3
3
|
|
4
4
|
require 'simplecov'
|
5
|
+
require 'coveralls'
|
6
|
+
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
8
|
+
SimpleCov::Formatter::HTMLFormatter,
|
9
|
+
Coveralls::SimpleCov::Formatter
|
10
|
+
]
|
5
11
|
|
6
12
|
SimpleCov.start 'rails' do
|
7
13
|
add_filter '/vendor/'
|
@@ -4,6 +4,8 @@
|
|
4
4
|
|
5
5
|
def stub_view_routes
|
6
6
|
|
7
|
-
view.stub( :experiment_path ).and_return( '/split_cat/
|
7
|
+
view.stub( :experiment_path ).and_return( '/split_cat/experiment' )
|
8
|
+
view.stub( :experiments_path ).and_return( '/split_cat/experiments' )
|
9
|
+
view.stub( :new_experiment_path ).and_return( '/split_cat/experiments/new' )
|
8
10
|
|
9
11
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "split_cat/experiments/edit" do
|
4
|
+
|
5
|
+
let( :experiment ) { FactoryGirl.create( :experiment_full ) }
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
stub_view_routes
|
9
|
+
|
10
|
+
assign(:experiment, experiment )
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders the edit experiment form" do
|
14
|
+
render
|
15
|
+
end
|
16
|
+
end
|
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
describe "split_cat/experiments/index" do
|
4
4
|
|
5
|
-
|
5
|
+
let( :experiment ) { FactoryGirl.create( :experiment_full ) }
|
6
6
|
|
7
|
-
before(
|
8
|
-
|
7
|
+
before(:each) do
|
8
|
+
stub_view_routes
|
9
|
+
|
10
|
+
assign(:experiments, [ experiment, experiment ])
|
9
11
|
end
|
10
12
|
|
11
|
-
it
|
13
|
+
it "renders a list of experiments" do
|
12
14
|
render
|
13
15
|
end
|
14
|
-
|
15
|
-
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "split_cat/experiments/new" do
|
4
|
+
|
5
|
+
let( :experiment ) { FactoryGirl.build( :experiment_full ) }
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
stub_view_routes
|
9
|
+
|
10
|
+
assign(:experiment, experiment )
|
11
|
+
end
|
12
|
+
|
13
|
+
it "renders new experiment form" do
|
14
|
+
render
|
15
|
+
end
|
16
|
+
end
|
@@ -1,18 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
|
3
|
+
describe "split_cat/experiments/show" do
|
4
4
|
|
5
|
-
|
5
|
+
let( :experiment ) { FactoryGirl.create( :experiment_full ) }
|
6
6
|
|
7
|
-
before(
|
7
|
+
before(:each) do
|
8
8
|
stub_view_routes
|
9
9
|
|
10
|
-
assign( :experiment,
|
11
|
-
assign( :hypothesis_counts, {} )
|
10
|
+
assign( :experiment, experiment )
|
12
11
|
end
|
13
12
|
|
14
|
-
it
|
13
|
+
it "renders" do
|
15
14
|
render
|
16
15
|
end
|
17
|
-
|
18
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split_cat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich Humphrey
|
@@ -34,14 +34,14 @@ dependencies:
|
|
34
34
|
name: sqlite3
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
@@ -119,75 +119,33 @@ dependencies:
|
|
119
119
|
- !ruby/object:Gem::Version
|
120
120
|
version: '4.0'
|
121
121
|
- !ruby/object:Gem::Dependency
|
122
|
-
name:
|
123
|
-
requirement: !ruby/object:Gem::Requirement
|
124
|
-
requirements:
|
125
|
-
- - "~>"
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '0'
|
128
|
-
type: :development
|
129
|
-
prerelease: false
|
130
|
-
version_requirements: !ruby/object:Gem::Requirement
|
131
|
-
requirements:
|
132
|
-
- - "~>"
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
version: '0'
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
name: autotest-fsevent
|
122
|
+
name: simplecov
|
137
123
|
requirement: !ruby/object:Gem::Requirement
|
138
124
|
requirements:
|
139
|
-
- - "
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '0'
|
142
|
-
type: :development
|
143
|
-
prerelease: false
|
144
|
-
version_requirements: !ruby/object:Gem::Requirement
|
145
|
-
requirements:
|
146
|
-
- - "~>"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '0'
|
149
|
-
- !ruby/object:Gem::Dependency
|
150
|
-
name: autotest-growl
|
151
|
-
requirement: !ruby/object:Gem::Requirement
|
152
|
-
requirements:
|
153
|
-
- - "~>"
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: '0'
|
156
|
-
type: :development
|
157
|
-
prerelease: false
|
158
|
-
version_requirements: !ruby/object:Gem::Requirement
|
159
|
-
requirements:
|
160
|
-
- - "~>"
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version: '0'
|
163
|
-
- !ruby/object:Gem::Dependency
|
164
|
-
name: autotest-rails
|
165
|
-
requirement: !ruby/object:Gem::Requirement
|
166
|
-
requirements:
|
167
|
-
- - "~>"
|
125
|
+
- - ">="
|
168
126
|
- !ruby/object:Gem::Version
|
169
|
-
version:
|
127
|
+
version: 0.8.2
|
170
128
|
type: :development
|
171
129
|
prerelease: false
|
172
130
|
version_requirements: !ruby/object:Gem::Requirement
|
173
131
|
requirements:
|
174
|
-
- - "
|
132
|
+
- - ">="
|
175
133
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
134
|
+
version: 0.8.2
|
177
135
|
- !ruby/object:Gem::Dependency
|
178
|
-
name:
|
136
|
+
name: coveralls
|
179
137
|
requirement: !ruby/object:Gem::Requirement
|
180
138
|
requirements:
|
181
|
-
- - "
|
139
|
+
- - ">="
|
182
140
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
141
|
+
version: 0.7.0
|
184
142
|
type: :development
|
185
143
|
prerelease: false
|
186
144
|
version_requirements: !ruby/object:Gem::Requirement
|
187
145
|
requirements:
|
188
|
-
- - "
|
146
|
+
- - ">="
|
189
147
|
- !ruby/object:Gem::Version
|
190
|
-
version:
|
148
|
+
version: 0.7.0
|
191
149
|
description: |2
|
192
150
|
This framework allows you to assign anonymous users to experiments with goals and weighted hypotheses.
|
193
151
|
It makes experiments easy to configure and implement.
|
@@ -214,7 +172,10 @@ files:
|
|
214
172
|
- app/models/split_cat/hypothesis_subject.rb
|
215
173
|
- app/models/split_cat/subject.rb
|
216
174
|
- app/views/split_cat/experiments/_form.html.erb
|
175
|
+
- app/views/split_cat/experiments/_search.html.erb
|
176
|
+
- app/views/split_cat/experiments/edit.html.erb
|
217
177
|
- app/views/split_cat/experiments/index.html.erb
|
178
|
+
- app/views/split_cat/experiments/new.html.erb
|
218
179
|
- app/views/split_cat/experiments/show.html.erb
|
219
180
|
- config/locales/en.yml
|
220
181
|
- config/routes.rb
|
@@ -307,6 +268,7 @@ files:
|
|
307
268
|
- spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
308
269
|
- spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
309
270
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
271
|
+
- spec/dummy/tmp/pids/server.pid
|
310
272
|
- spec/factories/experiment_factory.rb
|
311
273
|
- spec/factories/goal_factory.rb
|
312
274
|
- spec/factories/hypothesis_factory.rb
|
@@ -327,11 +289,14 @@ files:
|
|
327
289
|
- spec/models/split_cat/hypothesis_spec.rb
|
328
290
|
- spec/models/split_cat/hypothesis_subject_spec.rb
|
329
291
|
- spec/models/split_cat/subject_spec.rb
|
292
|
+
- spec/routing/split_cat/experiments_routing_spec.rb
|
330
293
|
- spec/spec_helper.rb
|
331
294
|
- spec/support/shared/splitable.rb
|
332
295
|
- spec/support/shared/tokenable.rb
|
333
296
|
- spec/support/stub_view_routes.rb
|
297
|
+
- spec/views/split_cat/experiments/edit.html.erb_spec.rb
|
334
298
|
- spec/views/split_cat/experiments/index.html.erb_spec.rb
|
299
|
+
- spec/views/split_cat/experiments/new.html.erb_spec.rb
|
335
300
|
- spec/views/split_cat/experiments/show.html.erb_spec.rb
|
336
301
|
homepage: https://github.com/schrodingersbox/split_cat
|
337
302
|
licenses:
|
@@ -434,6 +399,7 @@ test_files:
|
|
434
399
|
- spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
435
400
|
- spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
436
401
|
- spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
402
|
+
- spec/dummy/tmp/pids/server.pid
|
437
403
|
- spec/factories/experiment_factory.rb
|
438
404
|
- spec/factories/goal_factory.rb
|
439
405
|
- spec/factories/hypothesis_factory.rb
|
@@ -454,9 +420,12 @@ test_files:
|
|
454
420
|
- spec/models/split_cat/hypothesis_spec.rb
|
455
421
|
- spec/models/split_cat/hypothesis_subject_spec.rb
|
456
422
|
- spec/models/split_cat/subject_spec.rb
|
423
|
+
- spec/routing/split_cat/experiments_routing_spec.rb
|
457
424
|
- spec/spec_helper.rb
|
458
425
|
- spec/support/shared/splitable.rb
|
459
426
|
- spec/support/shared/tokenable.rb
|
460
427
|
- spec/support/stub_view_routes.rb
|
428
|
+
- spec/views/split_cat/experiments/edit.html.erb_spec.rb
|
461
429
|
- spec/views/split_cat/experiments/index.html.erb_spec.rb
|
430
|
+
- spec/views/split_cat/experiments/new.html.erb_spec.rb
|
462
431
|
- spec/views/split_cat/experiments/show.html.erb_spec.rb
|