chemistrykit 3.9.0.rc2 → 3.9.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/CHANGELOG.md +8 -1
  2. data/Gemfile +2 -1
  3. data/README.md +3 -3
  4. data/TODO.md +2 -0
  5. data/chemistrykit.gemspec +2 -3
  6. data/features/basic_auth.feature +0 -1
  7. data/features/chemists.feature +13 -5
  8. data/features/exit_status.feature +0 -1
  9. data/features/reporting.feature +0 -3
  10. data/features/split_testing.feature +29 -0
  11. data/features/step_definitions/steps.rb +1 -1
  12. data/features/tags.feature +0 -1
  13. data/lib/chemistrykit/cli/cli.rb +10 -15
  14. data/lib/chemistrykit/config/basic_auth.rb +37 -0
  15. data/lib/chemistrykit/config/split_testing.rb +26 -0
  16. data/lib/chemistrykit/configuration.rb +15 -4
  17. data/lib/chemistrykit/reporting/html_report_assembler.rb +40 -2
  18. data/lib/chemistrykit/rspec/html_formatter.rb +5 -0
  19. data/lib/chemistrykit/split_testing/optimizely_provider.rb +21 -0
  20. data/lib/chemistrykit/split_testing/provider_factory.rb +18 -0
  21. data/report/index.html +81 -1
  22. data/report/sass/app.scss +54 -2
  23. data/report/stylesheets/app.css +820 -116
  24. data/spec/integration/lib/chemistrykit/split_testing/provider_factory_spec.rb +15 -0
  25. data/spec/spec_helper.rb +0 -6
  26. data/spec/support/config.yaml +8 -0
  27. data/spec/unit/lib/chemistrykit/catalyst_spec.rb +1 -0
  28. data/spec/unit/lib/chemistrykit/cli/helpers/formula_loader_spec.rb +1 -0
  29. data/spec/unit/lib/chemistrykit/config/basic_auth_spec.rb +76 -0
  30. data/spec/unit/lib/chemistrykit/config/split_testing_spec.rb +31 -0
  31. data/spec/unit/lib/chemistrykit/configuration_spec.rb +30 -0
  32. data/spec/unit/lib/chemistrykit/formula/base_spec.rb +1 -0
  33. data/spec/unit/lib/chemistrykit/split_testing/optimizely_provider_spec.rb +42 -0
  34. data/spec/unit/lib/chemistrykit/split_testing/provider_factory_spec.rb +22 -0
  35. metadata +21 -5
@@ -0,0 +1,15 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/split_testing/provider_factory'
5
+ require 'chemistrykit/config/split_testing'
6
+
7
+ describe ChemistryKit::SplitTesting::ProviderFactory do
8
+
9
+ it 'should return the correctly configured provider based on configuration' do
10
+ config = ChemistryKit::Config::SplitTesting.new(provider: 'optimizely', opt_out: true)
11
+ provider = ChemistryKit::SplitTesting::ProviderFactory.build(config)
12
+ provider.should be_an_instance_of ChemistryKit::SplitTesting::OptimizelyProvider
13
+ end
14
+
15
+ end
@@ -13,12 +13,6 @@ require 'rubygems'
13
13
  require 'bundler/setup'
14
14
  require 'fileutils'
15
15
 
16
- # not sure it this is the right way to include all the files under test.
17
- require_relative '../lib/chemistrykit/cli/helpers/formula_loader'
18
- require_relative '../lib/chemistrykit/formula/base'
19
- require_relative '../lib/chemistrykit/catalyst'
20
- require_relative '../lib/chemistrykit/configuration'
21
-
22
16
  require_relative '../spec/support/formulas/sub_module/basic_formula'
23
17
  require_relative '../spec/support/formulas/sub_module/chemist_formula'
24
18
  require_relative '../spec/support/formulas/sub_module/alt_chemist_formula'
@@ -10,3 +10,11 @@ log:
10
10
  selenium_connect:
11
11
  log: 'evidence'
12
12
  host: 'localhost'
13
+ basic_auth:
14
+ username: 'user'
15
+ password: 'pass'
16
+ http_path: '/basic'
17
+ https_path: '/secure'
18
+ split_testing:
19
+ provider: 'optimizely'
20
+ opt_out: true
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'chemistrykit/catalyst'
4
5
 
