Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 143 lines (103 sloc) 2.057 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
module Sunspot
  module Rails
    class StubSessionProxy
      attr_reader :original_session

      def initialize(original_session)
        @original_session = original_session
      end

      def index(*objects)
      end

      def index!(*objects)
      end

      def remove(*objects)
      end

      def remove!(*objects)
      end

      def remove_by_id(clazz, id)
      end

      def remove_by_id!(clazz, id)
      end

      def remove_all(clazz = nil)
      end

      def remove_all!(clazz = nil)
      end

      def dirty?
        false
      end

      def delete_dirty?
        false
      end

      def commit_if_dirty
      end

      def commit_if_delete_dirty
      end

      def commit
      end

      def search(*types)
        Search.new
      end

      def new_search(*types)
        Search.new
      end
      
      def new_more_like_this(*args)
        Search.new
      end

      class Search
        
        def build
          self
        end

        def results
          PaginatedCollection.new
        end

        def hits(options = {})
          PaginatedCollection.new
        end

        def total
          0
        end

        def facet(name)
        end

        def dynamic_facet(name)
        end

        def execute
          self
        end
      end
      
      
      class PaginatedCollection < Array
        
        def total_count
          0
        end
        alias :total_entries :total_count
        
        def current_page
          1
        end
        
        def per_page
          30
        end
        alias :limit_value :per_page
        
        def total_pages
          1
        end
        alias :num_pages :total_pages

        def first_page?
          true
        end

        def last_page?
          true
        end

        def previous_page
          nil
        end

        def next_page
          nil
        end

        def out_of_bounds?
          false
        end

        def offset
          0
        end
        
      end
      
    end
  end
end
Something went wrong with that request. Please try again.