Sha256: 7321f91207bceb97c5ab6f96832ce0ed1fa6e46b9252a3c4ad716142400224df

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Template::RequiredFile do

  it 'initializes with a file name' do
    file = Template::RequiredFile.new 'file.txt'
    file.should_not be_nil
  end

  it 'requires a file name' do
    expect { file = Template::RequiredFile.new }.to raise_error ArgumentError
  end

  it 'requires the file name to not be empty' do
    expect { file = Template::RequiredFile.new '' }.to raise_error RuntimeError
  end

  it 'requires the file name to be sanitized' do
    expect { Template::RequiredFile.new '.what&up'}.to raise_error RuntimeError
    expect { Template::RequiredFile.new 'not/a/file'}.to raise_error RuntimeError
  end

  context 'with file.txt' do

    before do
      @file = Template::RequiredFile.new 'file.txt'
    end

    it 'has a name' do
      @file.name.should eq 'file.txt'
    end

    it 'has a comment' do
      @file.comment = 'Comment'
      @file.comment.should eq 'Comment'
    end

    it 'takes a directory' do
      @file.directory = 'images'
      @file.directory.should eq 'images'
    end

    it 'has a default directory' do
      @file.directory.should eq '.'
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
klipp-0.2.2.5 spec/template/required_file_spec.rb
klipp-0.2.2.4 spec/template/required_file_spec.rb
klipp-0.2.2.3 spec/template/required_file_spec.rb
klipp-0.2.2.2 spec/template/required_file_spec.rb
klipp-0.2.2.1 spec/template/required_file_spec.rb
klipp-0.2.2 spec/template/required_file_spec.rb