mirror of
https://github.com/dkam/decisiontree.git
synced 2025-12-27 22:54:52 +00:00
Using a constant for the filename
This commit is contained in:
@@ -106,7 +106,7 @@ describe describe DecisionTree::ID3Tree do
|
|||||||
|
|
||||||
describe "create a figure" do
|
describe "create a figure" do
|
||||||
after(:all) do
|
after(:all) do
|
||||||
File.delete("just_a_spec.png") if File.file?("just_a_spec.png")
|
File.delete("#{FIGURE_FILENAME}.png") if File.file?("#{FIGURE_FILENAME}.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
Given(:labels) { ["sun", "rain"]}
|
Given(:labels) { ["sun", "rain"]}
|
||||||
@@ -118,8 +118,8 @@ describe describe DecisionTree::ID3Tree do
|
|||||||
end
|
end
|
||||||
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, 1, :discrete) }
|
Given(:tree) { DecisionTree::ID3Tree.new(labels, data, 1, :discrete) }
|
||||||
When { tree.train }
|
When { tree.train }
|
||||||
When(:result) { tree.graph("just_a_spec") }
|
When(:result) { tree.graph(FIGURE_FILENAME) }
|
||||||
Then { expect(result).to_not have_failed }
|
Then { expect(result).to_not have_failed }
|
||||||
And { File.file?("just_a_spec.png") }
|
And { File.file?("#{FIGURE_FILENAME}.png") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
require 'rspec/given'
|
require 'rspec/given'
|
||||||
require 'decisiontree'
|
require 'decisiontree'
|
||||||
require 'pry'
|
require 'pry'
|
||||||
|
|
||||||
|
FIGURE_FILENAME = "just_a_spec"
|
||||||
|
|||||||
Reference in New Issue
Block a user