File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ module Scientist::Experiment
1010 attr_accessor :raise_on_mismatches
1111
1212 def self . included ( base )
13- self . set_default ( base )
13+ self . set_default ( base ) if base . instance_of? ( Class )
1414 base . extend RaiseOnMismatch
1515 end
1616
Original file line number Diff line number Diff line change @@ -31,6 +31,24 @@ def publish(result)
3131 @ex = Fake . new
3232 end
3333
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+
3452 it "has a default implementation" do
3553 ex = Scientist ::Experiment . new ( "hello" )
3654 assert_kind_of Scientist ::Default , ex
You can’t perform that action at this time.
0 commit comments