Sha256: cda933e31a849f29a80026c14865af1b93d13cc62f1b1487c344b2aec533eb60

Contents?: true

Size: 945 Bytes

Versions: 14

Compression:

Stored size: 945 Bytes

Contents

require "spec_helper"

# These specs will run on all databases that are defined in the spec/database.yml file.
# Comment out any databases that you do not have available for testing purposes if needed.
ScopedSearch::RSpec::Database.test_databases.each do |db|

  describe ScopedSearch, "using a #{db} database" do

    before(:all) do
      ScopedSearch::RSpec::Database.establish_named_connection(db)

      @class = ScopedSearch::RSpec::Database.create_model(:field => :string) do |klass|
        klass.scoped_search :on => :field
      end
    end

    after(:all) do
      ScopedSearch::RSpec::Database.drop_model(@class)
      ScopedSearch::RSpec::Database.close_connection
    end

    context '.search_for' do
      it "should respect existing scope" do
        @class.create! field: 'a'
        record = @class.create! field: 'ab'
        @class.where(field: 'ab').search_for('field ~ a').should eq([record])
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
scoped_search-4.1.13 spec/integration/scope_spec.rb
scoped_search-4.1.12 spec/integration/scope_spec.rb
scoped_search-4.1.11 spec/integration/scope_spec.rb
scoped_search-4.1.10 spec/integration/scope_spec.rb
scoped_search-4.1.9 spec/integration/scope_spec.rb
scoped_search-4.1.8 spec/integration/scope_spec.rb
scoped_search-4.1.7 spec/integration/scope_spec.rb
scoped_search-4.1.6 spec/integration/scope_spec.rb
scoped_search-4.1.5 spec/integration/scope_spec.rb
scoped_search-4.1.4 spec/integration/scope_spec.rb
scoped_search-4.1.3 spec/integration/scope_spec.rb
scoped_search-4.1.2 spec/integration/scope_spec.rb
scoped_search-4.1.1 spec/integration/scope_spec.rb
scoped_search-4.1.0 spec/integration/scope_spec.rb