summaryrefslogtreecommitdiff
path: root/vendor/plugins/thinking-sphinx/features/handling_edits.feature
blob: 6b14766c98accefe12dc98b7ae8767601f3484ec (plain)
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
Feature: Keeping Sphinx in line with model changes when requested
  In order to keep indexes as up to date as possible
  Thinking Sphinx
  Should return the expected results depending on whether delta indexes are used
  
  Scenario: Returning instance from old data if there is no delta
    Given Sphinx is running
    And I am searching on alphas
    When I search for two
    Then I should get 1 result
    
    When I change the name of alpha two to twelve
    And I wait for Sphinx to catch up
    And I search for two
    Then I should get 1 result
  
  Scenario: Not returing an instance from old data if there is a delta
    Given Sphinx is running
    And I am searching on betas
    When I search for two
    Then I should get 1 result
  
    When I change the name of beta two to twelve
    And I wait for Sphinx to catch up
    And I search for two
    Then I should get 0 results
  
  Scenario: Returning instance from new data if there is a delta
    Given Sphinx is running
    And I am searching on betas
    When I search for one
    Then I should get 1 result
  
    When I change the name of beta one to eleven
    And I wait for Sphinx to catch up
    And I search for one
    Then I should get 0 results
    
    When I search for eleven
    Then I should get 1 result
  
  Scenario: Returning new records if there's a delta
    Given Sphinx is running
    And I am searching on betas
    When I search for fifteen
    Then I should get 0 results
    
    When I create a new beta named fifteen
    And I wait for Sphinx to catch up
    And I search for fifteen
    Then I should get 1 result
  
  Scenario: Avoiding delta updates if there hasn't been changes
    Given Sphinx is running
    And I am searching on betas
    When I search for five
    Then I should get 1 result
    
    When I change the name of beta five to five
    And I wait for Sphinx to catch up
    And I search for five
    Then I should get 1 result
    
    When I search for the document id of beta five in the beta_core index
    Then it should exist if using Rails 2.1 or newer
    When I search for the document id of beta five in the beta_delta index
    Then it should not exist if using Rails 2.1 or newer
  
  Scenario: Handling edits with a delta when Sphinx isn't running
    Given Sphinx is running
    And I am searching on betas
    When I stop Sphinx
    And I change the name of beta six to sixteen
    And I start Sphinx
    And I search for sixteen
    Then I should get 1 result