Sha256: 95236072453dc6eaab5cfcbf05a97143b6fcf31ddbd4082b11a674bf0bc66ca2

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require 'diecut/mill'

describe Diecut::Mill do
  subject :mill do
    Diecut::Mill.new("kind").tap do |mill|
      mill.valise = valise
    end
  end

  let :valise do
    Valise::Set.define do
      defaults do
        file "{{testing}}.txt", "I am a {{thing}} for {{testing}}"
      end
    end
  end

  let :plugin do
    Diecut::PluginDescription.new('dummy', 'dummy.rb').tap do |plugin|
      plugin.option('testing') do |opt|
        opt.goes_to('testing')
      end
      plugin.option('thing') do |opt|
        opt.goes_to(['thing'])
      end
    end
  end

  let :other_plugin do
    Diecut::PluginDescription.new('icky', 'icky.rb')
  end

  before :each do
    mill.mediator.add_plugin(plugin)
    mill.mediator.add_plugin(other_plugin)
  end

  it "should render files" do
    mill.activate_plugins do |name|
      name == 'dummy'
    end
    ui = mill.user_interface

    ui.testing = "checking"
    ui.thing = "test file"

    mill.churn(ui) do |path, contents|
      expect(path).to eq "checking.txt"
      expect(contents).to eq "I am a test file for checking"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
diecut-0.0.3 spec/mill_spec.rb
diecut-0.0.2 spec/mill_spec.rb
diecut-0.0.1 spec/mill_spec.rb