aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuc Donnet2018-03-15 15:35:55 +0100
committerGitHub2018-03-15 15:35:55 +0100
commitd3d3c0f40c37d716cfccbf9297bfbdc98c692521 (patch)
treead64c5c06322894491a2740d14e30bb1b693561e /spec
parent499a46cabdf2ee1aab830f27c3aa3e896ded24e3 (diff)
parente93784cba5e7f07d7ff4e20622088d9506816436 (diff)
downloadchouette-core-d3d3c0f40c37d716cfccbf9297bfbdc98c692521.tar.bz2
Merge pull request #372 from af83/6146-line-states
6146 Line state update
Diffstat (limited to 'spec')
-rw-r--r--spec/features/lines_spec.rb44
-rw-r--r--spec/helpers/table_builder_helper_spec.rb24
2 files changed, 56 insertions, 12 deletions
diff --git a/spec/features/lines_spec.rb b/spec/features/lines_spec.rb
index f176e34fe..87e865798 100644
--- a/spec/features/lines_spec.rb
+++ b/spec/features/lines_spec.rb
@@ -46,6 +46,50 @@ describe "Lines", type: :feature do
expect(page).to have_content(lines.first.name)
expect(page).not_to have_content(lines.last.name)
end
+
+ context "when filtered by status" do
+ it 'supports displaying only activated lines' do
+ lines.first.update_attribute(:deactivated, true)
+ lines.last.update_attribute(:deactivated, false)
+
+ find('#q_status_activated').set(true)
+ click_button 'search-btn'
+ expect(page).to_not have_content(lines.first.name)
+ expect(page).to have_content(lines.last.name)
+ end
+
+ it 'supports displaying only deactivated lines' do
+ lines.first.update_attribute(:deactivated, true)
+ lines.last.update_attribute(:deactivated, false)
+
+ find('#q_status_deactivated').set(true)
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).to_not have_content(lines.last.name)
+ end
+
+ it 'supports displaying all lines' do
+ lines.first.update_attribute(:deactivated, true)
+ lines.last.update_attribute(:deactivated, false)
+
+ find('#q_status_activated').set(true)
+ find('#q_status_deactivated').set(true)
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).to have_content(lines.last.name)
+ end
+
+ it 'supports displaying all lines (with all filters disabled)' do
+ lines.first.update_attribute(:deactivated, true)
+ lines.last.update_attribute(:deactivated, false)
+
+ find('#q_status_activated').set(false)
+ find('#q_status_deactivated').set(false)
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).to have_content(lines.last.name)
+ end
+ end
end
end
diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb
index b0c17859f..6cb7929ac 100644
--- a/spec/helpers/table_builder_helper_spec.rb
+++ b/spec/helpers/table_builder_helper_spec.rb
@@ -68,11 +68,11 @@ describe TableBuilderHelper, type: :helper do
</tr>
</thead>
<tbody>
- <tr class="referential-#{referential.id}">
+ <tr class="referential referential-#{referential.id}">
<td>
<div class="checkbox"><input type="checkbox" name="#{referential.id}" id="#{referential.id}" value="#{referential.id}" /><label for="#{referential.id}"></label></div>
</td>
- <td title="Voir"><a href="/referentials/#{referential.id}">#{referential.name}</a></td>
+ <td title="Voir" class="name"><a href="/referentials/#{referential.id}">#{referential.name}</a></td>
<td>
<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>En préparation</span></div>
</td>
@@ -229,12 +229,12 @@ describe TableBuilderHelper, type: :helper do
</tr>
</thead>
<tbody>
- <tr class="company-#{company.id}">
+ <tr class="company company-#{company.id}">
<td>#{company.get_objectid.local_id}</td>
- <td title="Voir"><a href="/referentials/#{referential.id}/companies/#{company.id}">#{company.name}</a></td>
- <td></td>
- <td></td>
- <td></td>
+ <td title="Voir" class="name"><a href="/referentials/#{referential.id}/companies/#{company.id}">#{company.name}</a></td>
+ <td class="phone"></td>
+ <td class="email"></td>
+ <td class="url"></td>
<td class="actions">
<div class="btn-group">
<div class="btn dropdown-toggle" data-toggle="dropdown"><span class="fa fa-cog"></span></div>
@@ -344,12 +344,12 @@ describe TableBuilderHelper, type: :helper do
</tr>
</thead>
<tbody>
- <tr class="company-#{company.id}">
+ <tr class="company company-#{company.id}">
<td>#{company.get_objectid.local_id}</td>
- <td title="Voir"><a href="/referentials/#{referential.id}/companies/#{company.id}">#{company.name}</a></td>
- <td></td>
- <td></td>
- <td></td>
+ <td title="Voir" class="name"><a href="/referentials/#{referential.id}/companies/#{company.id}">#{company.name}</a></td>
+ <td class="phone"></td>
+ <td class="email"></td>
+ <td class="url"></td>
<td class="actions">
<div class="btn-group">
<div class="btn dropdown-toggle" data-toggle="dropdown"><span class="fa fa-cog"></span></div>