Sha256: 3ddf69ca2e8cf8e9d7cf95440aaa0c6ab5167ac87b676674d8b1c782b9008c1e
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' require 'fileutils' describe "loader" do let(:file_path) { File.expand_path('spec/fixtures/brainz.b') } subject { Brainz::Brainz.new } before do FileUtils.rm_rf(file_path) subject.teach do subject.that(a: 1, b: 1).is(0) subject.that(1, 0).is(1) subject.that(0, 1).is(1) subject.that(0, 0).is(0) end end after do FileUtils.rm_rf(file_path) end it "should work after load" do results_before_saving = [] results_before_saving << subject.explain(a: 0, b: 0).first.round results_before_saving << subject.explain(a: 0, b: 1).first.round results_before_saving << subject.explain(a: 1, b: 1).first.round results_before_saving << subject.explain(a: 1, b: 0).first.round subject.save(file_path) loaded_brainz = Brainz::Brainz.load(file_path) results_after_load = [] results_after_load << subject.explain(a: 0, b: 0).first.round results_after_load << subject.explain(a: 0, b: 1).first.round results_after_load << subject.explain(a: 1, b: 1).first.round results_after_load << subject.explain(a: 1, b: 0).first.round results_before_saving.should == results_after_load end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
brainz-0.2.0 | spec/lib/loader_spec.rb |
brainz-0.1.3 | spec/lib/loader_spec.rb |