picky 4.19.4 → 4.19.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/lib/picky/categories.rb +1 -0
  3. data/lib/picky/category_realtime.rb +1 -1
  4. data/lib/picky/index.rb +7 -1
  5. data/lib/picky/query/indexes/check.rb +2 -0
  6. data/lib/picky/query/or.rb +0 -13
  7. data/lib/picky/results.rb +4 -2
  8. data/lib/picky/search.rb +6 -8
  9. data/lib/picky/search_facets.rb +1 -1
  10. data/lib/picky.rb +5 -2
  11. data/spec/functional/or_spec.rb +1 -0
  12. data/spec/functional/to_s_spec.rb +57 -0
  13. data/spec/lib/api/search/boost_spec.rb +1 -1
  14. data/spec/lib/backends/backend_spec.rb +2 -2
  15. data/spec/lib/backends/file_spec.rb +25 -25
  16. data/spec/lib/backends/memory/json_spec.rb +1 -1
  17. data/spec/lib/backends/memory/marshal_spec.rb +1 -1
  18. data/spec/lib/backends/memory_spec.rb +28 -28
  19. data/spec/lib/backends/prepared/text_spec.rb +3 -3
  20. data/spec/lib/backends/redis/basic_spec.rb +1 -1
  21. data/spec/lib/backends/redis/directly_manipulable_spec.rb +8 -8
  22. data/spec/lib/backends/redis/float_spec.rb +3 -3
  23. data/spec/lib/backends/redis/list_spec.rb +2 -2
  24. data/spec/lib/backends/redis/string_spec.rb +2 -2
  25. data/spec/lib/backends/redis_spec.rb +33 -33
  26. data/spec/lib/backends/sqlite/array_spec.rb +12 -12
  27. data/spec/lib/backends/sqlite/directly_manipulable_spec.rb +4 -4
  28. data/spec/lib/backends/sqlite/value_spec.rb +8 -8
  29. data/spec/lib/backends/sqlite_spec.rb +28 -28
  30. data/spec/lib/bundle_indexed_spec.rb +14 -14
  31. data/spec/lib/categories_indexed_spec.rb +12 -12
  32. data/spec/lib/category_indexed_spec.rb +27 -27
  33. data/spec/lib/category_indexing_spec.rb +18 -18
  34. data/spec/lib/extensions/module_spec.rb +2 -2
  35. data/spec/lib/extensions/object_spec.rb +1 -1
  36. data/spec/lib/generators/partial/default_spec.rb +1 -1
  37. data/spec/lib/generators/partial/postfix_spec.rb +2 -2
  38. data/spec/lib/generators/similarity/phonetic_spec.rb +1 -1
  39. data/spec/lib/index_indexed_spec.rb +3 -3
  40. data/spec/lib/index_indexing_spec.rb +5 -5
  41. data/spec/lib/index_spec.rb +3 -3
  42. data/spec/lib/indexed/wrappers/bundle/calculation_spec.rb +1 -1
  43. data/spec/lib/indexed/wrappers/bundle/wrapper_spec.rb +1 -1
  44. data/spec/lib/indexers/base_spec.rb +8 -8
  45. data/spec/lib/indexers/parallel_spec.rb +6 -6
  46. data/spec/lib/indexers/serial_spec.rb +4 -4
  47. data/spec/lib/indexes_class_spec.rb +1 -1
  48. data/spec/lib/indexes_indexed_spec.rb +4 -4
  49. data/spec/lib/indexes_indexing_spec.rb +5 -5
  50. data/spec/lib/indexes_spec.rb +2 -2
  51. data/spec/lib/interfaces/live_parameters/master_child_spec.rb +13 -13
  52. data/spec/lib/interfaces/live_parameters/unicorn_spec.rb +13 -13
  53. data/spec/lib/loader_spec.rb +9 -9
  54. data/spec/lib/loggers/verbose_spec.rb +10 -3
  55. data/spec/lib/query/allocation_spec.rb +22 -22
  56. data/spec/lib/query/allocations_spec.rb +32 -32
  57. data/spec/lib/query/boosts_spec.rb +2 -2
  58. data/spec/lib/query/combination_spec.rb +5 -5
  59. data/spec/lib/query/combinations_spec.rb +8 -8
  60. data/spec/lib/query/indexes_check_spec.rb +6 -6
  61. data/spec/lib/query/indexes_spec.rb +8 -8
  62. data/spec/lib/query/solr_spec.rb +5 -5
  63. data/spec/lib/query/token_spec.rb +6 -6
  64. data/spec/lib/query/tokens_spec.rb +10 -10
  65. data/spec/lib/rack/harakiri_spec.rb +5 -5
  66. data/spec/lib/results/exact_first_spec.rb +23 -23
  67. data/spec/lib/results_spec.rb +10 -10
  68. data/spec/lib/scheduler_spec.rb +5 -5
  69. data/spec/lib/search_spec.rb +15 -15
  70. data/spec/lib/solr/schema_generator_spec.rb +7 -7
  71. data/spec/lib/tokenizer_spec.rb +3 -3
  72. metadata +48 -104
