diff options
-rw-r--r-- | spec/eet_spec.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/spec/eet_spec.rb b/spec/eet_spec.rb index 033ae37..dd0c0d5 100644 --- a/spec/eet_spec.rb +++ b/spec/eet_spec.rb @@ -7,6 +7,8 @@ describe EFL::EET do # include EFL # + FP = '/tmp/_eet.cfg' + # it "should init" do EET.init.should eql 1 EET.init.should eql 2 @@ -27,14 +29,15 @@ describe EFL::EET do # it "should open and close" do EET.init.should eql 1 - f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_WRITE + f = EET.open FP, EET::FILE_MODE_WRITE + f.write 'fake', 'value' f.close EET.shutdown.should eql 0 end it "should be able to get file access mode" do EET.init.should eql 1 [ EET::FILE_MODE_READ, EET::FILE_MODE_WRITE, EET::FILE_MODE_READ_WRITE ].each do |m| - EET.open '/tmp/_eet.cfg', m do |f| + EET.open FP, m do |f| f.mode_get.should eql m end end @@ -43,7 +46,7 @@ describe EFL::EET do # it "should write" do EET.init.should eql 1 - f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_WRITE + f = EET.open FP, EET::FILE_MODE_WRITE f.write 'config', 'test key' f.close EET.shutdown.should eql 0 @@ -51,7 +54,7 @@ describe EFL::EET do # it "should read" do EET.init.should eql 1 - f = EET.open '/tmp/_eet.cfg', EET::FILE_MODE_READ + f = EET.open FP, EET::FILE_MODE_READ f.read('config').should eql 'test key' f.close EET.shutdown.should eql 0 @@ -59,7 +62,7 @@ describe EFL::EET do # it "should write in block" do EET.init.should eql 1 - EET.open('/tmp/_eet.cfg', EET::FILE_MODE_WRITE) do |f| + EET.open FP, EET::FILE_MODE_WRITE do |f| f.write 'config2', 'test--key' end EET.shutdown.should eql 0 @@ -67,7 +70,7 @@ describe EFL::EET do # it "should read in block" do EET.init.should eql 1 - EET.open('/tmp/_eet.cfg', EET::FILE_MODE_READ) do |f| + EET.open FP, EET::FILE_MODE_READ do |f| f.read('config2').should eql 'test--key' end EET.shutdown.should eql 0 |