Sha256: 140ea5392d21690f24276476b07d0b10ddf6a48c456298af407085fdeb1301c3

Contents?: true

Size: 1.03 KB

Versions: 13

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

module Bullet
  module Notification
    describe NPlusOneQuery do
      subject { NPlusOneQuery.new([%w[caller1 caller2]], Post, %i[comments votes], 'path') }

      it do
        expect(subject.body_with_caller).to eq(
          "  Post => [:comments, :votes]\n  Add to your query: .includes([:comments, :votes])\nCall stack\n  caller1\n  caller2\n"
        )
      end
      it do
        expect([subject.body_with_caller, subject.body_with_caller]).to eq(
          [
            "  Post => [:comments, :votes]\n  Add to your query: .includes([:comments, :votes])\nCall stack\n  caller1\n  caller2\n",
            "  Post => [:comments, :votes]\n  Add to your query: .includes([:comments, :votes])\nCall stack\n  caller1\n  caller2\n"
          ]
        )
      end
      it do
        expect(subject.body).to eq("  Post => [:comments, :votes]\n  Add to your query: .includes([:comments, :votes])")
      end
      it { expect(subject.title).to eq('USE eager loading in path') }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
bullet-7.0.7 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.6 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.5 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.4 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.3 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.2 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.1 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-7.0.0 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-6.1.5 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-6.1.4 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-6.1.3 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-6.1.2 spec/bullet/notification/n_plus_one_query_spec.rb
bullet-6.1.1 spec/bullet/notification/n_plus_one_query_spec.rb