Sha256: 55b43c287367142e982b5597846f7cacedd1f5528e49412934d27e8404d125e5
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
require 'spec_helper' describe 'Cistern::Request' do class RequestService include Cistern::Client recognizes :key class Real attr_reader :service_args def initialize(*args) @service_args = args end end end # @todo Sample::Service.request class ListSamples < RequestService::Request cistern_method :list_all_samples def real(*args) cistern.service_args + args + ['real'] end def mock(*args) args + ['mock'] end end it 'should execute a new-style request' do expect(RequestService.new.list_all_samples('sample1')).to eq([{}, 'sample1', 'real']) expect(RequestService::Real.new.list_all_samples('sample2')).to eq(%w(sample2 real)) expect(RequestService::Mock.new.list_all_samples('sample3')).to eq(%w(sample3 mock)) # service access expect(RequestService.new(key: 'value').list_all_samples('stat')).to eq([{ key: 'value' }, 'stat', 'real']) end describe 'deprecation', :deprecated do class DeprecatedRequestService include Cistern::Client end it 'responds to #service' do class ListDeprecations < DeprecatedRequestService::Request service_method :list_deprecations def real self end end sample = DeprecatedRequestService.new.list_deprecations expect(sample.service).to eq(sample.cistern) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
cistern-2.6.0 | spec/request_spec.rb |
cistern-2.5.0 | spec/request_spec.rb |
cistern-2.4.1 | spec/request_spec.rb |
cistern-2.4.0 | spec/request_spec.rb |
cistern-2.3.0 | spec/request_spec.rb |