scientist 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2831c4fc4f76eb1e8e822a21e613a07e33229bdfe47528cd4555b72ecb05a7c
4
- data.tar.gz: e0e003dbbe7ecb82749c41aff85ff6b4174e6169dce34081d20f325f62959f8d
3
+ metadata.gz: f03841ae9bccb8d7b979971d5f6a38482f57bbc81af82d0a710479ccc3f16fbb
4
+ data.tar.gz: c0f81d696918e302462baf1bd918cd25179a99045d48082fb162e1fdb2fa2280
5
5
  SHA512:
6
- metadata.gz: 07f99bcd0d9619205f42f15f16cc00b31fff3fab127344ca70360c51eea28d3eb15bc21e9471edbccfb06ddf2f07bc93ac0024af3899371486757fb53dbb5710
7
- data.tar.gz: cb7a3cf609e501a5d4a7894cf62400dacde1dc654ec7caf5d9beb8d115bb4f0c1e217cdeddd7c72863385459bfd7bb929221df74725312c3dfe21af315598486
6
+ metadata.gz: f1680e6564a6e83b3dde55f6757f3e7c953a70b3d748aa0e7ca2a54b5a33a4b3a947a8f20aa52790a41e6a66e36627e4e851f627625c0aaf9fd4cf41b94ace8c
7
+ data.tar.gz: 75ba381053b73e9418ed2ab5608c70c92a55990c938a1c25f4324169ff560a8feea6827ef909e50b9fc3baf5a5eb49f3b7b26ed4e3f9799007b80a71c7543c86
data/.travis.yml CHANGED
@@ -7,6 +7,7 @@ rvm:
7
7
  - 2.4.5
8
8
  - 2.5.3
9
9
  - 2.6.1
10
+ - truffleruby-head
10
11
  before_install: gem install bundler
11
12
  addons:
12
13
  apt:
data/README.md CHANGED
@@ -24,7 +24,7 @@ Wrap a `use` block around the code's original behavior, and wrap `try` around th
24
24
 
25
25
  * It decides whether or not to run the `try` block,
26
26
  * Randomizes the order in which `use` and `try` blocks are run,
27
- * Measures the durations of all behaviors,
27
+ * Measures the durations of all behaviors in seconds,
28
28
  * Compares the result of `try` to the result of `use`,
29
29
  * Swallow and record exceptions raised in the `try` block when overriding `raised`, and
30
30
  * Publishes all this information.
@@ -84,6 +84,8 @@ class MyExperiment
84
84
  end
85
85
  ```
86
86
 
87
+ When `Scientist::Experiment` is included in a class, it automatically sets it as the default implementation via `Scientist::Experiment.set_default`. This `set_default` call is is skipped if you include `Scientist::Experiment` in a module.
88
+
87
89
  Now calls to the `science` helper will load instances of `MyExperiment`.
88
90
 
89
91
  ### Controlling comparison
@@ -548,6 +550,7 @@ Be on a Unixy box. Make sure a modern Bundler is available. `script/test` runs t
548
550
  - [spoptchev/scientist](https://github.com/spoptchev/scientist) (Kotlin / Java)
549
551
  - [junkpiano/scientist](https://github.com/junkpiano/scientist) (Swift)
550
552
  - [serverless scientist](http://serverlessscientist.com/) (AWS Lambda)
553
+ - [fightmegg/scientist](https://github.com/fightmegg/scientist) (TypeScript, Browser / Node.js)
551
554
 
552
555
  ## Maintainers
553
556
 
@@ -10,7 +10,7 @@ module Scientist::Experiment
10
10
  attr_accessor :raise_on_mismatches
11
11
 
12
12
  def self.included(base)
13
- self.set_default(base)
13
+ self.set_default(base) if base.instance_of?(Class)
14
14
  base.extend RaiseOnMismatch
15
15
  end
16
16
 
@@ -1,3 +1,3 @@
1
1
  module Scientist
2
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -31,6 +31,24 @@ describe Scientist::Experiment do
31
31
  @ex = Fake.new
32
32
  end
33
33
 
34
+ it "sets the default on inclusion" do
35
+ klass = Class.new do
36
+ include Scientist::Experiment
37
+
38
+ def initialize(name)
39
+ end
40
+ end
41
+
42
+ assert_kind_of klass, Scientist::Experiment.new("hello")
43
+
44
+ Scientist::Experiment.set_default(nil)
45
+ end
46
+
47
+ it "doesn't set the default on inclusion when it's a module" do
48
+ Module.new { include Scientist::Experiment }
49
+ assert_kind_of Scientist::Default, Scientist::Experiment.new("hello")
50
+ end
51
+
34
52
  it "has a default implementation" do
35
53
  ex = Scientist::Experiment.new("hello")
36
54
  assert_kind_of Scientist::Default, ex
@@ -549,7 +567,7 @@ candidate:
549
567
  assert_equal " \"value\"", lines[2]
550
568
  assert_equal "candidate:", lines[3]
551
569
  assert_equal " #<RuntimeError: error>", lines[4]
552
- assert_match %r( test/scientist/experiment_test.rb:\d+:in `block), lines[5]
570
+ assert_match %r(test/scientist/experiment_test.rb:\d+:in `block), lines[5]
553
571
  end
554
572
  end
555
573
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scientist
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-09-08 00:00:00.000000000 Z
15
+ date: 2021-03-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: minitest
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.1.2
98
+ rubygems_version: 3.1.4
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Carefully test, measure, and track refactored code.