Created
May 1, 2010 07:29
-
-
Save patrick99e99/386129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe ResultList do | |
before(:all) do | |
ResultList.all.map(&:destroy) | |
Contact.all.map(&:destroy) | |
@result_list = ResultList.create! | |
5.times do | |
Contact.create!(:first_name => "James", :last_name => "Kirk") | |
end | |
@contact_ids = Contact.all.map(&:id) | |
end | |
it "should add the contacts to the list" do | |
@result_list.add_or_remove_checked_to_list(@contact_ids.join(","), false) | |
@result_list.job_action_count.should == @contact_ids.length | |
@result_list.contacts.count.should == @contact_ids.length | |
end | |
it "should remove the contacts from the list" do | |
@result_list.add_or_remove_checked_to_list(@contact_ids.join(","), true) | |
@result_list.job_action_count.should == -@contact_ids.length | |
@result_list.contacts.count.should == 0 | |
end | |
it "should add the search result to the list" do | |
@result_list.add_or_remove_search_result({:search => "Kirk", | |
:search_scope => "name", | |
:display => "all", | |
:model => Contact.setup}, false) | |
@result_list.job_action_count.should == @contact_ids.length | |
@result_list.contacts.count.should == @contact_ids.length | |
end | |
it "should remove the search result from the list" do | |
@result_list.add_or_remove_search_result({:search => "Kirk", | |
:search_scope => "name", | |
:display => "all", | |
:model => Contact.setup}, true) | |
@result_list.job_action_count.should == -@contact_ids.length | |
@result_list.contacts.count.should == 0 | |
end | |
it "should clear the contact results" do | |
@result_list.add_or_remove_checked_to_list(@contact_ids.join(","), false) | |
@result_list.contacts.count.should == @contact_ids.length | |
@result_list.clear | |
@result_list.contacts.count.should == 0 | |
end | |
endr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment