Sha256: 4c8eef0353ca65172f0421698f4cf01a3d3b17cdfad40ba617aca74503c5070c
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' describe RakutenWebService::Resource do let(:resource_class) do Class.new(RakutenWebService::Resource) do self.resource_name = 'Dummy' attribute :name, :dummySampleAttribute end end describe '.subclasses' do before do resource_class end subject { RakutenWebService::Resource.subclasses } specify 'returns all sub classes of Resource' do expect(subject).to include(resource_class) end context 'When some resources are inherited from other resource' do let(:other_resource_class) do Class.new(resource_class) do self.resource_name = 'NestedResource' attribute :name, :someOtherAttribute end end before do other_resource_class end specify 'includes nested resources' do expect(subject).to include(resource_class, other_resource_class) end end end describe '#attributes' do let(:params) do { name: 'hoge', dummySampleAttribute: 'fuga' } end subject { resource_class.new(params).attributes } it { is_expected.to match_array(params.keys.map(&:to_s)) } end end
Version data entries
3 entries across 3 versions & 1 rubygems