5
6
  describe ChemistryKit::Catalyst do
6
7
 
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'chemistrykit/cli/helpers/formula_loader'
4
5
  # might be able to use something like this: https://github.com/alexeypetrushin/class_loader
5
6
 
6
7
  describe ChemistryKit::CLI::Helpers::FormulaLoader do
@@ -0,0 +1,76 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/config/basic_auth'
5
+
6
+ describe ChemistryKit::Config::BasicAuth do
7
+
8
+ VALID_USERNAME = 'user'
9
+ VALID_PASSWORD = 'pass'
10
+ VALID_URL = 'http://testsite.com'
11
+ VALID_HTTP_PATH = '/'
12
+ VALID_HTTPS_PATH = '/secure'
13
+
14
+ before(:each) do
15
+ @opts = { username: VALID_USERNAME,
16
+ password: VALID_PASSWORD,
17
+ base_url: VALID_URL,
18
+ http_path: VALID_HTTP_PATH,
19
+ https_path: VALID_HTTPS_PATH
20
+ }
21
+ @basic_auth = ChemistryKit::Config::BasicAuth.new(@opts)
22
+ end
23
+
24
+ it 'should be initialized with an hash of options' do
25
+ @basic_auth.should be_an_instance_of ChemistryKit::Config::BasicAuth
26
+ end
27
+
28
+ it 'should get the basic configuration values' do
29
+ @basic_auth.username.should eq VALID_USERNAME
30
+ @basic_auth.password.should eq VALID_PASSWORD
31
+ @basic_auth.base_url.should eq VALID_URL
32
+ @basic_auth.http_path.should eq VALID_HTTP_PATH
33
+ @basic_auth.https_path.should eq VALID_HTTPS_PATH
34
+ end
35
+
36
+ it 'should raise an error for invalid config parameters' do
37
+ expect do
38
+ ChemistryKit::Config::BasicAuth.new(@opts.merge(bad: 'value'))
39
+ end.to raise_error(ArgumentError, 'The config key: "bad" is unknown!')
40
+ end
41
+
42
+ it 'should report on the availability of http path' do
43
+ @basic_auth.http?.should be_true
44
+ basic_auth = ChemistryKit::Config::BasicAuth.new(@opts.merge(http_path: nil))
45
+ basic_auth.http?.should be_false
46
+ basic_auth = ChemistryKit::Config::BasicAuth.new({})
47
+ basic_auth.http?.should be_false
48
+ end
49
+
50
+ it 'should report on the availability of https path' do
51
+ @basic_auth.https?.should be_true
52
+ basic_auth = ChemistryKit::Config::BasicAuth.new(@opts.merge(https_path: nil))
53
+ basic_auth.https?.should be_false
54
+ basic_auth = ChemistryKit::Config::BasicAuth.new({})
55
+ basic_auth.https?.should be_false
56
+ end
57
+
58
+ it 'should return the http url' do
59
+ @basic_auth.http_url.should eq "http://#{VALID_USERNAME}:#{VALID_PASSWORD}@testsite.com/"
60
+ end
61
+
62
+ it 'should return the http url by default' do
63
+ basic_auth = ChemistryKit::Config::BasicAuth.new(@opts.merge(http_path: nil))
64
+ basic_auth.http_url.should eq "http://#{VALID_USERNAME}:#{VALID_PASSWORD}@testsite.com"
65
+ end
66
+
67
+ it 'should return the https url' do
68
+ @basic_auth.https_url.should eq "https://#{VALID_USERNAME}:#{VALID_PASSWORD}@testsite.com/secure"
69
+ end
70
+
71
+ it 'should return the https url by default' do
72
+ basic_auth = ChemistryKit::Config::BasicAuth.new(@opts.merge(https_path: nil))
73
+ basic_auth.https_url.should eq "https://#{VALID_USERNAME}:#{VALID_PASSWORD}@testsite.com"
74
+ end
75
+
76
+ end
@@ -0,0 +1,31 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/config/split_testing'
5
+
6
+ describe ChemistryKit::Config::SplitTesting do
7
+
8
+ VALID_PROVIDER = 'optimizely'
9
+
10
+ before(:each) do
11
+ @opts = { provider: VALID_PROVIDER, opt_out: true, base_url: 'http://google.com'
12
+ }
13
+ @split_testing = ChemistryKit::Config::SplitTesting.new(@opts)
14
+ end
15
+
16
+ it 'should be initialized with an hash of options' do
17
+ @split_testing.should be_an_instance_of ChemistryKit::Config::SplitTesting
18
+ end
19
+
20
+ it 'should get the basic configuration values' do
21
+ @split_testing.provider.should eq VALID_PROVIDER
22
+ @split_testing.base_url.should eq 'http://google.com'
23
+ @split_testing.opt_out?.should be_true
24
+ end
25
+
26
+ it 'should raise an error for invalid config parameters' do
27
+ expect do
28
+ ChemistryKit::Config::SplitTesting.new(@opts.merge(bad: 'value'))
29
+ end.to raise_error(ArgumentError, 'The config key: "bad" is unknown!')
30
+ end
31
+ end
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'chemistrykit/configuration'
4
5
 
