aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuc Donnet2017-07-27 14:22:21 +0200
committerLuc Donnet2017-07-27 14:22:21 +0200
commit3b617583e24ee9096360d0f7434cfdb3f36f0980 (patch)
tree1f40341dfc2def5898bfaec32ef829af62578856 /spec
parentcbfe9501f2d2cfc38cbe6ac12180e372dd78eca7 (diff)
parent870f75c2411a8a46c15a0766713df9a3611f2eaf (diff)
downloadchouette-core-3b617583e24ee9096360d0f7434cfdb3f36f0980.tar.bz2
Merge branch 'master' into staging
Diffstat (limited to 'spec')
-rw-r--r--spec/features/workbenches_spec.rb24
-rw-r--r--spec/javascripts/itineraries/reducers/stop_points_spec.js63
-rw-r--r--spec/mailers/calendar_mailer_spec.rb2
-rw-r--r--spec/models/chouette/journey_pattern_spec.rb48
-rw-r--r--spec/models/chouette/routing_constraint_zone_spec.rb2
5 files changed, 78 insertions, 61 deletions
diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb
index 9141b5673..536469a46 100644
--- a/spec/features/workbenches_spec.rb
+++ b/spec/features/workbenches_spec.rb
@@ -36,7 +36,7 @@ describe 'Workbenches', type: :feature do
context 'without any filter' do
it 'should have results' do
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).to have_content(other_referential.name)
end
@@ -45,7 +45,7 @@ describe 'Workbenches', type: :feature do
context 'filter by organisation' do
it 'should be possible to filter by organisation' do
find("#q_organisation_name_eq_any_#{@user.organisation.name.parameterize.underscore}").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).not_to have_content(other_referential.name)
@@ -54,7 +54,7 @@ describe 'Workbenches', type: :feature do
it 'should be possible to filter by multiple organisation' do
find("#q_organisation_name_eq_any_#{@user.organisation.name.parameterize.underscore}").set(true)
find("#q_organisation_name_eq_any_#{another_organisation.name.parameterize.underscore}").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).to have_content(other_referential.name)
@@ -63,7 +63,7 @@ describe 'Workbenches', type: :feature do
it 'should keep filter value on submit' do
box = "#q_organisation_name_eq_any_#{another_organisation.name.parameterize.underscore}"
find(box).set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(find(box)).to be_checked
end
end
@@ -73,7 +73,7 @@ describe 'Workbenches', type: :feature do
other_referential.update_attribute(:archived_at, Date.today)
find("#q_archived_at_not_null").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(other_referential.name)
expect(page).to_not have_content(referential.name)
end
@@ -83,7 +83,7 @@ describe 'Workbenches', type: :feature do
find("#q_archived_at_not_null").set(true)
find("#q_archived_at_null").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).to have_content(other_referential.name)
end
@@ -92,14 +92,14 @@ describe 'Workbenches', type: :feature do
other_referential.update_attribute(:archived_at, Date.today)
find("#q_archived_at_null").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).to_not have_content(other_referential.name)
end
it 'should keep filter value on submit' do
find("#q_archived_at_null").set(true)
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(find("#q_archived_at_null")).to be_checked
end
end
@@ -115,7 +115,7 @@ describe 'Workbenches', type: :feature do
dates = referential.validity_period.to_a
fill_validity_field dates[0], 'begin_gteq'
fill_validity_field dates[1], 'end_lteq'
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to have_content(referential.name)
expect(page).to_not have_content(other_referential.name)
@@ -125,7 +125,7 @@ describe 'Workbenches', type: :feature do
dates = referential.validity_period.to_a
fill_validity_field dates[0], 'begin_gteq'
fill_validity_field dates[1], 'end_lteq'
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
find('a[href*="&sort=validity_period"]').click
@@ -136,7 +136,7 @@ describe 'Workbenches', type: :feature do
it 'should not show results for out off range' do
fill_validity_field(Date.today - 2.year, 'begin_gteq')
fill_validity_field(Date.today - 1.year, 'end_lteq')
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
expect(page).to_not have_content(referential.name)
expect(page).to_not have_content(other_referential.name)
@@ -147,7 +147,7 @@ describe 'Workbenches', type: :feature do
['begin_gteq', 'end_lteq'].each_with_index do |field, index|
fill_validity_field dates[index], field
end
- click_button 'Filtrer'
+ click_button I18n.t('actions.filter')
['begin_gteq', 'end_lteq'].each_with_index do |field, index|
expect(find("#q_validity_period_#{field}_3i").value).to eq dates[index].day.to_s
diff --git a/spec/javascripts/itineraries/reducers/stop_points_spec.js b/spec/javascripts/itineraries/reducers/stop_points_spec.js
index 93fe85d36..0331a424c 100644
--- a/spec/javascripts/itineraries/reducers/stop_points_spec.js
+++ b/spec/javascripts/itineraries/reducers/stop_points_spec.js
@@ -16,6 +16,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -27,6 +28,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -54,6 +56,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -65,6 +68,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -99,6 +103,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -110,6 +115,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -133,6 +139,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -144,6 +151,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -156,28 +164,29 @@ describe('stops reducer', () => {
)
})
- it('should handle DELETE_STOP', () => {
- expect(
- stopPointsReducer(state, {
- type: 'DELETE_STOP',
- index: 1
- })
- ).toEqual(
- [
- {
- text: 'first',
- index: 0,
- edit: false,
- for_boarding: 'normal',
- for_alighting: 'normal',
- olMap: {
- isOpened: false,
- json: {}
- }
- }
- ]
- )
- })
+ // it('should handle DELETE_STOP', () => {
+ // expect(
+ // stopPointsReducer(state, {
+ // type: 'DELETE_STOP',
+ // index: 1
+ // })
+ // ).toEqual(
+ // [
+ // {
+ // text: 'first',
+ // index: 0,
+ // stoppoint_id: 72,
+ // edit: false,
+ // for_boarding: 'normal',
+ // for_alighting: 'normal',
+ // olMap: {
+ // isOpened: false,
+ // json: {}
+ // }
+ // }
+ // ]
+ // )
+ // })
it('should handle UPDATE_INPUT_VALUE', () => {
expect(
@@ -205,8 +214,8 @@ describe('stops reducer', () => {
text: 'new value',
name: 'new',
index: 0,
+ stoppoint_id: 72,
edit: false,
- stoppoint_id: '',
stoparea_id: 1,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -226,6 +235,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -251,6 +261,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'prohibited',
for_alighting: 'normal',
@@ -262,6 +273,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -285,6 +297,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -293,6 +306,7 @@ describe('stops reducer', () => {
json: {
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -303,6 +317,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -326,6 +341,7 @@ describe('stops reducer', () => {
{
text: 'first',
index: 0,
+ stoppoint_id: 72,
edit: true,
for_boarding: 'normal',
for_alighting: 'normal',
@@ -337,6 +353,7 @@ describe('stops reducer', () => {
{
text: 'second',
index: 1,
+ stoppoint_id: 73,
edit: false,
for_boarding: 'normal',
for_alighting: 'normal',
diff --git a/spec/mailers/calendar_mailer_spec.rb b/spec/mailers/calendar_mailer_spec.rb
index 49cc3cce8..9a2076f64 100644
--- a/spec/mailers/calendar_mailer_spec.rb
+++ b/spec/mailers/calendar_mailer_spec.rb
@@ -5,7 +5,7 @@ RSpec.describe CalendarMailer, type: :mailer do
shared_examples 'notify all user' do |type|
let!(:user) { create(:user) }
let(:calendar) { create(:calendar, shared: true) }
- let(:email) { CalendarMailer.send(type, calendar, user) }
+ let(:email) { CalendarMailer.send(type, calendar.id, user.id) }
it 'should deliver email to user' do
expect(email).to deliver_to user.email
diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb
index 6601ed5f4..26d220056 100644
--- a/spec/models/chouette/journey_pattern_spec.rb
+++ b/spec/models/chouette/journey_pattern_spec.rb
@@ -2,30 +2,30 @@ require 'spec_helper'
describe Chouette::JourneyPattern, :type => :model do
- context 'validate minimum stop_points size' do
- let(:journey_pattern) { create :journey_pattern }
- let(:stop_points) { journey_pattern.stop_points }
-
- it 'should be valid if it has at least two sp' do
- journey_pattern.stop_points.first(stop_points.size - 2).each do |sp|
- journey_pattern.stop_points.delete(sp)
- end
- expect(journey_pattern).to be_valid
- end
-
- it 'should not be valid if it has less then two sp' do
- journey_pattern.stop_points.first(stop_points.size - 1).each do |sp|
- journey_pattern.stop_points.delete(sp)
- end
- expect(journey_pattern).to_not be_valid
- expect(journey_pattern.errors).to have_key(:stop_points)
- end
-
- it 'should only validate on update' do
- jp = build(:journey_pattern_common)
- expect(jp).to be_valid
- end
- end
+ # context 'validate minimum stop_points size' do
+ # let(:journey_pattern) { create :journey_pattern }
+ # let(:stop_points) { journey_pattern.stop_points }
+ #
+ # it 'should be valid if it has at least two sp' do
+ # journey_pattern.stop_points.first(stop_points.size - 2).each do |sp|
+ # journey_pattern.stop_points.delete(sp)
+ # end
+ # expect(journey_pattern).to be_valid
+ # end
+ #
+ # it 'should not be valid if it has less then two sp' do
+ # journey_pattern.stop_points.first(stop_points.size - 1).each do |sp|
+ # journey_pattern.stop_points.delete(sp)
+ # end
+ # expect(journey_pattern).to_not be_valid
+ # expect(journey_pattern.errors).to have_key(:stop_points)
+ # end
+ #
+ # it 'should only validate on update' do
+ # jp = build(:journey_pattern_common)
+ # expect(jp).to be_valid
+ # end
+ # end
describe "state_update" do
def journey_pattern_to_state jp
diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb
index 87ee9e9ac..0165c369d 100644
--- a/spec/models/chouette/routing_constraint_zone_spec.rb
+++ b/spec/models/chouette/routing_constraint_zone_spec.rb
@@ -29,7 +29,7 @@ describe Chouette::RoutingConstraintZone, type: :model do
}.to raise_error(ActiveRecord::RecordInvalid)
end
- it 'validates that not all stop points from the route are selected' do
+ xit 'validates that not all stop points from the route are selected' do
routing_constraint_zone.stop_points = routing_constraint_zone.route.stop_points
expect {
routing_constraint_zone.save!