@@ -9,30 +9,30 @@ describe Picky::Backends::Redis do
9
9
  # similarity: Picky::Backends::Redis::Float.new(:unimportant, :unimportant),
10
10
  # configuration: Picky::Backends::Redis::List.new(:unimportant, :unimportant)
11
11
  #
12
- # @backend.stub! :timed_exclaim
12
+ # @backend.stub :timed_exclaim
13
13
  # end
14
14
  #
15
15
  # describe "redis_with_scripting?" do
16
- # let(:client) { stub :client}
16
+ # let(:client) { double :client}
17
17
  # let(:redis) { described_class.new client: client }
18
18
  #
19
19
  # it "answers correctly" do
20
- # client.stub! :info => {"redis_version"=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
20
+ # client.stub :info => {"redis_version"=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
21
21
  #
22
22
  # redis.redis_with_scripting?.should == false
23
23
  # end
24
24
  # it "answers correctly" do
25
- # client.stub! :info => {"redis_version"=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
25
+ # client.stub :info => {"redis_version"=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
26
26
  #
27
27
  # redis.redis_with_scripting?.should == true
28
28
  # end
29
29
  # it "answers correctly" do
30
- # client.stub! :info => {:redis_version=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
30
+ # client.stub :info => {:redis_version=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
31
31
  #
32
32
  # redis.redis_with_scripting?.should == false
33
33
  # end
34
34
  # it "answers correctly" do
35
- # client.stub! :info => {:redis_version=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
35
+ # client.stub :info => {:redis_version=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
36
36
  #
37
37
  # redis.redis_with_scripting?.should == true
38
38
  # end
@@ -47,7 +47,7 @@ describe Picky::Backends::Redis do
47
47
  # ].each do |type, kind|
48
48
  # it "creates and returns a(n) #{type} index" do
49
49
  # @backend.send(:"create_#{type}",
50
- # stub(type, :identifier => "some_identifier:#{type}")
50
+ # double(type, :identifier => "some_identifier:#{type}")
51
51
  # ).should be_kind_of(kind)
52
52
  # end
53
53
  # end
@@ -61,7 +61,7 @@ describe Picky::Backends::Redis do
61
61
  # similarity: ->(bundle, client){ Picky::Backends::Redis::Float.new(client, bundle.identifier(:similarity)) },
62
62
  # configuration: ->(bundle, client){ Picky::Backends::Redis::List.new(client, bundle.identifier(:configuration)) }
63
63
  #
64
- # @backend.stub! :timed_exclaim
64
+ # @backend.stub :timed_exclaim
65
65
  # end
66
66
  #
67
67
  # describe 'create_...' do
@@ -72,8 +72,8 @@ describe Picky::Backends::Redis do
72
72
  # [:configuration, Picky::Backends::Redis::List]
73
73
  # ].each do |type, kind|
