Sha256: 6b9590836c5209baff0bf34a6cffa2dac9ab64ed127286d166bbe9fd35396dc8

Contents?: true

Size: 816 Bytes

Versions: 11

Compression:

Stored size: 816 Bytes

Contents

require 'spec_helper'
require SUPPORT_DIR.join('activerecord_models_and_services')

describe Services::Query do
  include_context 'capture logs'

  it 'has call logging disabled by default' do
    expect { Services::Posts::Find.call [] }.to_not change { logs }
  end

  describe '.convert_condition_objects_to_ids' do
    let(:comment) { Comment.create! }
    let(:comments) { (1..3).map { Comment.create! } }

    it 'converts condition objects to ids' do
      {
        comment     => comment.id,
        comments    => comments.map(&:id),
        Comment.all => Comment.all.pluck(:id)
      }.each do |condition_before, condition_after|
        expect { Services::Posts::FindRaiseConditions.call [], comment: condition_before }.to raise_error({ comment_id: condition_after }.to_json)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
services-6.0.0 spec/services/query_spec.rb
services-5.1.2 spec/services/query_spec.rb
services-5.1.1 spec/services/query_spec.rb
services-5.1.0 spec/services/query_spec.rb
services-5.0.0 spec/services/query_spec.rb
services-4.3.0 spec/services/query_spec.rb
services-4.1.4 spec/services/query_spec.rb
services-4.1.3 spec/services/query_spec.rb
services-4.1.2 spec/services/query_spec.rb
services-4.1.1 spec/services/query_spec.rb
services-4.1.0 spec/services/query_spec.rb