Sha256: 8d4a43f54b0ee69200875bf75a56d431cae7e8ea0a7818a617f6ad49ccda6a2c
Contents?: true
Size: 1.73 KB
Versions: 19
Compression:
Stored size: 1.73 KB
Contents
require 'spec_helper' require 'tmpdir' module RevealCK module Builders class RakeAwareTestingClass include RakeAware attr_reader :application def initialize @application = Rake::Application.new end end describe RakeAware do describe 'when included into a class with a rake application' do let :example do RakeAwareTestingClass.new end describe '#task' do it 'provides a shortcut for defining a task' do signal = false example.task('example_task') do signal = true end example.application['example_task'].invoke expect(signal).to be true end end describe '#copy_file' do it 'provides a shortcut for copying files' do Dir.mktmpdir do |dir| Dir.chdir(dir) do File.open('source', 'w') { |file| file.write('source') } example.copy_file('source', 'destination') example.application['destination'].invoke expect(File.exist?('destination')).to be true content = File.open('destination', 'r').read expect(content).to eq 'source' end end end end describe '#create_directory' do it 'provides a shortcut for creating a directory' do Dir.mktmpdir do |dir| Dir.chdir(dir) do example.create_directory('example_directory') example.application['example_directory'].invoke expect(File.directory?('example_directory')).to be true end end end end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems