Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (37 sloc) 1.232 kB
d558199 @floere + Running the script
authored
1 puts "Start server with 'cd server; thin -p 8080 start'"
2 puts "(if you haven't done so already)"
3 puts
1a22dd7 @floere + active record prototype
authored
4
3ca4c7f @floere + make the example work anywhere with gems 4.0.8 installed
authored
5 begin
6 require File.expand_path '../../../../client/lib/picky-client', __FILE__
7 rescue LoadError
8 require 'picky-client'
9 end
1a22dd7 @floere + active record prototype
authored
10 require_relative 'model'
11
d558199 @floere + Running the script
authored
12 client = Picky::Client.new path: '/search'
1a22dd7 @floere + active record prototype
authored
13
d558199 @floere + Running the script
authored
14 # This will output nothing on the first run,
15 # but the server will dump/reload even
16 # when stopping/starting.
17 #
6d3ad2d @floere + 4.0.8
authored
18 p "Expected: Nothing, Nothing OR 1, 1"
d558199 @floere + Running the script
authored
19 p client.search 'surname:mcnama*'
1ef6a8c @floere + sinatra index actions test
authored
20 p client.search 'picky'
1a22dd7 @floere + active record prototype
authored
21
6d3ad2d @floere + 4.0.8
authored
22 picky = Model.new(name: 'Picky', surname: 'McNamara')
23 picky.save
24 florian = Model.new(name: 'Florian', surname: 'Hanke')
25 florian.save
26 tentacles = Model.new(name: 'Tentacles', surname: 'Jellyfish')
27 tentacles.save
1a22dd7 @floere + active record prototype
authored
28
6d3ad2d @floere + 4.0.8
authored
29 p "Expected: 1, 2"
d558199 @floere + Running the script
authored
30 p client.search 'surname:mcnama*'
337d90d @floere + more examples
authored
31 p client.search 'hanke'
32
6d3ad2d @floere + 4.0.8
authored
33 florian.update_attributes! name: 'Kaspar', surname: 'Schiess'
34 tentacles.update_attributes! name: 'Roger', surname: 'Braun'
337d90d @floere + more examples
authored
35
6d3ad2d @floere + 4.0.8
authored
36 p "Expected: Nothing, 2, 3"
337d90d @floere + more examples
authored
37 p client.search 'hanke' # Not found anymore.
38 p client.search 'surname:schies*'
6d3ad2d @floere + 4.0.8
authored
39 p client.search 'roger'
40
41 florian.destroy
42 tentacles.destroy
43
44 p "Expected: Nothing, Nothing"
45 p client.search 'surname:schies*' # (Not found anymore)
46 p client.search 'roger' # And out. (Not found anymore)
Something went wrong with that request. Please try again.