74
74
  # it "creates and returns a(n) #{type} index" do
75
- # to_a_able_stub = Object.new
76
- # to_a_able_stub.stub! :identifier => "some_identifier:#{type}"
75
+ # to_a_able_double = Object.new
76
+ # to_a_able_stub.stub :identifier => "some_identifier:#{type}"
77
77
  # @backend.send(:"create_#{type}", to_a_able_stub).should be_kind_of(kind)
78
78
  # end
79
79
  # end
@@ -84,7 +84,7 @@ describe Picky::Backends::Redis do
84
84
  before(:each) do
85
85
  @backend = described_class.new
86
86
 
87
- @backend.stub! :timed_exclaim
87
+ @backend.stub :timed_exclaim
88
88
  end
89
89
 
90
90
  describe 'create_...' do
@@ -96,7 +96,7 @@ describe Picky::Backends::Redis do
96
96
  ].each do |type, kind|
97
97
  it "creates and returns a(n) #{type} index" do
98
98
  @backend.send(:"create_#{type}",
99
- stub(type, :identifier => "some_identifier:#{type}")
99
+ double(type, :identifier => "some_identifier:#{type}")
100
100
  ).should be_kind_of(kind)
101
101
  end
102
102
  end
@@ -106,50 +106,50 @@ describe Picky::Backends::Redis do
106
106
  #
107
107
  # describe "ids" do
108
108
  # before(:each) do
109
- # @combination1 = stub :combination1
110
- # @combination2 = stub :combination2
111
- # @combination3 = stub :combination3
109
+ # @combination1 = double :combination1
110
+ # @combination2 = double :combination2
111
+ # @combination3 = double :combination3
112
112
  # @combinations = [@combination1, @combination2, @combination3]
113
113
  # end
114
114
  # it "should intersect correctly" do
115
- # @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
116
- # @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
117
- # @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
115
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
116
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
117
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
118
118
  #
119
119
  # @backend.ids(@combinations, :any, :thing).should == (1..10).to_a
120
120
  # end
121
121
  # it "should intersect symbol_keys correctly" do
122
- # @combination1.should_receive(:ids).once.with.and_return (:'00001'..:'10000').to_a
123
- # @combination2.should_receive(:ids).once.with.and_return (:'00001'..:'00100').to_a
124
- # @combination3.should_receive(:ids).once.with.and_return (:'00001'..:'00010').to_a
122
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'10000').to_a
123
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'00100').to_a
124
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'00010').to_a
125
125
  #
126
126
  # @backend.ids(@combinations, :any, :thing).should == (:'00001'..:'0010').to_a
127
127
  # end
128
128
  # it "should intersect correctly when intermediate intersect result is empty" do
129
- # @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
130
- # @combination2.should_receive(:ids).once.with.and_return (11..100).to_a
131
- # @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
129
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
130
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (11..100).to_a
131
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
132
132
  #
133
133
  # @backend.ids(@combinations, :any, :thing).should == []
134
134
  # end
135
135
  # it "should be fast" do
136
- # @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
137
- # @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
138
- # @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
136
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
137
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
138
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
139
139
  #
140
140
  # performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.004
141
141
  # end
142
142
  # it "should be fast" do
143
- # @combination1.should_receive(:ids).once.with.and_return (1..1000).to_a
144
- # @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
145
- # @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
143
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (1..1000).to_a
144
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
145
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
146
146
  #
147
147
  # performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.00015
148
148
  # end
149
149
  # it "should be fast" do
150
- # @combination1.should_receive(:ids).once.with.and_return (1..1000).to_a
151
- # @combination2.should_receive(:ids).once.with.and_return (901..1000).to_a
152
- # @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
150
+ # @combination1.should_receive(:ids).once.with(no_args).and_return (1..1000).to_a
151
+ # @combination2.should_receive(:ids).once.with(no_args).and_return (901..1000).to_a
152
+ # @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
153
153
  #
154
154
  # performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.0001
