Sha256: 86517c93c26dee5f63292954789df5e17122dc21b03487e4eb62fff5c4bd1ade

Contents?: true

Size: 1.91 KB

Versions: 8

Compression:

Stored size: 1.91 KB

Contents

require_relative 'spec_helper'

describe Gumdrop::Site do

  it 'should be configured with default settings' do
    site= site_for_source
    site.config.wont_be_nil
  end

  it 'should have accessors for paths' do
    site= site_for_source
    site.config.source_dir.wont_be_nil
    site.config.source_dir.must_equal '.'
    site.source_dir.wont_be_nil
    site.source_dir.must_equal site.config.source_dir

    site.output_dir.wont_be_nil
    site.output_dir.must_equal '../output'

    site.data_dir.wont_be_nil
    site.data_dir.must_equal './data'
  end

  it 'should allow changing config settings' do
    site= site_for_source
    site.source_dir.must_equal '.'
    site.source_dir.must_equal site.config.source_dir

    site.config.source_dir= './crap'
    site.config.source_dir.must_equal './crap'
    site.source_dir.must_equal site.config.source_dir
  end

  it 'should allow listening for events' do
    site= site_for_source
    scanned= 0
    site.on :scan do |event|
      scanned += 1
    end
    site.clear
    site.scan_only #true
    scanned.must_equal 1
  end

  it 'should allow listening for events from Gumdrop too' do
    site= site_for_source
    scanned= 0
    Gumdrop.site.clear 
    Gumdrop.site.on :scan do |event|
      scanned += 1
    end
    Gumdrop.on :before_scan do |event|
      scanned += 1
    end
    Gumdrop.on :scan do |event|
      scanned += 1
    end
    Gumdrop.on :after_scan do |event|
      scanned += 1
      #puts "#{event.data[:payload]} Items Scanned"
    end
    Gumdrop.site.scan_only
    scanned.must_equal 4
  end

  # it 'should allow changing config settings via block' do
  #   site= site_for_source
  #   site.source_dir.must_equal './source'
  #   site.source_dir.must_equal site.config.source_dir

  #   Gumdrop::Site.configure do |c|
  #     c.source_dir= './junk'
  #   end

  #   site.config.source_dir.must_equal './junk'
  #   site.source_dir.must_equal site.config.source_dir
  # end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gumdrop-1.1.3 specs/site_spec.rb
gumdrop-1.1.2 specs/site_spec.rb
gumdrop-1.1.1 specs/site_spec.rb
gumdrop-1.1.0 specs/site_spec.rb
gumdrop-1.0.3 specs/site_spec.rb
gumdrop-1.0.2 specs/site_spec.rb
gumdrop-1.0.1 specs/site_spec.rb
gumdrop-1.0.0 specs/site_spec.rb