Sha256: 4e5087694968fc53b5f2a590911dcdc28c4cd8e437e5790781eab1b9a292caed

Contents?: true

Size: 868 Bytes

Versions: 48

Compression:

Stored size: 868 Bytes

Contents

require 'rails_helper'

RSpec.describe Cmor::Tags::Search, type: :model do
  describe 'simple search' do
    let(:post) { create(:post) }

    before(:each) do
      post.tag_list.add('foo')
      post.save!
    end

    subject { Cmor::Tags::Search.new(tag_list: 'foo').perform }

    it { expect(subject).to be_a(Cmor::Tags::Search::Result) }

    it { expect(subject.found.keys).to include('Post') }
    it { expect(subject.found['Post'].size).to eq(1) }
  end

  context 'fuzzy search' do
    let(:post) { create(:post) }

    before(:each) do
      post.tag_list.add('foo')
      post.save!
    end

    subject { Cmor::Tags::Search.new(tag_list: 'f', exact: false).perform }

    it { expect(subject).to be_a(Cmor::Tags::Search::Result) }

    it { expect(subject.found.keys).to include('Post') }
    it { expect(subject.found['Post'].size).to eq(1) }
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
cmor_tags-0.0.51.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.50.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.49.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.48.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.45.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.44.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.43.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.42.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.41.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.40.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.39.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.38.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.37.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.36.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.35.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.34.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.33.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.32.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.31.pre spec/models/cmor/tags/search_spec.rb
cmor_tags-0.0.30.pre spec/models/cmor/tags/search_spec.rb