155
155
  # end
@@ -9,7 +9,7 @@ describe Picky::Backends::SQLite::Array do
9
9
 
10
10
  describe 'dump' do
11
11
  it 'forwards to the given hash' do
12
- hash = stub :hash
12
+ hash = double :hash
13
13
 
14
14
  db.should_receive(:dump_sqlite).once.with hash
15
15
 
@@ -18,14 +18,14 @@ describe Picky::Backends::SQLite::Array do
18
18
  end
19
19
 
20
20
  describe 'dump_sqlite' do
21
- let(:client) { stub :client }
21
+ let(:client) { double :client }
22
22
  before(:each) do
23
- db.stub! :db => client
23
+ db.stub :db => client
24
24
  end
25
25
  it 'initializes the client' do
26
- client.stub! :execute
26
+ client.stub :execute
27
27
 
28
- db.should_receive(:db).exactly(4).times.with
28
+ db.should_receive(:db).exactly(4).times.with no_args
29
29
 
30
30
  db.dump_sqlite Hash.new
31
31
  end
@@ -35,7 +35,7 @@ describe Picky::Backends::SQLite::Array do
35
35
  db.dump_sqlite Hash.new
36
36
  end
37
37
  it 'inserts keys and values' do
38
- client.stub! :execute # We only want to test the insert statements.
38
+ client.stub :execute # We only want to test the insert statements.
39
39
 
40
40
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'a', '[1,2,3]'
41
41
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'b', '[4,5,6]'
@@ -74,7 +74,7 @@ describe Picky::Backends::SQLite::Array do
74
74
 
75
75
  describe 'dump' do
76
76
  it 'forwards to the given hash' do
77
- hash = stub :hash
77
+ hash = double :hash
78
78
 
79
79
  db.should_receive(:dump_sqlite).never
80
80
 
@@ -83,14 +83,14 @@ describe Picky::Backends::SQLite::Array do
83
83
  end
84
84
 
85
85
  describe 'dump_sqlite' do
86
- let(:client) { stub :client }
86
+ let(:client) { double :client }
87
87
  before(:each) do
88
- db.stub! :db => client
88
+ db.stub :db => client
89
89
  end
90
90
  it 'initializes the client' do
91
- client.stub! :execute
91
+ client.stub :execute
92
92
 
93
- db.should_receive(:db).exactly(4).times.with
93
+ db.should_receive(:db).exactly(4).times.with no_args
94
94
 
95
95
  db.dump_sqlite Hash.new
96
96
  end
@@ -100,7 +100,7 @@ describe Picky::Backends::SQLite::Array do
100
100
  db.dump_sqlite Hash.new
101
101
  end
102
102
  it 'inserts keys and values' do
103
- client.stub! :execute # We only want to test the insert statements.
103
+ client.stub :execute # We only want to test the insert statements.
104
104
 
105
105
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'a', '[1,2,3]'
106
106
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'b', '[4,5,6]'
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Picky::Backends::SQLite::DirectlyManipulable do
4
4
 
5
- let(:client) { stub :client }
6
- let(:backend) { stub :backend, client: client, namespace: 'some:namespace' }
5
+ let(:client) { double :client }
6
+ let(:backend) { double :backend, client: client, namespace: 'some:namespace' }
7
7
  let(:array) do
8
8
  array = [1,2]
9
9
  described_class.make backend, array, 'some:key'
@@ -12,7 +12,7 @@ describe Picky::Backends::SQLite::DirectlyManipulable do
12
12
 
13
13
  context 'stubbed backend' do
14
14
  before(:each) do
15
- backend.stub! :[]
15
+ backend.stub :[]
16
16
  end
17
17
  it 'calls the right client method' do
18
18
  backend.should_receive(:[]=).once.with 'some:key', [1,2,3]
@@ -38,7 +38,7 @@ describe Picky::Backends::SQLite::DirectlyManipulable do
38
38
 
39
39
  context 'stubbed client/backend' do
40
40
  before(:each) do
