Refactor actions specs with shared examples
This commit is contained in:
@@ -7,6 +7,8 @@ module Producer::Core
|
||||
let(:text) { 'hello' }
|
||||
subject(:echo) { Echo.new(env, text) }
|
||||
|
||||
it_behaves_like 'action'
|
||||
|
||||
describe '#apply' do
|
||||
it 'writes the given string to env output with a record separator' do
|
||||
echo.apply
|
||||
|
@@ -8,6 +8,8 @@ module Producer::Core
|
||||
let(:content) { 'some_content' }
|
||||
subject(:writer) { FileWriter.new(env, path, content) }
|
||||
|
||||
it_behaves_like 'action'
|
||||
|
||||
describe '#apply' do
|
||||
it 'writes content to file on remote filesystem' do
|
||||
expect(writer.fs).to receive(:file_write).with(path, content)
|
||||
|
@@ -7,6 +7,8 @@ module Producer::Core
|
||||
let(:path) { 'some_path' }
|
||||
subject(:mkdir) { Mkdir.new(env, path) }
|
||||
|
||||
it_behaves_like 'action'
|
||||
|
||||
describe '#apply' do
|
||||
it 'creates directory on remote filesystem' do
|
||||
expect(mkdir.fs).to receive(:mkdir).with(path)
|
||||
|
@@ -8,6 +8,8 @@ module Producer::Core
|
||||
let(:command) { "echo #{command_args}" }
|
||||
subject(:sh) { ShellCommand.new(env, command) }
|
||||
|
||||
it_behaves_like 'action'
|
||||
|
||||
describe '#apply' do
|
||||
it 'executes the remote command' do
|
||||
expect(sh.remote).to receive(:execute).with(command)
|
||||
|
Reference in New Issue
Block a user