Sha256: ed602734e4a2c2e3d9d55605336afe02483b166e46f4db29a5ff8ac78829c011
Contents?: true
Size: 1.74 KB
Versions: 4
Compression:
Stored size: 1.74 KB
Contents
module Psychic class Runner RSpec.describe HotRunner do let(:task_map) do { 'bootstrap' => 'foo', 'compile' => 'bar', 'execute' => 'baz' } end let(:shell) { Psychic::Shell.shell = double('shell') } subject { described_class.new(cwd: current_dir, hints: task_map) } shared_examples 'runs tasks' do describe 'respond_to?' do it 'returns true for task ids' do task_map.each_key do |key| expect(subject.respond_to? key).to be true end end it 'returns false for anything else' do expect(subject.respond_to? 'max').to be false end end describe '#method_missing' do context 'matching a task' do it 'executes the task command' do expect(shell).to receive(:execute).with('foo', cwd: current_dir) subject.bootstrap end end context 'not matching a task' do it 'raises an error' do expect { subject.spin_around }.to raise_error(NoMethodError) end end end end context 'task map stored in psychic-hints.yml' do let(:hints) do { 'tasks' => task_map } end before(:each) do write_file 'psychic-hints.yml', YAML.dump(hints) end subject { described_class.new(cwd: current_dir) } include_examples 'runs tasks' end context 'hints passed as a parameter' do let(:hints) do { 'tasks' => task_map } end subject { described_class.new(cwd: current_dir, hints: hints) } include_examples 'runs tasks' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems