Sha256: e66c6c4d4ea07b5f58da814219fca55955b4e16e4a9529cc15b04a1f490575c1

Contents?: true

Size: 977 Bytes

Versions: 42

Compression:

Stored size: 977 Bytes

Contents

require File.expand_path('spec_helper', File.dirname(__FILE__))

describe "DSL bindings" do
  it 'should give access to calling context\'s methods in search DSL' do
    value = nil
    session.search(Post) do
      value = test_method
    end
    value.should == 'value'
  end

  it 'should give access to calling context\'s id method in search DSL' do
    value = nil
    session.search(Post) do
      value = id
    end
    value.should == 16
  end

  it 'should give access to calling context\'s methods in nested DSL block' do
    value = nil
    session.search(Post) do
      any_of do
        value = test_method
      end
    end
    value.should == 'value'
  end

  it 'should give access to calling context\'s methods in double-nested DSL block' do
    value = nil
    session.search(Post) do
      any_of do
        all_of do
          value = test_method
        end
      end
    end
  end

  private

  def test_method
    'value'
  end

  def id
    16
  end
end

Version data entries

42 entries across 42 versions & 10 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/sunspot-2.2.7/spec/api/binding_spec.rb
sunspot-2.2.7 spec/api/binding_spec.rb
sunspot-2.2.6 spec/api/binding_spec.rb
sunspot-2.2.5 spec/api/binding_spec.rb
sunspot-2.2.4 spec/api/binding_spec.rb
sunspot-2.2.3 spec/api/binding_spec.rb
sunspot-2.2.2 spec/api/binding_spec.rb
sunspot-2.2.1 spec/api/binding_spec.rb
sunspot-2.2.0 spec/api/binding_spec.rb
sunspot-2.1.1 spec/api/binding_spec.rb
sunspot-2.1.0 spec/api/binding_spec.rb
sunspot-2.0.0 spec/api/binding_spec.rb
sunspot-2.0.0.pre.130115 spec/api/binding_spec.rb
gojee-sunspot-2.0.5 spec/api/binding_spec.rb
sunspot-2.0.0.pre.120925 spec/api/binding_spec.rb
sunspot_solr-2.0.0.pre.120924 sunspot/spec/api/binding_spec.rb
sunspot_rails-2.0.0.pre.120924 sunspot/spec/api/binding_spec.rb
sunspot-2.0.0.pre.120924 sunspot/spec/api/binding_spec.rb
gojee-sunspot-2.0.4 spec/api/binding_spec.rb
gojee-sunspot-2.0.2 spec/api/binding_spec.rb