41
- backend.stub! :[]=
41
+ backend.stub :[]=
42
42
  end
43
43
  it 'behaves like an ordinary Array' do
44
44
  array << 3
@@ -9,7 +9,7 @@ describe Picky::Backends::SQLite::Value do
9
9
 
10
10
  describe 'dump' do
11
11
  it 'forwards to the given hash' do
12
- hash = stub :hash
12
+ hash = double :hash
13
13
 
14
14
  db.should_receive(:dump_sqlite).once.with hash
15
15
 
@@ -18,27 +18,27 @@ describe Picky::Backends::SQLite::Value do
18
18
  end
19
19
 
20
20
  describe 'dump_sqlite' do
21
- let(:client) { stub :client }
21
+ let(:client) { double :client }
22
22
  before(:each) do
23
- db.stub! :db => client
23
+ db.stub :db => client
24
24
  end
25
25
  it 'initializes the client' do
26
- client.stub! :execute
26
+ client.stub :execute
27
27
 
28
- db.should_receive(:db).exactly(4).times.with
28
+ db.should_receive(:db).exactly(4).times.with no_args
29
29
 
30
30
  db.dump_sqlite Hash.new
31
31
  end
32
32
  it 'executes something' do
33
- db.stub! :lazily_initialize_client
33
+ db.stub :lazily_initialize_client
34
34
 
35
35
  client.should_receive(:execute).at_least(1).times
36
36
 
37
37
  db.dump_sqlite Hash.new
38
38
  end
39
39
  it 'inserts keys and values' do
40
- # db.stub! :db
41
- client.stub! :execute # We only want to test the insert statements.
40
+ # db.stub :db
41
+ client.stub :execute # We only want to test the insert statements.
42
42
 
43
43
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'a', '[1,2,3]'
44
44
  client.should_receive(:execute).once.with 'insert into key_value values (?,?)', 'b', '[4,5,6]'
@@ -11,7 +11,7 @@ describe Picky::Backends::SQLite do
11
11
  # similarity: Picky::Backends::SQLite::Value.new(:unimportant),
12
12
  # configuration: Picky::Backends::SQLite::Array.new(:unimportant)
13
13
  #
14
- # @backend.stub! :timed_exclaim
14
+ # @backend.stub :timed_exclaim
15
15
  # end
16
16
  #
17
17
  # describe 'create_...' do
@@ -23,7 +23,7 @@ describe Picky::Backends::SQLite do
23
23
  # ].each do |type, kind|
24
24
  # it "creates and returns a(n) #{type} index" do
25
25
  # @backend.send(:"create_#{type}",
26
- # stub(type, :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}")
26
+ # double(type, :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}")
27
27
  # ).should be_kind_of(kind)
28
28
  # end
29
29
  # end
@@ -37,7 +37,7 @@ describe Picky::Backends::SQLite do
37
37
  # similarity: ->(bundle){ Picky::Backends::SQLite::Value.new(bundle.index_path(:similarity)) },
38
38
  # configuration: ->(bundle){ Picky::Backends::SQLite::Array.new(bundle.index_path(:configuration)) }
39
39
  #
40
- # @backend.stub! :timed_exclaim
40
+ # @backend.stub :timed_exclaim
41
41
  # end
42
42
  #
43
43
  # describe 'create_...' do
@@ -48,8 +48,8 @@ describe Picky::Backends::SQLite do
48
48
  # [:configuration, Picky::Backends::SQLite::Array]
49
49
  # ].each do |type, kind|
50
50
  # it "creates and returns a(n) #{type} index" do
51
- # to_a_able_stub = Object.new
52
- # to_a_able_stub.stub! :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}"
51
+ # to_a_able_double = Object.new
52
+ # to_a_able_stub.stub :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}"
53
53
  # @backend.send(:"create_#{type}", to_a_able_stub).should be_kind_of(kind)
54
54
  # end
55
55
  # end
@@ -60,7 +60,7 @@ describe Picky::Backends::SQLite do
60
60
  before(:each) do
61
61
  @backend = described_class.new
62
62
 
63
- @backend.stub! :timed_exclaim
63
+ @backend.stub :timed_exclaim
64
64
  end
65
65
 
66
66
  describe 'create_...' do
@@ -72,7 +72,7 @@ describe Picky::Backends::SQLite do
72
72
  ].each do |type, kind|
73
73
  it "creates and returns a(n) #{type} index" do
74
74
  @backend.send(:"create_#{type}",
75
- stub(type, :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}")
75
+ double(type, :index_path => "spec/temp/index/test/some_index/some_category_some_bundle_#{type}")
76
76
  ).should be_kind_of(kind)
77
77
  end
78
78
  end
@@ -80,50 +80,50 @@ describe Picky::Backends::SQLite do
80
80
 
81
81
  describe "ids" do
82
82
  before(:each) do
83
- @combination1 = stub :combination1
84
- @combination2 = stub :combination2
85
- @combination3 = stub :combination3
83
+ @combination1 = double :combination1
84
+ @combination2 = double :combination2
85
+ @combination3 = double :combination3
86
86
  @combinations = [@combination1, @combination2, @combination3]
87
87
  end
88
88
  it "should intersect correctly" do
89
- @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
90
- @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
91
- @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
89
+ @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
90
+ @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
91
+ @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
92
92
 
93
93
  @backend.ids(@combinations, :any, :thing).should == (1..10).to_a
94
94
  end
95
95
  it "should intersect symbol_keys correctly" do
96
- @combination1.should_receive(:ids).once.with.and_return (:'00001'..:'10000').to_a
97
- @combination2.should_receive(:ids).once.with.and_return (:'00001'..:'00100').to_a
98
- @combination3.should_receive(:ids).once.with.and_return (:'00001'..:'00010').to_a
96
+ @combination1.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'10000').to_a
97
+ @combination2.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'00100').to_a
98
+ @combination3.should_receive(:ids).once.with(no_args).and_return (:'00001'..:'00010').to_a
99
99
 
100
100
  @backend.ids(@combinations, :any, :thing).should == (:'00001'..:'0010').to_a
101
101
  end
102
102
  it "should intersect correctly when intermediate intersect result is empty" do
103
- @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
104
- @combination2.should_receive(:ids).once.with.and_return (11..100).to_a
105
- @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
103
+ @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
104
+ @combination2.should_receive(:ids).once.with(no_args).and_return (11..100).to_a
105
+ @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
106
106
 
107
107
  @backend.ids(@combinations, :any, :thing).should == []
108
108
  end
109
109
  it "should be fast" do
110
- @combination1.should_receive(:ids).once.with.and_return (1..100_000).to_a
111
- @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
112
- @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
110
+ @combination1.should_receive(:ids).once.with(no_args).and_return (1..100_000).to_a
111
+ @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
112
+ @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
113
113
 
114
114
  performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.004
115
115
  end
116
116
  it "should be fast" do
117
- @combination1.should_receive(:ids).once.with.and_return (1..1000).to_a
118
- @combination2.should_receive(:ids).once.with.and_return (1..100).to_a
119
- @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
117
+ @combination1.should_receive(:ids).once.with(no_args).and_return (1..1000).to_a
118
+ @combination2.should_receive(:ids).once.with(no_args).and_return (1..100).to_a
119
+ @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
120
120
 
121
121
  performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.00015
122
122
  end
123
123
  it "should be fast" do
124
- @combination1.should_receive(:ids).once.with.and_return (1..1000).to_a
125
- @combination2.should_receive(:ids).once.with.and_return (901..1000).to_a
126
- @combination3.should_receive(:ids).once.with.and_return (1..10).to_a
124
+ @combination1.should_receive(:ids).once.with(no_args).and_return (1..1000).to_a
125
+ @combination2.should_receive(:ids).once.with(no_args).and_return (901..1000).to_a
126
+ @combination3.should_receive(:ids).once.with(no_args).and_return (1..10).to_a
127
127
 
