Sha256: 74989b35db667933286ba3273fb0d040591d0cc775aa1a91ce6966e502659591

Contents?: true

Size: 874 Bytes

Versions: 4

Compression:

Stored size: 874 Bytes

Contents

require 'spec_helper'

describe Zertico::Service do
  let(:user) { User.new }
  let(:service_class) { UserService }
  let(:service) { UserService.new }

  describe '.use_as_id' do
    it 'should define the id name' do
      expect(service_class.interface_id).to eq('great_id')
    end
  end

  describe '.use_as_variable_name' do
    it 'should define the variable name' do
      expect(service_class.interface_name).to eq('great_name')
    end
  end

  describe '.use_interface' do
    it 'should define the interface' do
      expect(service_class.interface_class).to eq(Product)
    end
  end

  describe '#resource_source=' do
    before :each do
      allow(User).to receive(:all).and_return([ user ])
      service_class.resource_source = %w(User all)
    end

    it 'should set the resource' do
      expect(service.resource_source).to eq([ user ])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zertico-2.0.0.beta.1 spec/zertico/service/class_methods_spec.rb
zertico-2.0.0.alpha.3 spec/zertico/service/class_methods_spec.rb
zertico-2.0.0.alpha.2 spec/zertico/service/class_methods_spec.rb
zertico-2.0.0.alpha.1 spec/zertico/service/class_methods_spec.rb