producer-core/spec/support/shared_action.rb
Thibault Jouan fcba1a5c0b Implement rspec TestEnvHelpers:
Allow use of our test environment, with a mocked remote and convenient
methods to write more concise expectations.

  #env, builds and returns a memoized test environment (with mocked
  remote)

  #output, returns env output as a string

  #remote_fs, returns env remote fs

  #expect_execution, setup a remote command execution expectation
2014-03-04 23:24:05 +00:00

45 lines
953 B
Ruby

module Producer::Core
shared_examples 'action' do
include TestEnvHelpers
let(:arguments) { [:some, :arguments] }
subject(:action) { described_class.new(env, *arguments) }
describe '#env' do
it 'returns the assigned env' do
expect(action.env).to be env
end
end
describe '#arguments' do
it 'returns the assigned arguments' do
expect(action.arguments).to eq arguments
end
end
describe '#input' do
it 'returns env input' do
expect(action.input).to be env.input
end
end
describe '#output' do
it 'returns env output' do
expect(action.output).to be env.output
end
end
describe '#remote' do
it 'returns env remote' do
expect(action.remote).to be env.remote
end
end
describe '#fs' do
it 'returns env remote fs' do
expect(action.fs).to be env.remote.fs
end
end
end
end