Declare arguments explicitly in actions specs

This commit is contained in:
Thibault Jouan 2014-10-09 20:05:31 +00:00
parent 7bdb778159
commit 58f3a7223e
7 changed files with 12 additions and 7 deletions

View File

@ -4,7 +4,8 @@ module Producer::Core
module Actions
describe Echo, :env do
let(:text) { 'hello' }
subject(:echo) { described_class.new(env, text) }
let(:arguments) { [text] }
subject(:echo) { described_class.new(env, *arguments) }
it_behaves_like 'action'

View File

@ -6,7 +6,8 @@ module Producer::Core
let(:path) { 'some_path' }
let(:content) { 'some content' }
let(:added_content) { ' added' }
subject(:action) { described_class.new(env, path, added_content) }
let(:arguments) { [path, added_content] }
subject(:action) { described_class.new(env, *arguments) }
it_behaves_like 'action'

View File

@ -7,7 +7,8 @@ module Producer::Core
let(:pattern) { 'content' }
let(:replacement) { 'other content' }
let(:content) { 'some content' }
subject(:action) { described_class.new(env, path, pattern, replacement) }
let(:arguments) { [path, pattern, replacement] }
subject(:action) { described_class.new(env, *arguments) }
it_behaves_like 'action'

View File

@ -5,8 +5,9 @@ module Producer::Core
describe FileWriter, :env do
let(:path) { 'some_path' }
let(:content) { 'some_content' }
let(:arguments) { [path, content] }
let(:options) { { } }
subject(:writer) { described_class.new(env, path, content, options) }
subject(:writer) { described_class.new(env, *arguments, options) }
it_behaves_like 'action'

View File

@ -5,7 +5,8 @@ module Producer::Core
describe Mkdir, :env do
let(:path) { 'some_path' }
let(:options) { { } }
subject(:mkdir) { described_class.new(env, path, options) }
let(:arguments) { [path, options] }
subject(:mkdir) { described_class.new(env, *arguments) }
it_behaves_like 'action'

View File

@ -5,7 +5,8 @@ module Producer::Core
describe ShellCommand, :env do
let(:command_args) { 'hello from remote host' }
let(:command) { "echo #{command_args}" }
subject(:sh) { described_class.new(env, command) }
let(:arguments) { [command] }
subject(:sh) { described_class.new(env, *arguments) }
it_behaves_like 'action'

View File

@ -2,7 +2,6 @@ module Producer::Core
shared_examples 'action' do
include TestEnvHelpers
let(:arguments) { [:some, :arguments] }
let(:options) { { foo: :bar } }
subject(:action) { described_class.new(env, *arguments, options) }