5
6
  describe ChemistryKit::Configuration do
6
7
 
@@ -30,10 +31,18 @@ describe ChemistryKit::Configuration do
30
31
  config.concurrency.should eq VALID_CONCURRENCY
31
32
  config.retries_on_failure.should eq VALID_RETRIES_ON_FAILURE
32
33
  config.base_url.should eq VALID_BASE_URL
34
+
35
+ # log configurations
33
36
  config.log.path.should eq VALID_LOG_PATH
34
37
  config.log.results_file.should eq VALID_JUNIT
35
38
  config.log.format.should eq VALID_JUNIT_FORMAT_OUT
39
+
40
+ # selenium connect configurations
36
41
  config.selenium_connect.should eq @valid_selenium_connect_hash
42
+
43
+ # basic auth configurations
44
+
45
+ # a/b testing configurations
37
46
  end
38
47
 
39
48
  it 'should initialize with sane defaults' do
@@ -44,6 +53,8 @@ describe ChemistryKit::Configuration do
44
53
  config.log.results_file.should eq VALID_JUNIT
45
54
  config.log.format.should eq VALID_JUNIT_FORMAT_OUT
46
55
  config.selenium_connect.should eq({ log: VALID_LOG_PATH })
56
+ config.basic_auth.should be_nil
57
+ config.split_testing.should be_nil
47
58
  end
48
59
 
49
60
  it 'should initialize with a hash of configurations' do
@@ -80,4 +91,23 @@ describe ChemistryKit::Configuration do
80
91
  config = ChemistryKit::Configuration.new selenium_connect: { log: 'sc-log', sauce_opts: { job_name: 'test' } }
81
92
  config.selenium_connect.should eq log: 'sc-log', sauce_opts: { job_name: 'test' }
82
93
  end
94
+
95
+ it 'should return the basic auth object if it is set' do
96
+ config = ChemistryKit::Configuration.new basic_auth: { username: 'user' }
97
+ config.basic_auth.should be_an_instance_of ChemistryKit::Config::BasicAuth
98
+ config.basic_auth.username.should eq 'user'
99
+ end
100
+
101
+ it 'should pass the base url to the auth object' do
102
+ yaml_file = File.join(Dir.pwd, 'spec', 'support', VALID_CONFIG_FILE)
103
+ config = ChemistryKit::Configuration.initialize_with_yaml yaml_file
104
+ config.basic_auth.http_url.should eq 'http://user:pass@google.com/basic'
105
+ end
106
+
107
+ it 'should return the split testing object if it is set' do
108
+ yaml_file = File.join(Dir.pwd, 'spec', 'support', VALID_CONFIG_FILE)
109
+ config = ChemistryKit::Configuration.initialize_with_yaml yaml_file
110
+ config.split_testing.should be_an_instance_of ChemistryKit::Config::SplitTesting
111
+ config.split_testing.base_url.should eq VALID_BASE_URL
112
+ end
83
113
  end
@@ -1,6 +1,7 @@
1
1
  # Encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'chemistrykit/formula/base'
4
5
 
5
6
  describe ChemistryKit::Formula::Base do
