test/test_table_searcher.rb in clevic-0.13.0.b5 vs test/test_table_searcher.rb in clevic-0.13.0.b6
- old
+ new
@@ -1,7 +1,6 @@
-require 'generator'
-require 'logger'
+#~ require 'logger'
require File.dirname(__FILE__) + '/test_helper.rb'
require 'clevic/table_searcher.rb'
class MockSearchCriteria
@@ -61,11 +60,11 @@
end
context "searching" do
setup do
@simple_search_criteria.search_text = CreateFakePassengers::NATIONALITIES[0]
- @passenger_generator = Generator.new( @all_passengers )
+ @passenger_generator = Enumerator.new( @all_passengers )
@simple_search_criteria.from_start = true
end
should "have #{CreateFakePassengers::MAX_PASSENGERS} passengers" do
assert_equal CreateFakePassengers::MAX_PASSENGERS, Passenger.count
@@ -124,14 +123,15 @@
@flight_field = Clevic::Field.new( :flight, Passenger, { :display => 'number' } )
end
should 'raise an exception for no display value' do
@flight_field = Clevic::Field.new( :flight, Passenger, {} )
+
@flight_field.display = nil
-
assert_nil @flight_field.display
- assert_raise RuntimeError do
+
+ assert_raise( RuntimeError ) do
table_searcher = Clevic::TableSearcher.new( Passenger.dataset, @simple_search_criteria, @flight_field )
table_searcher.search
end
end
@@ -169,10 +169,10 @@
should 'find a full value with a partial search string' do
@simple_search_criteria.whole_words = false
@simple_search_criteria.from_start = true
table_searcher = Clevic::TableSearcher.new( Passenger.dataset, @simple_search_criteria, @nationality_field )
- expecteds = Generator.new @should_find
+ expecteds = Enumerator.new @should_find
last_entity = nil
while next_entity = table_searcher.search( last_entity )
assert_equal next_entity, expecteds.next
last_entity = next_entity
@simple_search_criteria.from_start = false