spec/lib/command_spec.rb in simple_service-1.3.8 vs spec/lib/command_spec.rb in simple_service-1.3.9
- old
+ new
@@ -2,14 +2,15 @@
describe SimpleService::Command do
class ValidCommand < SimpleService::Command
expects :foo, :bar
+ optional :stuff
returns :bar, :baz
def call
context.merge!(
- bar: 'modified',
+ bar: ['modified', self.stuff].compact.join(' '),
baz: 'blah'
)
end
end
@@ -27,9 +28,15 @@
it 'returns the correct keys when using class method' do
expect(
ValidCommand.call(foo: 'blah', bar: 'meh')
).to eql(bar: 'modified', baz: 'blah')
+ end
+
+ it 'provides optional arguments as getters' do
+ expect(
+ ValidCommand.call(foo: 'blah', bar: 'meh', stuff: 'something')
+ ).to eql(bar: 'modified something', baz: 'blah')
end
end
describe '#call' do