Sha256: 655c3e398a0014dd2ab42e1c837ffb39daaf51656ad569c20ed0195413e25254

Contents?: true

Size: 1.59 KB

Versions: 17

Compression:

Stored size: 1.59 KB

Contents

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

# -------------------------------------------------------------------------
describe Webby::Resources::Partial do
  before :each do
    @filename = File.join %w[content _partial.txt]
    @partial  = Webby::Resources::Partial.new(@filename)
  end

  it 'parses meta-data on initialization' do
    h = @partial._meta_data

    h.should_not be_empty
    h.should == {'filter' => 'erb'}
  end

  it 'uses the cairn file as the destination' do
    @partial.destination.should == ::Webby.cairn
  end

  it 'always returns nil as the url' do
    @partial.url.should be_nil
  end

  it 'reads the contents of the file' do
    str = @partial._read
    str.split($/).first.should == 'A partial has access to the page from which it was called. The title below will be the title of the page in which this partial is rendered.'
  end

  it 'uses the files extension as the extension' do
    @partial.extension.should equal(@partial.ext)
  end

  # -----------------------------------------------------------------------
  describe '.dirty?' do
    it 'overrides the dirty state based on the meta-data value' do
      @partial['dirty'] = true
      @partial.dirty?.should == true

      @partial['dirty'] = false
      @partial.dirty?.should == false
    end

    it 'returns true if the cairn file is missing' do
      @partial.dirty?.should == true
    end

    it 'returns false if the cairn file is present' do
      FileUtils.touch Webby.cairn
      @partial.dirty?.should == false
    end
  end

end  # describe Webby::Resources::Partial

# EOF

Version data entries

17 entries across 17 versions & 8 rubygems

Version Path
TwP-webby-0.9.1 spec/webby/resources/partial_spec.rb
TwP-webby-0.9.2 spec/webby/resources/partial_spec.rb
TwP-webby-0.9.3 spec/webby/resources/partial_spec.rb
TwP-webby-0.9.4.1 spec/webby/resources/partial_spec.rb
TwP-webby-0.9.4 spec/webby/resources/partial_spec.rb
blowmage-webby-0.9.4.1 spec/webby/resources/partial_spec.rb
dysinger-webby-0.9.4 spec/webby/resources/partial_spec.rb
francois-webby-0.9.4.1 spec/webby/resources/partial_spec.rb
giraffesoft-webby-0.9.5 spec/webby/resources/partial_spec.rb
mikker-webby-0.9.4 spec/webby/resources/partial_spec.rb
jamesgolick-webby-0.9.5 spec/webby/resources/partial_spec.rb
webby-0.9.3 spec/webby/resources/partial_spec.rb
webby-0.9.3-x86-mswin32 spec/webby/resources/partial_spec.rb
webby-0.9.2 spec/webby/resources/partial_spec.rb
webby-0.9.1 spec/webby/resources/partial_spec.rb
webby-0.9.4 spec/webby/resources/partial_spec.rb
webby-0.9.4-x86-mswin32 spec/webby/resources/partial_spec.rb