Sha256: b9850205d1acbd40a1ae310eb107ad217e8258bfd55694484f68ac8b7ba32700
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 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.yml' do let(:hints) do { 'tasks' => task_map } end before(:each) do write_file 'psychic.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
psychic-runner-0.0.7 | spec/psychic/runner/hot_runner_spec.rb |
psychic-runner-0.0.6 | spec/psychic/runner/hot_runner_spec.rb |