6
7
 
@@ -0,0 +1,42 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/split_testing/optimizely_provider'
5
+
6
+ describe ChemistryKit::SplitTesting::OptimizelyProvider do
7
+
8
+ before(:each) do
9
+ @config = double 'ChemistryKit::Config::SplitTesting'
10
+ @provider = ChemistryKit::SplitTesting::OptimizelyProvider.new(@config)
11
+ end
12
+
13
+ it 'should be initialized with the split testing config object' do
14
+ @provider.should be_an_instance_of ChemistryKit::SplitTesting::OptimizelyProvider
15
+ end
16
+
17
+ it 'should respond to config' do
18
+ @config.should_receive :provider
19
+ @provider.should respond_to :config
20
+ @provider.config.provider
21
+ end
22
+
23
+ it 'should set the cookie correctly on split' do
24
+
25
+ @config.should_receive :base_url
26
+ @config.should_receive(:opt_out?).and_return(true)
27
+
28
+ driver = double 'Selenium::WebDriver::Driver'
29
+ driver.should_receive(:get)
30
+
31
+ manage = double 'manage'
32
+ manage.should_receive(:add_cookie)
33
+ driver.should_receive(:manage).and_return(manage)
34
+
35
+ navigate = double 'navigate'
36
+ navigate.should_receive(:refresh)
37
+ driver.should_receive(:navigate).and_return(navigate)
38
+
39
+ @provider.split(driver)
40
+
41
+ end
42
+ end
@@ -0,0 +1,22 @@
1
+ # Encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'chemistrykit/split_testing/provider_factory'
5
+
6
+ describe ChemistryKit::SplitTesting::ProviderFactory do
7
+
8
+ let(:config) { double 'ChemistryKit::Config::SplitTesting' }
9
+
10
+ it 'should determine what kind of provider to build' do
11
+ config.should_receive(:provider).and_return('optimizely')
12
+ ChemistryKit::SplitTesting::ProviderFactory.build(config)
13
+ end
14
+
15
+ it 'should raise an error for an un known provider' do
16
+ config.should_receive(:provider).twice.and_return('bad')
17
+ expect do
18
+ ChemistryKit::SplitTesting::ProviderFactory.build(config)
19
+ end.to raise_error(ArgumentError, 'The provider: "bad" is unknown!')
20
+ end
21
+
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chemistrykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0.rc2
4
+ version: 3.9.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-14 00:00:00.000000000 Z
13
+ date: 2013-08-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -99,7 +99,7 @@ dependencies:
99
99
  requirements:
100
100
  - - ~>
101
101
  - !ruby/object:Gem::Version
102
- version: 3.5.0
102
+ version: 3.6.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ dependencies:
107
107
  requirements:
108
108
  - - ~>
109
109
  - !ruby/object:Gem::Version
110
- version: 3.5.0
110
+ version: 3.6.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: parallel_tests
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -243,6 +243,7 @@ files:
243
243
  - features/multi-config.feature
244
244
  - features/new.feature
245
245
  - features/reporting.feature
246
+ - features/split_testing.feature
246
247
  - features/step_definitions/steps.rb
247
248
  - features/support/env.rb
248
249
  - features/tags.feature
@@ -255,6 +256,8 @@ files:
255
256
  - lib/chemistrykit/cli/formula.rb
256
257
  - lib/chemistrykit/cli/helpers/formula_loader.rb
257
258
  - lib/chemistrykit/cli/new.rb
259
+ - lib/chemistrykit/config/basic_auth.rb
260
+ - lib/chemistrykit/config/split_testing.rb
258
261
  - lib/chemistrykit/configuration.rb
259
262
  - lib/chemistrykit/formula/base.rb
260
263
  - lib/chemistrykit/formula/chemist_aware.rb
@@ -263,6 +266,8 @@ files:
263
266
  - lib/chemistrykit/reporting/html_report_assembler.rb
264
267
  - lib/chemistrykit/rspec/html_formatter.rb
265
268
  - lib/chemistrykit/rspec/j_unit_formatter.rb
269
+ - lib/chemistrykit/split_testing/optimizely_provider.rb
270
+ - lib/chemistrykit/split_testing/provider_factory.rb
266
271
  - lib/templates/beaker.tt
