Sha256: 30ad66df9fb077b4607d6276febff0c325b1adbaf0024d9b4f242de09bc4b955
Contents?: true
Size: 1.58 KB
Versions: 7
Compression:
Stored size: 1.58 KB
Contents
require File.dirname(__FILE__) + '/spec_helper' begin require "moneta/basic_file" describe "Moneta::BasicFile" do describe "without namespacing" do before(:each) do @cache = Moneta::BasicFile.new(:path => File.join(File.dirname(__FILE__), "basic_file_cache")) @cache.clear end if ENV['MONETA_TEST'].nil? || ENV['MONETA_TEST'] == 'basic_file' it_should_behave_like "a read/write Moneta cache" end it "should deal with '/' and '#' in a key" do key = "hello/mom#crazycharacters" @cache[key] = "hi" @cache[key].should == "hi" ::File.exists?(File.join(File.dirname(__FILE__), "basic_file_cache", "")).should == true end end describe "with namespacing" do before(:each) do @cache = Moneta::BasicFile.new(:path => File.join(File.dirname(__FILE__), "basic_file_cache"), :namespace => "test_namespace") @cache.clear end if ENV['MONETA_TEST'].nil? || ENV['MONETA_TEST'] == 'basic_file' it_should_behave_like "a read/write Moneta cache" end it "should act as two stores within the same directory" do @second = Moneta::BasicFile.new(:path => File.join(File.dirname(__FILE__), "basic_file_cache"), :namespace => "second_namespace") @second[:key] = "hello" @cache[:key] = "world!" @second[:key].should == "hello" @cache[:key].should == "world!" end end after(:all) do FileUtils.rm_rf(File.join(File.dirname(__FILE__), "basic_file_cache")) end end rescue SystemExit end
Version data entries
7 entries across 7 versions & 1 rubygems