Skip to content
Browse files

fix deprecation warnings

  • Loading branch information...
1 parent 4811a51 commit 7b034dc5bc70c59a43322c413fae7168b6593cbe @igrigorik committed Nov 23, 2015
Showing with 10 additions and 10 deletions.
  1. +10 −10 spec/id3_spec.rb
View
20 spec/id3_spec.rb
@@ -12,8 +12,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, 1, :discrete) }
When { tree.train }
- Then { tree.predict([1,0]).should == 1 }
- Then { tree.predict([0,1]).should == 0 }
+ Then { expect(tree.predict([1,0])).to eq 1 }
+ Then { expect(tree.predict([0,1])).to eq 0 }
end
describe "discrete attributes" do
@@ -28,8 +28,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", :discrete) }
When { tree.train }
- Then { tree.predict(["yes", "red"]).should == "angry" }
- Then { tree.predict(["no", "red"]).should == "not angry" }
+ Then { expect(tree.predict(["yes", "red"])).to eq "angry" }
+ Then { expect(tree.predict(["no", "red"])).to eq "not angry" }
end
describe "discrete attributes" do
@@ -48,8 +48,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", :continuous) }
When { tree.train }
- Then { tree.predict([7, 7]).should == "angry" }
- Then { tree.predict([2, 3]).should == "not angry" }
+ Then { expect(tree.predict([7, 7])).to eq "angry" }
+ Then { expect(tree.predict([2, 3])).to eq "not angry" }
end
describe "a mixture" do
@@ -68,8 +68,8 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "not angry", color: :discrete, hunger: :continuous) }
When { tree.train }
- Then { tree.predict([7, "red"]).should == "angry" }
- Then { tree.predict([2, "blue"]).should == "not angry" }
+ Then { expect(tree.predict([7, "red"])).to eq "angry" }
+ Then { expect(tree.predict([2, "blue"])).to eq "not angry" }
end
describe "infinite recursion case" do
@@ -84,7 +84,7 @@
end
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, "RED", :discrete) }
When { tree.train }
- Then { tree.predict(["a1","b0","c0"]).should == "RED" }
+ Then { expect(tree.predict(["a1","b0","c0"])).to eq "RED" }
end
describe "numerical labels case" do
@@ -100,7 +100,7 @@
Given(:tree) { DecisionTree::ID3Tree.new labels, data, nil, :discrete }
When { tree.train }
Then {
- lambda { tree.predict([1, 1]) }.should_not raise_error
+ expect { tree.predict([1, 1]) }.to_not raise_error
}
end

0 comments on commit 7b034dc

Please sign in to comment.
Something went wrong with that request. Please try again.