Hi Pat,
Thank you for your reply!
I'm sorry, I kind of lost track of what I was doing there... I think
the problem may have come out of my hacky attempt to get TS running
with my cucumber integration tests. Have you figured out any good ways
to do integration testing with TS? i.e. is there a way to call rake
ts:index from the test code?
For example, is there a good way to implement the "Given TS has been
indexed" step below in the 3rd example? I also included some examples
to illustrate my understanding of delta indexing -- are they correct?
---------------------------
class Context < ActiveRecord::Base
define_index do
indexes :name, :sortable => true
has state_status, created_at
set_property :delta => true
end
end
---------------------------
Scenario: #1 searching for contexts (no indexing)
Given the following contexts exist:
| name |
| context 1 |
| context 2 |
| context 3 |
And TS has NOT been indexed # no-op
When I go to '/contexts?search=context' # something like:
Context.search(params[:search], :order => params[:order_by])
Then I should see 'context 1'
And I should see 'context 2'
And I should see 'context 3'
Scenario: #2 searching for contexts arranged by name (no indexing)
Given the following contexts exist:
| name |
| context 1 |
| context 2 |
| context 3 |
And TS has NOT been indexed # no-op
When I go to '/contexts?search=context&order_by=name'
Then I should see no contexts
Scenario: #3 searching for contexts arranged by created_at (no
indexing)
Given the following contexts exist:
| name |
| context 1 |
| context 2 |
| context 3 |
And TS has NOT been indexed # no-op
When I go to '/contexts?search=context&order_by=created_at'
Then I should see 'context 1'
And I should see 'context 2'
And I should see 'context 3'
Scenario: #4 searching for contexts arranged by name (after indexing)
Given the following contexts exist:
| name |
| context 1 |
| context 2 |
| context 3 |
And TS has been indexed
When I go to '/contexts?search=context&order_by=name'
Then I should see 'context 1'
And I should see 'context 2'
And I should see 'context 3'
In Scenario #2, nothing should show up, right? Could I create a string-
to-int style attribute to allow for this to work? (since sorted
integer attributes are stored in delta indexes, right?)
Sorry for all the questions!!! And thank you in advance for any help!
Best,
Aaron
P.S. How was Cambodia? I visited Siem Reap last year and loved it.