spec/tracker_spec.rb in bigbench-0.0.4 vs spec/tracker_spec.rb in bigbench-0.0.5
- old
+ new
@@ -1,50 +1,54 @@
require_relative "./helpers"
describe BigBench::Tracker do
+ before(:each) do
+ Dir.chdir File.dirname(__FILE__)
+ end
+
it "should track supplied objects" do
@tracker = BigBench::Tracker::Tracker.new
@tracker.track "a result"
@tracker.track "a result"
@tracker.track "a result"
@tracker.trackings.size.should == 3
end
it "should write trackings to the specified file in the local mode" do
- BigBench.config.output = "spec/tmp/test.ljson"
+ BigBench.config.output = "tmp/test.ljson"
BigBench.benchmark "index page call" => "http://localhost:3001" do
get "/"
end
BigBench.run!
BigBench.write_local_trackings_to_file!
- File.exist?("spec/tmp/test.ljson").should be_true
- File.open("spec/tmp/test.ljson") do |file|
+ File.exist?("tmp/test.ljson").should be_true
+ File.open("tmp/test.ljson") do |file|
file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
end
- File.delete "spec/tmp/test.ljson"
+ File.delete "tmp/test.ljson"
end
it "should gather the remote trackings and write them into a file" do
BigBench::Store.setup!("http://localhost:6379").should be_true
- BigBench.config.output = "spec/tmp/test.ljson"
+ BigBench.config.output = "tmp/test.ljson"
BigBench::Store.add_tracking({ :tracking => true }.to_json)
BigBench::Store.add_tracking({ :tracking => true }.to_json)
BigBench::Store.add_tracking({ :tracking => true }.to_json)
BigBench::Store.add_tracking({ :tracking => true }.to_json)
BigBench::Store.add_tracking({ :tracking => true }.to_json)
BigBench::Store.count_trackings.should == 5
BigBench.write_store_trackings_to_file!
- File.exist?("spec/tmp/test.ljson").should be_true
- File.open("spec/tmp/test.ljson") do |file|
+ File.exist?("tmp/test.ljson").should be_true
+ File.open("tmp/test.ljson") do |file|
file.each_line{ |json| JSON.parse(json).is_a?(Hash).should be_true }
end
- File.delete "spec/tmp/test.ljson"
+ File.delete "tmp/test.ljson"
end
end
\ No newline at end of file