aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/companies_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/companies_spec.rb')
-rw-r--r--spec/features/companies_spec.rb30
1 files changed, 26 insertions, 4 deletions
diff --git a/spec/features/companies_spec.rb b/spec/features/companies_spec.rb
index 08221f637..9c024adbf 100644
--- a/spec/features/companies_spec.rb
+++ b/spec/features/companies_spec.rb
@@ -8,19 +8,41 @@ describe "Companies", :type => :feature do
let!(:companies) { Array.new(2) { create :company, line_referential: line_referential } }
subject { companies.first }
- describe "list" do
- it "display companies" do
- visit line_referential_companies_path(line_referential)
+ describe "index" do
+ before(:each) { visit line_referential_companies_path(line_referential) }
+
+ it "displays companies" do
expect(page).to have_content(companies.first.short_name)
expect(page).to have_content(companies.last.short_name)
end
+ context 'fitering' do
+ it 'supports filtering by name' do
+ fill_in 'q[name_or_objectid_cont]', with: companies.first.name
+ click_button 'search-btn'
+ expect(page).to have_content(companies.first.name)
+ expect(page).not_to have_content(companies.last.name)
+ end
+
+ it 'supports filtering by objectid' do
+ fill_in 'q[name_or_objectid_cont]', with: companies.first.objectid
+ click_button 'search-btn'
+ expect(page).to have_content(companies.first.name)
+ expect(page).not_to have_content(companies.last.name)
+ end
+ end
+ end
+
+ describe "show" do
+ it "displays line" do
+ visit line_referential_company_path(line_referential, companies.first)
+ expect(page).to have_content(companies.first.name)
+ end
end
# describe "show" do
# it "display company" do
# visit line_referential_companies_path(line_referential)
- # click_link "#{companies.first.name}"
# expect(page).to have_content(companies.first.name)
# end
#