|
4 | 4 | sign_in(@super_admin) |
5 | 5 | end |
6 | 6 |
|
| 7 | + it "filters by organizations by name in organizations index page" do |
| 8 | + foo_org = FactoryBot.create(:organization, name: 'foo') |
| 9 | + bar_org = FactoryBot.create(:organization, name: 'bar') |
| 10 | + baz_org = FactoryBot.create(:organization, name: 'baz') |
| 11 | + |
| 12 | + visit admin_organizations_path |
| 13 | + |
| 14 | + # All organizations listed on load |
| 15 | + [foo_org, bar_org, baz_org].each do |o| |
| 16 | + expect(page).to have_content(o.name) |
| 17 | + end |
| 18 | + |
| 19 | + # Searching by 'ba' should remove the 'foo' organization |
| 20 | + # from the organizations list but keep the 'bar' and 'baz' |
| 21 | + # organization listed. |
| 22 | + fill_in "filterrific_search_name", with: "ba" |
| 23 | + |
| 24 | + expect(page).not_to have_content(foo_org.name) |
| 25 | + [bar_org, baz_org].each do |o| |
| 26 | + expect(page).to have_content(o.name) |
| 27 | + end |
| 28 | + |
| 29 | + # Searching by 'bar' should only have the 'bar' organization |
| 30 | + # listed. |
| 31 | + fill_in "filterrific_search_name", with: "bar" |
| 32 | + [foo_org, baz_org].each do |o| |
| 33 | + expect(page).not_to have_content(o.name) |
| 34 | + end |
| 35 | + |
| 36 | + expect(page).to have_content(bar_org.name) |
| 37 | + end |
| 38 | + |
7 | 39 | it "creates a new organization" do |
8 | 40 | allow(User).to receive(:invite!).and_return(true) |
9 | 41 | visit new_admin_organization_path |
|
0 commit comments