Sha256: 28bce886653c7e468029c514a5e2b62fcf1d85bd692f6981fd6c6500ac732bce

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 KB

Contents

require "spec_helper"

describe Tinia do
  
  context "#connection" do
    
    it "should get an instance of connection" do
      Tinia.connection.should be_instance_of(
        AWSCloudSearch::CloudSearch
      )
    end

    it "should be able to configure its connection's domain" do
      AWSCloudSearch::CloudSearch.expects(:new).with("domain")
      Tinia.connection("domain")
    end
  end

  context "#indexed_with_cloud_search" do

    it "should include the appropriate modules" do

      Indexed = Class.new(ActiveRecord::Base) 

      Indexed.expects(:after_save).with(:add_to_cloud_search)
      Indexed.expects(:after_destroy).with(:delete_from_cloud_search)

      Indexed.class_eval do
        indexed_with_cloud_search do |config|
          config.cloud_search_domain = "connection-mock"
        end
      end

      mods = [
        Tinia::Connection,
        Tinia::Index,
        Tinia::Search
      ]
      mods.each do |mod|
        Indexed.included_modules.should include mod
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tinia-3.2.1 spec/tinia_spec.rb
tinia-2.3.0 spec/tinia_spec.rb
tinia-3.0.0 spec/tinia_spec.rb
tinia-3.1.0 spec/tinia_spec.rb
tinia-0.1.1 spec/tinia_spec.rb
tinia-0.1.0 spec/tinia_spec.rb
tinia-0.0.7 spec/tinia_spec.rb
tinia-0.0.6 spec/tinia_spec.rb
tinia-0.0.5 spec/tinia_spec.rb
tinia-0.0.4 spec/tinia_spec.rb
tinia-0.0.3 spec/tinia_spec.rb