Sha256: 4e4eb28959ada87cac2c587ae41e1f526a63add53eaf1cc712be2126d717f73b

Contents?: true

Size: 773 Bytes

Versions: 13

Compression:

Stored size: 773 Bytes

Contents

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

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 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
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
ruben-sunspot-1.1.4 spec/api/binding_spec.rb
ruben-sunspot-1.1.3 spec/api/binding_spec.rb
ruben-sunspot-1.1.2 spec/api/binding_spec.rb
ruben-sunspot-1.1.1 spec/api/binding_spec.rb
ruben-sunspot-1.1.0 spec/api/binding_spec.rb
nuatt_sunspot-1.1.0.3 spec/api/binding_spec.rb
sunspot-1.1.0 spec/api/binding_spec.rb
sunspot-1.0.5 spec/api/binding_spec.rb
sunspot-1.0.4 spec/api/binding_spec.rb
sunspot-1.0.3 spec/api/binding_spec.rb
sunspot-1.0.2 spec/api/binding_spec.rb
sunspot-1.0.1 spec/api/binding_spec.rb
sunspot-1.0.0 spec/api/binding_spec.rb