128
128
  performance_of { @backend.ids(@combinations, :any, :thing) }.should < 0.0001
129
129
  end
@@ -6,9 +6,9 @@ describe Picky::Bundle do
6
6
  @index = Picky::Index.new :some_index
7
7
  @category = Picky::Category.new :some_category, @index
8
8
 
9
- @weights = stub :weights, :saved? => true
10
- @partial = stub :partial, :saved? => true
11
- @similarity = stub :similarity, :saved? => true
9
+ @weights = double :weights, :saved? => true
10
+ @partial = double :partial, :saved? => true
11
+ @similarity = double :similarity, :saved? => true
12
12
  @bundle = described_class.new :some_name, @category, @weights, @partial, @similarity
13
13
  end
14
14
 
@@ -106,21 +106,21 @@ describe Picky::Bundle do
106
106
  @bundle.dump # Create an index first.
107
107
  end
108
108
  it 'should trigger loads' do
109
- @bundle.should_receive(:load_inverted).once.with
110
- @bundle.should_receive(:load_weights).once.with
111
- @bundle.should_receive(:load_similarity).once.with
112
- @bundle.should_receive(:load_configuration).once.with
109
+ @bundle.should_receive(:load_inverted).once.with no_args
110
+ @bundle.should_receive(:load_weights).once.with no_args
111
+ @bundle.should_receive(:load_similarity).once.with no_args
112
+ @bundle.should_receive(:load_configuration).once.with no_args
113
113
 
114
114
  @bundle.load
115
115
  end
116
116
  end
117
117
  describe "loading indexes" do
118
118
  before(:each) do
119
- @bundle.stub! :timed_exclaim
119
+ @bundle.stub :timed_exclaim
120
120
  end
121
121
  describe "load_index" do
122
122
  it "uses the right file" do
123
- MultiJson.stub! :decode
123
+ MultiJson.stub :decode
124
124
 
125
125
  File.should_receive(:open).once.with 'spec/temp/index/test/some_index/some_category_some_name_inverted.memory.json', 'r'
126
126
 
@@ -129,7 +129,7 @@ describe Picky::Bundle do
129
129
  end
130
130
  describe "load_weights" do
131
131
  it "uses the right file" do
132
- MultiJson.stub! :decode
132
+ MultiJson.stub :decode
133
133
 
134
134
  File.should_receive(:open).once.with 'spec/temp/index/test/some_index/some_category_some_name_weights.memory.json', 'r'
135
135
 
@@ -138,7 +138,7 @@ describe Picky::Bundle do
138
138
  end
139
139
  describe "load_similarity" do
140
140
  it "uses the right file" do
141
- Marshal.stub! :load
141
+ Marshal.stub :load
142
142
 
143
143
  File.should_receive(:open).once.with 'spec/temp/index/test/some_index/some_category_some_name_similarity.memory.dump', 'r:binary'
144
144
 
@@ -147,7 +147,7 @@ describe Picky::Bundle do
147
147
  end
148
148
  describe "load_configuration" do
149
149
  it "uses the right file" do
150
- MultiJson.stub! :decode
150
+ MultiJson.stub :decode
151
151
 
152
152
  File.should_receive(:open).once.with 'spec/temp/index/test/some_index/some_category_some_name_configuration.memory.json', 'r'
153
153
 
@@ -161,8 +161,8 @@ describe Picky::Bundle do
161
161
  @index = Picky::Index.new :some_index
162
162
  @category = Picky::Category.new :some_category, @index
163
163
 
164
- @weights = stub :weights, :saved? => true
165
- @partial = stub :partial, :saved? => true
164
+ @weights = double :weights, :saved? => true
165
+ @partial = double :partial, :saved? => true
166
166
  @bundle = described_class.new :some_name, @category, @weights, @partial, :similarity
167
167
  end
168
168
  it 'should initialize the index correctly' do
