Sha256: 7f4dd87105cf1005ccf63fe8953d6b819c2274e99c6d289f8829aad8f13dfdef

Contents?: true

Size: 1.9 KB

Versions: 11

Compression:

Stored size: 1.9 KB

Contents

describe "Searchable table spec" do
  # Override controller to properly instantiate
  def controller
    @controller ||= begin
      c = TableScreenSearchable.new
      c.on_load
      c
    end
  end

  after do
    @controller = nil
  end

  it "should show all 50 states" do
    controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 50
  end

  it "should allow searching for all the 'New' states" do
    controller.searchDisplayController(controller, shouldReloadTableForSearchString:"New")
    controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 4
  end

  it "should allow ending searches" do
    controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")
    controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 2
    controller.searchDisplayControllerWillEndSearch(controller)
    controller.tableView(controller.tableView, numberOfRowsInSection:0).should == 50
  end

  it "should expose the search_string variable and clear it properly" do
    controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")

    controller.search_string.should == "north"
    controller.original_search_string.should == "North"

    controller.searchDisplayControllerWillEndSearch(controller)

    controller.search_string.should == false
    controller.original_search_string.should == false
  end

  it "should call the start and stop searching callbacks properly" do
    controller.will_begin_search_called.should == nil
    controller.will_end_search_called.should == nil

    controller.searchDisplayControllerWillBeginSearch(controller)
    controller.searchDisplayController(controller, shouldReloadTableForSearchString:"North")
    controller.will_begin_search_called.should == true

    controller.searchDisplayControllerWillEndSearch(controller)
    controller.will_end_search_called.should == true
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ProMotion-2.2.1 spec/unit/searchable_table_spec.rb
ProMotion-2.2.0 spec/unit/searchable_table_spec.rb
ProMotion-2.1.0 spec/unit/searchable_table_spec.rb
ProMotion-2.1.0.beta1 spec/unit/searchable_table_spec.rb
ProMotion-2.0.1 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0.rc5 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0.rc4 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0.rc3 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0.rc2 spec/unit/searchable_table_spec.rb
ProMotion-2.0.0.rc1 spec/unit/searchable_table_spec.rb