267
272
  - lib/templates/beaker_with_formula.tt
268
273
  - lib/templates/chemistrykit/beakers/.gitkeep
@@ -300,6 +305,7 @@ files:
300
305
  - spec/integration/lib/chemistrykit/.gitkeep
301
306
  - spec/integration/lib/chemistrykit/formula/formula_lab_spec.rb
302
307
  - spec/integration/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb
308
+ - spec/integration/lib/chemistrykit/split_testing/provider_factory_spec.rb
303
309
  - spec/spec_helper.rb
304
310
  - spec/support/bad_chemists.csv
305
311
  - spec/support/chemists.csv
@@ -316,11 +322,15 @@ files:
316
322
  - spec/unit/lib/chemistrykit/chemist/repository/csv_chemist_repository_spec.rb
317
323
  - spec/unit/lib/chemistrykit/chemist_spec.rb
318
324
  - spec/unit/lib/chemistrykit/cli/helpers/formula_loader_spec.rb
325
+ - spec/unit/lib/chemistrykit/config/basic_auth_spec.rb
326
+ - spec/unit/lib/chemistrykit/config/split_testing_spec.rb
319
327
  - spec/unit/lib/chemistrykit/configuration_spec.rb
320
328
  - spec/unit/lib/chemistrykit/formula/base_spec.rb
321
329
  - spec/unit/lib/chemistrykit/formula/chemist_aware_spec.rb
322
330
  - spec/unit/lib/chemistrykit/formula/formula_lab_spec.rb
323
331
  - spec/unit/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb
332
+ - spec/unit/lib/chemistrykit/split_testing/optimizely_provider_spec.rb
333
+ - spec/unit/lib/chemistrykit/split_testing/provider_factory_spec.rb
324
334
  homepage: https://github.com/arrgyle/chemistrykit
325
335
  licenses:
326
336
  - MIT
@@ -342,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
342
352
  version: 1.3.1
343
353
  requirements: []
344
354
  rubyforge_project:
345
- rubygems_version: 1.8.24
355
+ rubygems_version: 1.8.25
346
356
  signing_key:
347
357
  specification_version: 3
348
358
  summary: A simple and opinionated web testing framework for Selenium that follows
@@ -360,12 +370,14 @@ test_files:
360
370
  - features/multi-config.feature
361
371
  - features/new.feature
362
372
  - features/reporting.feature
373
+ - features/split_testing.feature
363
374
  - features/step_definitions/steps.rb
364
375
  - features/support/env.rb
365
376
  - features/tags.feature
366
377
  - spec/integration/lib/chemistrykit/.gitkeep
367
378
  - spec/integration/lib/chemistrykit/formula/formula_lab_spec.rb
368
379
  - spec/integration/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb
380
+ - spec/integration/lib/chemistrykit/split_testing/provider_factory_spec.rb
369
381
  - spec/spec_helper.rb
370
382
  - spec/support/bad_chemists.csv
371
383
  - spec/support/chemists.csv
@@ -382,8 +394,12 @@ test_files:
382
394
  - spec/unit/lib/chemistrykit/chemist/repository/csv_chemist_repository_spec.rb
383
395
  - spec/unit/lib/chemistrykit/chemist_spec.rb
384
396
  - spec/unit/lib/chemistrykit/cli/helpers/formula_loader_spec.rb
397
+ - spec/unit/lib/chemistrykit/config/basic_auth_spec.rb
398
+ - spec/unit/lib/chemistrykit/config/split_testing_spec.rb
385
399
  - spec/unit/lib/chemistrykit/configuration_spec.rb
386
400
  - spec/unit/lib/chemistrykit/formula/base_spec.rb
387
401
  - spec/unit/lib/chemistrykit/formula/chemist_aware_spec.rb
388
402
  - spec/unit/lib/chemistrykit/formula/formula_lab_spec.rb
389
403
  - spec/unit/lib/chemistrykit/reporting/html_reporting_assembler_spec.rb
404
+ - spec/unit/lib/chemistrykit/split_testing/optimizely_provider_spec.rb
405
+ - spec/unit/lib/chemistrykit/split_testing/provider_factory_spec.rb