@@ -26,8 +26,8 @@ describe Picky::Categories do
26
26
  end
27
27
  context 'with some similar' do
28
28
  before(:each) do
29
- @bundle1 = stub :bundle1, :similar => ['similar', 'text'], :weight => 1, :identifier => ''
30
- @category1.stub! :bundle_for => @bundle1
29
+ @bundle1 = double :bundle1, :similar => ['similar', 'text'], :weight => 1, :identifier => ''
30
+ @category1.stub :bundle_for => @bundle1
31
31
  end
32
32
  # it "returns possible categories" do
33
33
  # @categories.similar_possible_for(@token).should == [
@@ -48,13 +48,13 @@ describe Picky::Categories do
48
48
  @categories.category_hash.should be_empty
49
49
  end
50
50
  it "isn't clear anymore after adding" do
51
- @categories << stub(:category, :name => :some_name)
51
+ @categories << double(:category, :name => :some_name)
52
52
 
53
53
  @categories.categories.should_not be_empty
54
54
  @categories.category_hash.should_not be_empty
55
55
  end
56
56
  it "is clear again after clearing" do
57
- @categories << stub(:category, :name => :some_name)
57
+ @categories << double(:category, :name => :some_name)
58
58
 
59
59
  @categories.clear_categories
60
60
 
@@ -79,11 +79,11 @@ describe Picky::Categories do
79
79
 
80
80
  # describe "possible_combinations" do
81
81
  # before(:each) do
82
- # @token = stub :token
82
+ # @token = double :token
83
83
  # end
84
84
  # context "with similar token" do
85
85
  # before(:each) do
86
- # @token.stub :similar? => true, :categorize => nil
86
+ # @token.double :similar? => true, :categorize => nil
87
87
  # end
88
88
  # it "calls the right method" do
89
89
  # @categories.should_receive(:similar_possible_for).once.with @token
@@ -93,7 +93,7 @@ describe Picky::Categories do
93
93
  # end
94
94
  # context "with non-similar token" do
95
95
  # before(:each) do
96
- # @token.stub :similar? => false, :categorize => nil
96
+ # @token.double :similar? => false, :categorize => nil
97
97
  # end
98
98
  # it "calls the right method" do
99
99
  # @categories.should_receive(:possible_for).once.with @token
@@ -111,8 +111,8 @@ describe Picky::Categories do
111
111
  # end
112
112
  # context 'combination exists' do
113
113
  # before(:each) do
114
- # @combination = stub :combination
115
- # @category2.stub! :combination_for => @combination
114
+ # @combination = double :combination
115
+ # @category2.stub :combination_for => @combination
116
116
  # end
117
117
  # it 'should return the right combinations' do
118
118
  # @categories.possible_for(@token).should == [@combination]
@@ -120,7 +120,7 @@ describe Picky::Categories do
120
120
  # end
121
121
  # context 'combination does not exist' do
122
122
  # before(:each) do
123
- # @category2.stub! :combination_for => nil
123
+ # @category2.stub :combination_for => nil
124
124
  # end
125
125
  # it 'should return the right combinations' do
126
126
  # @categories.possible_for(@token).should == []
@@ -139,7 +139,7 @@ describe Picky::Categories do
139
139
  describe 'possible_categories' do
140
140
  context 'user defined exists' do
141
141
  before(:each) do
142
- @token = stub :token, :predefined_categories => [@category2]
142
+ @token = double :token, :predefined_categories => [@category2]
143
143
  end
144
144
  it 'should return the right categories' do
145
145
  @categories.possible_categories(@token).should == [@category2]
@@ -147,7 +147,7 @@ describe Picky::Categories do
147
147
  end
148
148
  context 'user defined does not exist' do
149
149
  before(:each) do
150
- @token = stub :token, :predefined_categories => nil
150
+ @token = double :token, :predefined_categories => nil
151
151
  end
152
152
  it 'should return all categories' do
153
153
  @categories.possible_categories(@token).should == [@category1, @category2, @category3]