Sha256: f74683efaea3698bbe3b324e08208d99ef370ebee6c99e1db44ce209122d1a4a

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. .. spec_helper])

describe Feedzirra::Backend::Filesystem do
  before do
    @backend = Feedzirra::Backend::Filesystem.new({:path => '/tmp'})
  end
  
  it_should_behave_like "all backends"
  
  it "should accept a Hash of options for inialization" do
    Feedzirra::Backend::Filesystem.new({:path => '/tmp'})
  end
  
  describe "#filename_for" do
    it "should default to the users' home path plus the MD5 of the normalized URL" do
      MD5.expects(:hexdigest).returns('bah')
      uri = mock('uri')
      uri.expects(:normalize).returns('foo')
      URI.expects(:parse).returns(uri)
      Feedzirra::Backend::Filesystem.new({:path => '/tmp'}).__send__(:filename_for, 'hey').should == '/tmp/bah'
    end
  end
  
  describe "#initialize_store" do
    it "should call File.mkdir if the directory does not exist" do
      File.expects(:exist?).with('/tmp').returns(false)
      FileUtils.expects(:mkdir).with('/tmp')
      @backend.__send__(:initialize_store)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jsl-feedzirra-0.0.12.6 spec/feedzirra/backend/filesystem_spec.rb
jsl-feedzirra-0.0.12.7 spec/feedzirra/backend/filesystem_spec.rb