Merge branch 'dev'
This commit is contained in:
commit
e4e51c66b6
122 changed files with 581 additions and 984 deletions
|
@ -65,7 +65,7 @@ jobs:
|
||||||
- *bundle_install
|
- *bundle_install
|
||||||
- run:
|
- run:
|
||||||
name: Run rubocop
|
name: Run rubocop
|
||||||
command: bundle exec rubocop -R
|
command: bundle exec rubocop
|
||||||
- run:
|
- run:
|
||||||
name: Run brakeman
|
name: Run brakeman
|
||||||
command: bundle exec brakeman -z
|
command: bundle exec brakeman -z
|
||||||
|
|
159
.rubocop.yml
159
.rubocop.yml
|
@ -155,28 +155,28 @@ Layout/RescueEnsureAlignment:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAfterColon:
|
Layout/SpaceAfterColon:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAfterComma:
|
Layout/SpaceAfterComma:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Layout/SpaceAfterMethodName:
|
Layout/SpaceAfterMethodName:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAfterNot:
|
Layout/SpaceAfterNot:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAfterSemicolon:
|
Layout/SpaceAfterSemicolon:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAroundBlockParameters:
|
Layout/SpaceAroundBlockParameters:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAroundEqualsInParameterDefault:
|
Layout/SpaceAroundEqualsInParameterDefault:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAroundKeyword:
|
Layout/SpaceAroundKeyword:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceAroundOperators:
|
Layout/SpaceAroundOperators:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -185,52 +185,56 @@ Layout/SpaceBeforeBlockBraces:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Layout/SpaceBeforeComma:
|
Layout/SpaceBeforeComma:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceBeforeComment:
|
Layout/SpaceBeforeComment:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceBeforeFirstArg:
|
Layout/SpaceBeforeFirstArg:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceBeforeSemicolon:
|
Layout/SpaceBeforeSemicolon:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInLambdaLiteral:
|
Layout/SpaceInLambdaLiteral:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
EnforcedStyle: require_space
|
||||||
|
|
||||||
Layout/SpaceInsideArrayPercentLiteral:
|
Layout/SpaceInsideArrayPercentLiteral:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsideBlockBraces:
|
Layout/SpaceInsideBlockBraces:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsideBrackets:
|
Layout/SpaceInsideBrackets:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsideHashLiteralBraces:
|
Layout/SpaceInsideHashLiteralBraces:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
|
Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Layout/SpaceInsideParens:
|
Layout/SpaceInsideParens:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsidePercentLiteralDelimiters:
|
Layout/SpaceInsidePercentLiteralDelimiters:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsideRangeLiteral:
|
Layout/SpaceInsideRangeLiteral:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/SpaceInsideStringInterpolation:
|
Layout/SpaceInsideStringInterpolation:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/Tab:
|
Layout/Tab:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/TrailingBlankLines:
|
Layout/TrailingBlankLines:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Layout/TrailingWhitespace:
|
Layout/TrailingWhitespace:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Lint/AmbiguousBlockAssociation:
|
Lint/AmbiguousBlockAssociation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -317,9 +321,6 @@ Lint/IneffectiveAccessModifier:
|
||||||
Lint/InheritException:
|
Lint/InheritException:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/InvalidCharacterLiteral:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Lint/LiteralInCondition:
|
Lint/LiteralInCondition:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -381,7 +382,7 @@ Lint/StringConversionInInterpolation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Lint/Syntax:
|
Lint/Syntax:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
Lint/UnderscorePrefixedVariableName:
|
Lint/UnderscorePrefixedVariableName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
@ -404,6 +405,12 @@ Lint/UnusedBlockArgument:
|
||||||
Lint/UnusedMethodArgument:
|
Lint/UnusedMethodArgument:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UriEscapeUnescape:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UriRegexp:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Lint/UselessAccessModifier:
|
Lint/UselessAccessModifier:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -452,6 +459,39 @@ Metrics/ParameterLists:
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/AccessorMethodName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/AsciiIdentifiers:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/BinaryOperatorParameterName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/ClassAndModuleCamelCase:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/ConstantName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/FileName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/HeredocDelimiterNaming:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/MethodName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/PredicateName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/VariableName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/VariableNumber:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Performance/Caller:
|
Performance/Caller:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
@ -539,6 +579,9 @@ Rails/ApplicationRecord:
|
||||||
Rails/Blank:
|
Rails/Blank:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/CreateTableWithTimestamps:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -554,6 +597,9 @@ Rails/DynamicFindBy:
|
||||||
Rails/EnumUniqueness:
|
Rails/EnumUniqueness:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/EnvironmentComparison:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/Exit:
|
Rails/Exit:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -569,9 +615,18 @@ Rails/FindEach:
|
||||||
Rails/HasAndBelongsToMany:
|
Rails/HasAndBelongsToMany:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/HasManyOrHasOneDependent:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/HttpPositionalArguments:
|
Rails/HttpPositionalArguments:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/InverseOf:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/LexicallyScopedActionFilter:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/NotNullColumn:
|
Rails/NotNullColumn:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -584,6 +639,9 @@ Rails/OutputSafety:
|
||||||
Rails/PluralizationGrammar:
|
Rails/PluralizationGrammar:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/Presence:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/Present:
|
Rails/Present:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
@ -617,11 +675,14 @@ Rails/TimeZone:
|
||||||
Rails/UniqBeforePluck:
|
Rails/UniqBeforePluck:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Rails/UnknownEnv:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Rails/Validation:
|
Rails/Validation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Rails:
|
Rails:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
RSpec/Focused:
|
RSpec/Focused:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
@ -638,9 +699,6 @@ Security/MarshalLoad:
|
||||||
Security/YAMLLoad:
|
Security/YAMLLoad:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/AccessorMethodName:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/Alias:
|
Style/Alias:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -653,9 +711,6 @@ Style/ArrayJoin:
|
||||||
Style/AsciiComments:
|
Style/AsciiComments:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/AsciiIdentifiers:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/Attr:
|
Style/Attr:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -683,9 +738,6 @@ Style/CaseEquality:
|
||||||
Style/CharacterLiteral:
|
Style/CharacterLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/ClassAndModuleCamelCase:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/ClassAndModuleChildren:
|
Style/ClassAndModuleChildren:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -710,13 +762,16 @@ Style/CommandLiteral:
|
||||||
Style/CommentAnnotation:
|
Style/CommentAnnotation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/CommentedKeyword:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Style/ConditionalAssignment:
|
Style/ConditionalAssignment:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/ConstantName:
|
Style/Copyright:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/Copyright:
|
Style/DateTime:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/DefWithParentheses:
|
Style/DefWithParentheses:
|
||||||
|
@ -755,10 +810,10 @@ Style/Encoding:
|
||||||
Style/EndBlock:
|
Style/EndBlock:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/EvenOdd:
|
Style/EvalWithLocation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/FileName:
|
Style/EvenOdd:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/FlipFlop:
|
Style/FlipFlop:
|
||||||
|
@ -839,15 +894,15 @@ Style/MethodDefParentheses:
|
||||||
Style/MethodMissing:
|
Style/MethodMissing:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/MethodName:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/MissingElse:
|
Style/MissingElse:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/MixinGrouping:
|
Style/MixinGrouping:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/MixinUsage:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Style/ModuleFunction:
|
Style/ModuleFunction:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -911,9 +966,6 @@ Style/NumericPredicate:
|
||||||
Style/OneLineConditional:
|
Style/OneLineConditional:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/OpMethod:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/OptionHash:
|
Style/OptionHash:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -935,9 +987,6 @@ Style/PercentQLiterals:
|
||||||
Style/PerlBackrefs:
|
Style/PerlBackrefs:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/PredicateName:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/PreferredHashMethods:
|
Style/PreferredHashMethods:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -947,6 +996,9 @@ Style/Proc:
|
||||||
Style/RaiseArgs:
|
Style/RaiseArgs:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RandomWithOffset:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Style/RedundantBegin:
|
Style/RedundantBegin:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -971,6 +1023,9 @@ Style/RegexpLiteral:
|
||||||
Style/RescueModifier:
|
Style/RescueModifier:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RescueStandardError:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Style/SafeNavigation:
|
Style/SafeNavigation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
@ -1049,12 +1104,6 @@ Style/UnneededPercentQ:
|
||||||
Style/VariableInterpolation:
|
Style/VariableInterpolation:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Style/VariableName:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/VariableNumber:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Style/WhenThen:
|
Style/WhenThen:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|
2
Gemfile
2
Gemfile
|
@ -20,6 +20,8 @@ gem 'sdoc', '~> 0.4.0', group: :doc
|
||||||
# Enable deep clone of active record models
|
# Enable deep clone of active record models
|
||||||
gem 'deep_cloneable', '~> 2.2.1'
|
gem 'deep_cloneable', '~> 2.2.1'
|
||||||
|
|
||||||
|
gem 'warden', git: 'https://github.com/hassox/warden.git', branch: 'master'
|
||||||
|
|
||||||
# Use Unicorn as the app server
|
# Use Unicorn as the app server
|
||||||
gem 'unicorn'
|
gem 'unicorn'
|
||||||
|
|
||||||
|
|
67
Gemfile.lock
67
Gemfile.lock
|
@ -1,3 +1,11 @@
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/hassox/warden.git
|
||||||
|
revision: a4b197e0b28e7b576b0745b0f6aeaed8dbb774a4
|
||||||
|
branch: master
|
||||||
|
specs:
|
||||||
|
warden (1.2.8)
|
||||||
|
rack (>= 1.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/mina-deploy/mina.git
|
remote: https://github.com/mina-deploy/mina.git
|
||||||
revision: 343a7ab672d8b4f0ddb84ec240cde7d94b46397a
|
revision: 343a7ab672d8b4f0ddb84ec240cde7d94b46397a
|
||||||
|
@ -133,6 +141,7 @@ GEM
|
||||||
carrierwave (>= 0.9)
|
carrierwave (>= 0.9)
|
||||||
crack (0.4.3)
|
crack (0.4.3)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
|
crass (1.0.3)
|
||||||
daemons (1.2.4)
|
daemons (1.2.4)
|
||||||
database_cleaner (1.5.3)
|
database_cleaner (1.5.3)
|
||||||
datetime_picker_rails (0.0.7)
|
datetime_picker_rails (0.0.7)
|
||||||
|
@ -142,7 +151,7 @@ GEM
|
||||||
activerecord (>= 3.1.0, < 5.2.0)
|
activerecord (>= 3.1.0, < 5.2.0)
|
||||||
delayed_cron_job (0.7.2)
|
delayed_cron_job (0.7.2)
|
||||||
delayed_job (>= 4.1)
|
delayed_job (>= 4.1)
|
||||||
delayed_job (4.1.3)
|
delayed_job (4.1.4)
|
||||||
activesupport (>= 3.0, < 5.2)
|
activesupport (>= 3.0, < 5.2)
|
||||||
delayed_job_active_record (4.1.2)
|
delayed_job_active_record (4.1.2)
|
||||||
activerecord (>= 3.0, < 5.2)
|
activerecord (>= 3.0, < 5.2)
|
||||||
|
@ -151,14 +160,14 @@ GEM
|
||||||
activerecord (> 3.0.0)
|
activerecord (> 3.0.0)
|
||||||
delayed_job (> 2.0.3)
|
delayed_job (> 2.0.3)
|
||||||
sinatra (>= 1.4.4)
|
sinatra (>= 1.4.4)
|
||||||
devise (4.2.0)
|
devise (4.4.0)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0, < 5.1)
|
railties (>= 4.1.0, < 5.2)
|
||||||
responders
|
responders
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
diff-lcs (1.2.5)
|
diff-lcs (1.2.5)
|
||||||
domain_name (0.5.20161129)
|
domain_name (0.5.20170404)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (2.2.0)
|
dotenv (2.2.0)
|
||||||
dotenv-rails (2.2.0)
|
dotenv-rails (2.2.0)
|
||||||
|
@ -389,7 +398,7 @@ GEM
|
||||||
leaflet-markercluster-rails (0.7.0)
|
leaflet-markercluster-rails (0.7.0)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
leaflet-rails (0.7.7)
|
leaflet-rails (0.7.7)
|
||||||
libv8 (3.16.14.17)
|
libv8 (3.16.14.19)
|
||||||
listen (3.1.5)
|
listen (3.1.5)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
|
@ -400,7 +409,8 @@ GEM
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
logstash-event (~> 1.2.0)
|
logstash-event (~> 1.2.0)
|
||||||
request_store
|
request_store
|
||||||
loofah (2.0.3)
|
loofah (2.1.1)
|
||||||
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
lumberjack (1.0.10)
|
lumberjack (1.0.10)
|
||||||
mail (2.6.4)
|
mail (2.6.4)
|
||||||
|
@ -416,7 +426,7 @@ GEM
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
mimemagic (0.3.2)
|
mimemagic (0.3.2)
|
||||||
mini_portile2 (2.3.0)
|
mini_portile2 (2.3.0)
|
||||||
minitest (5.10.3)
|
minitest (5.11.1)
|
||||||
momentjs-rails (2.17.1)
|
momentjs-rails (2.17.1)
|
||||||
railties (>= 3.1)
|
railties (>= 3.1)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.1)
|
||||||
|
@ -465,9 +475,9 @@ GEM
|
||||||
openstack (3.3.7)
|
openstack (3.3.7)
|
||||||
json
|
json
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
parallel (1.11.2)
|
parallel (1.12.1)
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.2)
|
||||||
ast (~> 2.2)
|
ast (~> 2.3)
|
||||||
pdf-core (0.6.1)
|
pdf-core (0.6.1)
|
||||||
pg (0.19.0)
|
pg (0.19.0)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
|
@ -485,7 +495,7 @@ GEM
|
||||||
byebug (~> 9.0)
|
byebug (~> 9.0)
|
||||||
pry (~> 0.10)
|
pry (~> 0.10)
|
||||||
public_suffix (2.0.5)
|
public_suffix (2.0.5)
|
||||||
rack (2.0.1)
|
rack (2.0.3)
|
||||||
rack-handlers (0.7.3)
|
rack-handlers (0.7.3)
|
||||||
rack
|
rack
|
||||||
rack-mini-profiler (0.10.7)
|
rack-mini-profiler (0.10.7)
|
||||||
|
@ -527,10 +537,9 @@ GEM
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.2.2)
|
rainbow (3.0.0)
|
||||||
rake
|
|
||||||
raindrops (0.17.0)
|
raindrops (0.17.0)
|
||||||
rake (12.0.0)
|
rake (12.3.0)
|
||||||
rb-fsevent (0.9.8)
|
rb-fsevent (0.9.8)
|
||||||
rb-inotify (0.9.7)
|
rb-inotify (0.9.7)
|
||||||
ffi (>= 0.5.0)
|
ffi (>= 0.5.0)
|
||||||
|
@ -542,9 +551,10 @@ GEM
|
||||||
rdoc (4.3.0)
|
rdoc (4.3.0)
|
||||||
ref (2.0.0)
|
ref (2.0.0)
|
||||||
request_store (1.3.1)
|
request_store (1.3.1)
|
||||||
responders (2.3.0)
|
responders (2.4.0)
|
||||||
railties (>= 4.2.0, < 5.1)
|
actionpack (>= 4.2.0, < 5.3)
|
||||||
rest-client (2.0.0)
|
railties (>= 4.2.0, < 5.3)
|
||||||
|
rest-client (2.0.2)
|
||||||
http-cookie (>= 1.0.2, < 2.0)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
mime-types (>= 1.16, < 4.0)
|
mime-types (>= 1.16, < 4.0)
|
||||||
netrc (~> 0.8)
|
netrc (~> 0.8)
|
||||||
|
@ -578,16 +588,16 @@ GEM
|
||||||
rspec-support (3.5.0)
|
rspec-support (3.5.0)
|
||||||
rspec_junit_formatter (0.3.0)
|
rspec_junit_formatter (0.3.0)
|
||||||
rspec-core (>= 2, < 4, != 2.12.0)
|
rspec-core (>= 2, < 4, != 2.12.0)
|
||||||
rubocop (0.49.1)
|
rubocop (0.52.1)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.3.3.1, < 3.0)
|
parser (>= 2.4.0.2, < 3.0)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
rubocop-rspec-focused (0.1.0)
|
rubocop-rspec-focused (0.1.0)
|
||||||
rubocop (>= 0.37)
|
rubocop (>= 0.37)
|
||||||
ruby-progressbar (1.8.1)
|
ruby-progressbar (1.9.0)
|
||||||
ruby_dep (1.5.0)
|
ruby_dep (1.5.0)
|
||||||
ruby_parser (3.10.1)
|
ruby_parser (3.10.1)
|
||||||
sexp_processor (~> 4.9)
|
sexp_processor (~> 4.9)
|
||||||
|
@ -660,10 +670,10 @@ GEM
|
||||||
i18n
|
i18n
|
||||||
json (>= 1.4.3)
|
json (>= 1.4.3)
|
||||||
sysexits (1.2.0)
|
sysexits (1.2.0)
|
||||||
therubyracer (0.12.2)
|
therubyracer (0.12.3)
|
||||||
libv8 (~> 3.16.14.0)
|
libv8 (~> 3.16.14.15)
|
||||||
ref
|
ref
|
||||||
thor (0.19.4)
|
thor (0.20.0)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.8)
|
tilt (2.0.8)
|
||||||
timecop (0.8.1)
|
timecop (0.8.1)
|
||||||
|
@ -674,12 +684,12 @@ GEM
|
||||||
turbolinks-source (5.0.0)
|
turbolinks-source (5.0.0)
|
||||||
tzinfo (1.2.4)
|
tzinfo (1.2.4)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (3.0.4)
|
uglifier (4.1.3)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
unf (0.1.4)
|
unf (0.1.4)
|
||||||
unf_ext
|
unf_ext
|
||||||
unf_ext (0.0.7.2)
|
unf_ext (0.0.7.4)
|
||||||
unicode-display_width (1.2.1)
|
unicode-display_width (1.3.0)
|
||||||
unicode_utils (1.4.0)
|
unicode_utils (1.4.0)
|
||||||
unicorn (5.2.0)
|
unicorn (5.2.0)
|
||||||
kgio (~> 2.6)
|
kgio (~> 2.6)
|
||||||
|
@ -692,8 +702,6 @@ GEM
|
||||||
activemodel (>= 3.0.0)
|
activemodel (>= 3.0.0)
|
||||||
addressable
|
addressable
|
||||||
vcr (3.0.3)
|
vcr (3.0.3)
|
||||||
warden (1.2.6)
|
|
||||||
rack (>= 1.0)
|
|
||||||
web-console (3.4.0)
|
web-console (3.4.0)
|
||||||
actionview (>= 5.0)
|
actionview (>= 5.0)
|
||||||
activemodel (>= 5.0)
|
activemodel (>= 5.0)
|
||||||
|
@ -804,6 +812,7 @@ DEPENDENCIES
|
||||||
unicode_utils
|
unicode_utils
|
||||||
unicorn
|
unicorn
|
||||||
vcr
|
vcr
|
||||||
|
warden!
|
||||||
web-console
|
web-console
|
||||||
webmock
|
webmock
|
||||||
xray-rails
|
xray-rails
|
||||||
|
|
|
@ -21,6 +21,9 @@ Téléprocédures Simplifiées, ou TPS pour les intimes, est une plateforme 100
|
||||||
### Tests
|
### Tests
|
||||||
|
|
||||||
- Chrome
|
- Chrome
|
||||||
|
- chromedriver :
|
||||||
|
* Mac : `brew install chromedriver`
|
||||||
|
* Linux : voir https://sites.google.com/a/chromium.org/chromedriver/downloads
|
||||||
|
|
||||||
|
|
||||||
## Initialisation de l'environnement de développement
|
## Initialisation de l'environnement de développement
|
||||||
|
@ -116,7 +119,7 @@ Pour exécuter les tests de l'application, plusieurs possibilités :
|
||||||
|
|
||||||
## Linting
|
## Linting
|
||||||
|
|
||||||
- Faire tourner RuboCop : `bundle exec rubocop -R`
|
- Faire tourner RuboCop : `bundle exec rubocop`
|
||||||
- Faire tourner Brakeman : `bundle exec brakeman -z`
|
- Faire tourner Brakeman : `bundle exec brakeman -z`
|
||||||
- Linter les fichiers HAML : `bundle exec haml-lint app/views/`
|
- Linter les fichiers HAML : `bundle exec haml-lint app/views/`
|
||||||
- Linter les fichiers SCSS : `bundle exec scss-lint app/assets/stylesheets/`
|
- Linter les fichiers SCSS : `bundle exec scss-lint app/assets/stylesheets/`
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Admin::TypesDeChampController < AdminController
|
||||||
create_facade
|
create_facade
|
||||||
render 'show', format: :js
|
render 'show', format: :js
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render json: {message: 'Champ not found'}, status: 404
|
render json: { message: 'Champ not found' }, status: 404
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Admin::TypesDeChampPrivateController < AdminController
|
||||||
create_facade
|
create_facade
|
||||||
render 'admin/types_de_champ/show', format: :js
|
render 'admin/types_de_champ/show', format: :js
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render json: {message: 'Champ not found'}, status: 404
|
render json: { message: 'Champ not found' }, status: 404
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Administrations::OmniauthCallbacksController < Devise::OmniauthCallbacksCo
|
||||||
administration = Administration.from_omniauth(request.env["omniauth.auth"])
|
administration = Administration.from_omniauth(request.env["omniauth.auth"])
|
||||||
if administration.present?
|
if administration.present?
|
||||||
sign_in administration
|
sign_in administration
|
||||||
redirect_to administrations_path
|
redirect_to manager_administrateurs_path
|
||||||
else
|
else
|
||||||
flash[:alert] = "Compte GitHub non autorisé"
|
flash[:alert] = "Compte GitHub non autorisé"
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
class AdministrationsController < ApplicationController
|
|
||||||
include SmartListing::Helper::ControllerExtensions
|
|
||||||
helper SmartListing::Helper
|
|
||||||
|
|
||||||
before_action :authenticate_administration!
|
|
||||||
|
|
||||||
def index
|
|
||||||
@admin = Administrateur.new
|
|
||||||
|
|
||||||
@admins = smart_listing_create :admins,
|
|
||||||
Administrateur.all.order(:email),
|
|
||||||
partial: "administrations/list",
|
|
||||||
array: true
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
administrateur = current_administration.invite_admin(create_administrateur_params[:email])
|
|
||||||
|
|
||||||
if administrateur.errors.empty?
|
|
||||||
flash.notice = "Administrateur créé"
|
|
||||||
else
|
|
||||||
flash.alert = administrateur.errors.full_messages
|
|
||||||
end
|
|
||||||
|
|
||||||
redirect_to administrations_path
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
|
||||||
Administrateur.find_inactive_by_id(params[:id]).invite!
|
|
||||||
|
|
||||||
redirect_to administrations_path
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def create_administrateur_params
|
|
||||||
params.require(:administrateur).permit(:email)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -8,7 +8,7 @@ class API::V1::ProceduresController < APIController
|
||||||
def show
|
def show
|
||||||
procedure = current_administrateur.procedures.find(params[:id]).decorate
|
procedure = current_administrateur.procedures.find(params[:id]).decorate
|
||||||
|
|
||||||
render json: {procedure: ProcedureSerializer.new(procedure).as_json}
|
render json: { procedure: ProcedureSerializer.new(procedure).as_json }
|
||||||
rescue ActiveRecord::RecordNotFound => e
|
rescue ActiveRecord::RecordNotFound => e
|
||||||
Rails.logger.error(e.message)
|
Rails.logger.error(e.message)
|
||||||
render json: {}, status: 404
|
render json: {}, status: 404
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_url_options
|
def default_url_options
|
||||||
return {protocol: 'https'} if Rails.env.staging? || Rails.env.production?
|
return { protocol: 'https' } if Rails.env.staging? || Rails.env.production?
|
||||||
{}
|
{}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,6 @@ class Ban::SearchController < ApplicationController
|
||||||
lat = point.y.to_s
|
lat = point.y.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {lon: lon, lat: lat, zoom: '14', dossier_id: params[:dossier_id]}
|
render json: { lon: lon, lat: lat, zoom: '14', dossier_id: params[:dossier_id] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,16 +1,4 @@
|
||||||
class CommentairesController < ApplicationController
|
class CommentairesController < ApplicationController
|
||||||
def index
|
|
||||||
@facade = DossierFacades.new(
|
|
||||||
params[:dossier_id],
|
|
||||||
(current_gestionnaire || current_user).email,
|
|
||||||
params[:champs_id]
|
|
||||||
)
|
|
||||||
render layout: false
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
|
||||||
flash.alert = t('errors.messages.dossier_not_found')
|
|
||||||
redirect_to url_for(controller: '/')
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@commentaire = Commentaire.new
|
@commentaire = Commentaire.new
|
||||||
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id]
|
@commentaire.champ = @commentaire.dossier.champs.find(params[:champ_id]) if params[:champ_id]
|
||||||
|
|
|
@ -1,87 +1,39 @@
|
||||||
class FranceConnect::ParticulierController < ApplicationController
|
class FranceConnect::ParticulierController < ApplicationController
|
||||||
|
before_action :redirect_to_login_if_fc_aborted, only: [:callback]
|
||||||
|
|
||||||
def login
|
def login
|
||||||
redirect_to FranceConnectService.authorization_uri
|
redirect_to FranceConnectService.authorization_uri
|
||||||
end
|
end
|
||||||
|
|
||||||
def callback
|
def callback
|
||||||
if params[:code].nil?
|
fetched_fci = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
||||||
return redirect_to new_user_session_path
|
|
||||||
|
fci = FranceConnectInformation
|
||||||
|
.find_by(france_connect_particulier_id: fetched_fci[:france_connect_particulier_id]) ||
|
||||||
|
fetched_fci.tap { |object| object.save }
|
||||||
|
|
||||||
|
if fci.user.nil?
|
||||||
|
user = User.find_or_create_by(email: fci.email_france_connect) do |new_user|
|
||||||
|
new_user.password = Devise.friendly_token[0, 20]
|
||||||
end
|
end
|
||||||
|
|
||||||
fetched_fc_information = FranceConnectService.retrieve_user_informations_particulier(params[:code])
|
fci.update_attribute('user_id', user.id)
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation
|
|
||||||
.find_by(france_connect_particulier_id: fetched_fc_information[:france_connect_particulier_id])
|
|
||||||
|
|
||||||
if france_connect_information.nil?
|
|
||||||
fetched_fc_information.save
|
|
||||||
france_connect_information = fetched_fc_information
|
|
||||||
end
|
end
|
||||||
|
|
||||||
user = france_connect_information.user
|
connect_france_connect_particulier(fci.user)
|
||||||
salt = FranceConnectSaltService.new(france_connect_information).salt
|
|
||||||
|
|
||||||
if user.nil?
|
|
||||||
redirect_to france_connect_particulier_new_path(fci_id: france_connect_information.id, salt: salt)
|
|
||||||
else
|
|
||||||
connect_france_connect_particulier(user)
|
|
||||||
end
|
|
||||||
rescue Rack::OAuth2::Client::Error => e
|
rescue Rack::OAuth2::Client::Error => e
|
||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
redirect_france_connect_error_connection
|
redirect_france_connect_error_connection
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
|
||||||
return redirect_france_connect_error_connection if !valid_salt_and_fci_id_params?
|
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
|
||||||
@user = User.new(france_connect_information: france_connect_information).decorate
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
|
||||||
redirect_france_connect_error_connection
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_email
|
|
||||||
return redirect_france_connect_error_connection if !valid_salt_and_fci_id_params?
|
|
||||||
|
|
||||||
user = User.find_by_email(params[:user][:email_france_connect])
|
|
||||||
|
|
||||||
return create if user.nil?
|
|
||||||
|
|
||||||
if params[:user][:password].present?
|
|
||||||
|
|
||||||
if user.valid_password?(params[:user][:password])
|
|
||||||
user.france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
|
||||||
|
|
||||||
return connect_france_connect_particulier user
|
|
||||||
else
|
|
||||||
flash.now.alert = 'Mot de passe invalide'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
|
||||||
france_connect_information.update_attribute(:email_france_connect, params[:user][:email_france_connect])
|
|
||||||
|
|
||||||
@user = User.new(france_connect_information: france_connect_information).decorate
|
|
||||||
end
|
|
||||||
|
|
||||||
def create
|
|
||||||
user = User.new email: params[:user][:email_france_connect]
|
|
||||||
user.password = Devise.friendly_token[0, 20]
|
|
||||||
|
|
||||||
if !user.valid?
|
|
||||||
flash.alert = 'Email non valide'
|
|
||||||
|
|
||||||
return redirect_to france_connect_particulier_new_path fci_id: params[:fci_id], salt: params[:salt], user: {email_france_connect: params[:user]['email_france_connect']}
|
|
||||||
end
|
|
||||||
|
|
||||||
user.save
|
|
||||||
FranceConnectInformation.find(params[:fci_id]).update_attribute(:user, user)
|
|
||||||
|
|
||||||
connect_france_connect_particulier user
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def redirect_to_login_if_fc_aborted
|
||||||
|
if params[:code].empty?
|
||||||
|
redirect_to new_user_session_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def connect_france_connect_particulier user
|
def connect_france_connect_particulier user
|
||||||
sign_out :user if user_signed_in?
|
sign_out :user if user_signed_in?
|
||||||
sign_out :gestionnaire if gestionnaire_signed_in?
|
sign_out :gestionnaire if gestionnaire_signed_in?
|
||||||
|
@ -89,19 +41,13 @@ class FranceConnect::ParticulierController < ApplicationController
|
||||||
|
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
||||||
user.loged_in_with_france_connect = 'particulier'
|
user.update_attribute('loged_in_with_france_connect', 'particulier')
|
||||||
user.save
|
|
||||||
|
|
||||||
redirect_to stored_location_for(current_user) || signed_in_root_path(current_user)
|
redirect_to stored_location_for(current_user) || root_path(current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_france_connect_error_connection
|
def redirect_france_connect_error_connection
|
||||||
flash.alert = t('errors.messages.france_connect.connexion')
|
flash.alert = t('errors.messages.france_connect.connexion')
|
||||||
redirect_to(new_user_session_path)
|
redirect_to(new_user_session_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_salt_and_fci_id_params?
|
|
||||||
france_connect_information = FranceConnectInformation.find(params[:fci_id])
|
|
||||||
FranceConnectSaltService.new(france_connect_information).valid? params[:salt]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,21 +1,28 @@
|
||||||
module Manager
|
module Manager
|
||||||
class AdministrateursController < Manager::ApplicationController
|
class AdministrateursController < Manager::ApplicationController
|
||||||
# To customize the behavior of this controller,
|
def create
|
||||||
# simply overwrite any of the RESTful actions. For example:
|
administrateur = current_administration.invite_admin(create_administrateur_params[:email])
|
||||||
#
|
|
||||||
# def index
|
|
||||||
# super
|
|
||||||
# @resources = Administrateur.
|
|
||||||
# page(params[:page]).
|
|
||||||
# per(10)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Define a custom finder by overriding the `find_resource` method:
|
if administrateur.errors.empty?
|
||||||
# def find_resource(param)
|
flash.notice = "Administrateur créé"
|
||||||
# Administrateur.find_by!(slug: param)
|
redirect_to manager_administrateurs_path
|
||||||
# end
|
else
|
||||||
|
render :new, locals: {
|
||||||
|
page: Administrate::Page::Form.new(dashboard, administrateur),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# See https://administrate-prototype.herokuapp.com/customizing_controller_actions
|
def reinvite
|
||||||
# for more information
|
Administrateur.find_inactive_by_id(params[:id]).invite!
|
||||||
|
flash.notice = "Invitation renvoyée"
|
||||||
|
redirect_to manager_administrateur_path(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def create_administrateur_params
|
||||||
|
params.require(:administrateur).permit(:email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
# All Administrate controllers inherit from this `Admin::ApplicationController`,
|
|
||||||
# making it the ideal place to put authentication logic or other
|
|
||||||
# before_actions.
|
|
||||||
#
|
|
||||||
# If you want to add pagination or other controller-level concerns,
|
|
||||||
# you're free to overwrite the RESTful controller actions.
|
|
||||||
module Manager
|
module Manager
|
||||||
class ApplicationController < Administrate::ApplicationController
|
class ApplicationController < Administrate::ApplicationController
|
||||||
before_action :authenticate_administration!
|
before_action :authenticate_administration!
|
||||||
before_action :default_params
|
before_action :default_params
|
||||||
|
|
||||||
# Override this value to specify the number of elements to display at a time
|
|
||||||
# on index pages. Defaults to 20.
|
|
||||||
# def records_per_page
|
|
||||||
# params[:per_page] || 20
|
|
||||||
# end
|
|
||||||
|
|
||||||
def default_params
|
def default_params
|
||||||
params[:order] ||= "created_at"
|
params[:order] ||= "created_at"
|
||||||
params[:direction] ||= "desc"
|
params[:direction] ||= "desc"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def authenticate_administration!
|
||||||
|
if administration_signed_in?
|
||||||
|
super
|
||||||
|
else
|
||||||
|
redirect_to manager_sign_in_path
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -271,7 +271,7 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
when 'self'
|
when 'self'
|
||||||
order = "dossiers.#{column} #{order}"
|
order = "dossiers.#{column} #{order}"
|
||||||
when'france_connect_information'
|
when 'france_connect_information'
|
||||||
includes = { user: :france_connect_information }
|
includes = { user: :france_connect_information }
|
||||||
order = "france_connect_informations.#{column} #{order}"
|
order = "france_connect_informations.#{column} #{order}"
|
||||||
when 'type_de_champ', 'type_de_champ_private'
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
|
@ -315,7 +315,7 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
end.each do |group_key, fields|
|
end.each do |group_key, fields|
|
||||||
case group_key
|
case group_key
|
||||||
when'france_connect_information'
|
when 'france_connect_information'
|
||||||
@dossiers = @dossiers.includes({ user: :france_connect_information })
|
@dossiers = @dossiers.includes({ user: :france_connect_information })
|
||||||
when 'type_de_champ_group'
|
when 'type_de_champ_group'
|
||||||
if fields.any? { |field| field['table'] == 'type_de_champ' }
|
if fields.any? { |field| field['table'] == 'type_de_champ' }
|
||||||
|
|
|
@ -9,7 +9,7 @@ class RootController < ApplicationController
|
||||||
elsif user_signed_in?
|
elsif user_signed_in?
|
||||||
return redirect_to users_dossiers_path
|
return redirect_to users_dossiers_path
|
||||||
elsif administration_signed_in?
|
elsif administration_signed_in?
|
||||||
return redirect_to administrations_path
|
return redirect_to manager_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
render 'landing'
|
render 'landing'
|
||||||
|
|
|
@ -64,7 +64,7 @@ class StatsController < ApplicationController
|
||||||
.count
|
.count
|
||||||
.to_a
|
.to_a
|
||||||
.sort_by { |a| a[0] }
|
.sort_by { |a| a[0] }
|
||||||
.map { |x, y| { x => (sum += y)} }
|
.map { |x, y| { x => (sum += y) } }
|
||||||
.reduce({}, :merge)
|
.reduce({}, :merge)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -48,15 +48,15 @@ class Users::CarteController < UsersController
|
||||||
lat = point.y.to_s
|
lat = point.y.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: {lon: lon, lat: lat, zoom: zoom, dossier_id: params[:dossier_id]}
|
render json: { lon: lon, lat: lat, zoom: zoom, dossier_id: params[:dossier_id] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_qp
|
def get_qp
|
||||||
render json: {quartier_prioritaires: ModuleApiCartoService.generate_qp(JSON.parse(params[:coordinates]))}
|
render json: { quartier_prioritaires: ModuleApiCartoService.generate_qp(JSON.parse(params[:coordinates])) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_cadastre
|
def get_cadastre
|
||||||
render json: {cadastres: ModuleApiCartoService.generate_cadastre(JSON.parse(params[:coordinates]))}
|
render json: { cadastres: ModuleApiCartoService.generate_cadastre(JSON.parse(params[:coordinates])) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.route_authorization
|
def self.route_authorization
|
||||||
|
|
|
@ -181,7 +181,7 @@ class Users::DossiersController < UsersController
|
||||||
flash.alert = t('errors.messages.invalid_siret')
|
flash.alert = t('errors.messages.invalid_siret')
|
||||||
@facade = facade params[:dossier_id]
|
@facade = facade params[:dossier_id]
|
||||||
|
|
||||||
render '/dossiers/new_siret', formats: :js, locals: {invalid_siret: siret}
|
render '/dossiers/new_siret', formats: :js, locals: { invalid_siret: siret }
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_params
|
def update_params
|
||||||
|
|
|
@ -5,7 +5,7 @@ class UsersController < ApplicationController
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user_dossier dossier_id=nil
|
def current_user_dossier dossier_id = nil
|
||||||
dossier_id ||= params[:dossier_id] || params[:id]
|
dossier_id ||= params[:dossier_id] || params[:id]
|
||||||
|
|
||||||
dossier = Dossier.find(dossier_id)
|
dossier = Dossier.find(dossier_id)
|
||||||
|
|
|
@ -12,7 +12,9 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
email: Field::String,
|
email: Field::String,
|
||||||
created_at: Field::DateTime,
|
created_at: Field::DateTime,
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
procedures: Field::HasMany,
|
procedures: Field::HasMany.with_options(limit: 20),
|
||||||
|
registration_state: Field::String.with_options(searchable: false),
|
||||||
|
current_sign_in_at: Field::DateTime,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
# COLLECTION_ATTRIBUTES
|
# COLLECTION_ATTRIBUTES
|
||||||
|
@ -24,6 +26,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
:email,
|
:email,
|
||||||
:created_at,
|
:created_at,
|
||||||
:procedures,
|
:procedures,
|
||||||
|
:registration_state,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# SHOW_PAGE_ATTRIBUTES
|
# SHOW_PAGE_ATTRIBUTES
|
||||||
|
@ -33,13 +36,17 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
:email,
|
:email,
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
|
:registration_state,
|
||||||
|
:current_sign_in_at,
|
||||||
:procedures,
|
:procedures,
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# FORM_ATTRIBUTES
|
# FORM_ATTRIBUTES
|
||||||
# an array of attributes that will be displayed
|
# an array of attributes that will be displayed
|
||||||
# on the model's form (`new` and `edit`) pages.
|
# on the model's form (`new` and `edit`) pages.
|
||||||
FORM_ATTRIBUTES = [].freeze
|
FORM_ATTRIBUTES = [
|
||||||
|
:email
|
||||||
|
].freeze
|
||||||
|
|
||||||
# Overwrite this method to customize how procedures are displayed
|
# Overwrite this method to customize how procedures are displayed
|
||||||
# across all pages of the admin dashboard.
|
# across all pages of the admin dashboard.
|
||||||
|
|
|
@ -24,7 +24,7 @@ class DossierDecorator < Draper::Decorator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.case_state_fr state=self.state
|
def self.case_state_fr state = self.state
|
||||||
h.t("activerecord.attributes.dossier.state.#{state}")
|
h.t("activerecord.attributes.dossier.state.#{state}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,12 +4,12 @@ class CARTO::SGMAP::API
|
||||||
|
|
||||||
def self.search_qp(geojson)
|
def self.search_qp(geojson)
|
||||||
endpoint = "/quartiers-prioritaires/search"
|
endpoint = "/quartiers-prioritaires/search"
|
||||||
call(base_url + endpoint, {geojson: geojson.to_s})
|
call(base_url + endpoint, { geojson: geojson.to_s })
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.search_cadastre(geojson)
|
def self.search_cadastre(geojson)
|
||||||
endpoint = "/cadastre/geometrie"
|
endpoint = "/cadastre/geometrie"
|
||||||
call(base_url + endpoint, {geojson: geojson.to_s})
|
call(base_url + endpoint, { geojson: geojson.to_s })
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Avis < ApplicationRecord
|
||||||
default_scope { joins(:dossier) }
|
default_scope { joins(:dossier) }
|
||||||
scope :with_answer, -> { where.not(answer: nil) }
|
scope :with_answer, -> { where.not(answer: nil) }
|
||||||
scope :without_answer, -> { where(answer: nil) }
|
scope :without_answer, -> { where(answer: nil) }
|
||||||
scope :for_dossier, ->(dossier_id) { where(dossier_id: dossier_id) }
|
scope :for_dossier, -> (dossier_id) { where(dossier_id: dossier_id) }
|
||||||
scope :by_latest, -> { order(updated_at: :desc) }
|
scope :by_latest, -> { order(updated_at: :desc) }
|
||||||
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
scope :updated_since?, -> (date) { where('avis.updated_at > ?', date) }
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class Cerfa < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
mount_uploader :content, CerfaUploader
|
mount_uploader :content, CerfaUploader
|
||||||
validates :content, :file_size => {:maximum => 20.megabytes}
|
validates :content, :file_size => { :maximum => 20.megabytes }
|
||||||
|
|
||||||
after_save :internal_notification, if: Proc.new { dossier.present? }
|
after_save :internal_notification, if: Proc.new { dossier.present? }
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class Dossier < ActiveRecord::Base
|
||||||
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction }
|
||||||
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
scope :without_followers, -> { left_outer_joins(:follows).where(follows: { id: nil }) }
|
||||||
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
scope :with_unread_notifications, -> { where(notifications: { already_read: false }) }
|
||||||
scope :followed_by , -> (gestionnaire) { joins(:follows).where(follows: { gestionnaire: gestionnaire }) }
|
scope :followed_by, -> (gestionnaire) { joins(:follows).where(follows: { gestionnaire: gestionnaire }) }
|
||||||
|
|
||||||
accepts_nested_attributes_for :individual
|
accepts_nested_attributes_for :individual
|
||||||
|
|
||||||
|
@ -273,9 +273,9 @@ class Dossier < ActiveRecord::Base
|
||||||
when 'etablissement'
|
when 'etablissement'
|
||||||
self.etablissement&.send(column)
|
self.etablissement&.send(column)
|
||||||
when 'type_de_champ'
|
when 'type_de_champ'
|
||||||
self.champs.find {|c| c.type_de_champ_id == column.to_i }.value
|
self.champs.find { |c| c.type_de_champ_id == column.to_i }.value
|
||||||
when 'type_de_champ_private'
|
when 'type_de_champ_private'
|
||||||
self.champs_private.find {|c| c.type_de_champ_id == column.to_i }.value
|
self.champs_private.find { |c| c.type_de_champ_id == column.to_i }.value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ class Gestionnaire < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
couples.include?({table: table, column: column})
|
couples.include?({ table: table, column: column })
|
||||||
end
|
end
|
||||||
|
|
||||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PieceJustificative < ActiveRecord::Base
|
||||||
alias_attribute :type, :type_de_piece_justificative_id
|
alias_attribute :type, :type_de_piece_justificative_id
|
||||||
|
|
||||||
mount_uploader :content, PieceJustificativeUploader
|
mount_uploader :content, PieceJustificativeUploader
|
||||||
validates :content, :file_size => {:maximum => 20.megabytes}
|
validates :content, :file_size => { :maximum => 20.megabytes }
|
||||||
validates :content, presence: true, allow_blank: false, allow_nil: false
|
validates :content, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
||||||
after_save :internal_notification, if: Proc.new { dossier.present? }
|
after_save :internal_notification, if: Proc.new { dossier.present? }
|
||||||
|
|
|
@ -220,14 +220,14 @@ class Procedure < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
types_de_champ
|
types_de_champ
|
||||||
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ ) }
|
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ) }
|
||||||
.each do |type_de_champ|
|
.each do |type_de_champ|
|
||||||
|
|
||||||
fields << field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s)
|
fields << field_hash(type_de_champ.libelle, 'type_de_champ', type_de_champ.id.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
types_de_champ_private
|
types_de_champ_private
|
||||||
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ ) }
|
.reject { |tdc| ['header_section', 'explication'].include?(tdc.type_champ) }
|
||||||
.each do |type_de_champ|
|
.each do |type_de_champ|
|
||||||
|
|
||||||
fields << field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s)
|
fields << field_hash(type_de_champ.libelle, 'type_de_champ_private', type_de_champ.id.to_s)
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
class FranceConnectSaltService
|
|
||||||
attr_reader :model
|
|
||||||
|
|
||||||
def initialize france_connect_information
|
|
||||||
raise 'Not a FranceConnectInformation class' if france_connect_information.class != FranceConnectInformation
|
|
||||||
@model = france_connect_information
|
|
||||||
end
|
|
||||||
|
|
||||||
def valid? test_salt
|
|
||||||
salt == test_salt
|
|
||||||
end
|
|
||||||
|
|
||||||
def salt
|
|
||||||
Digest::MD5.hexdigest(model.france_connect_particulier_id + model.given_name + model.family_name + FRANCE_CONNECT[:particulier][:secret] + DateTime.now.to_date.to_s)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +1,5 @@
|
||||||
class NotificationService
|
class NotificationService
|
||||||
def initialize type_notif, dossier_id, attribut_change=''
|
def initialize type_notif, dossier_id, attribut_change = ''
|
||||||
@type_notif = type_notif
|
@type_notif = type_notif
|
||||||
@dossier_id = dossier_id
|
@dossier_id = dossier_id
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class NotificationService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_for_notif attribut=''
|
def text_for_notif attribut = ''
|
||||||
case @type_notif
|
case @type_notif
|
||||||
when 'commentaire'
|
when 'commentaire'
|
||||||
"#{notification.liste.size + 1} nouveau(x) commentaire(s) déposé(s)."
|
"#{notification.liste.size + 1} nouveau(x) commentaire(s) déposé(s)."
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class TypesDeChampService
|
class TypesDeChampService
|
||||||
def self.create_update_procedure_params(params, private=false)
|
def self.create_update_procedure_params(params, private = false)
|
||||||
attributes = (private ? 'types_de_champ_private_attributes' : 'types_de_champ_attributes')
|
attributes = (private ? 'types_de_champ_private_attributes' : 'types_de_champ_attributes')
|
||||||
|
|
||||||
params_with_ordered_champs = order_champs(params, attributes)
|
params_with_ordered_champs = order_champs(params, attributes)
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
.card
|
|
||||||
- if smart_listing.present?
|
|
||||||
%table.table
|
|
||||||
%thead
|
|
||||||
%th.col-xs-4= smart_listing.sortable 'Email', :email
|
|
||||||
%th.col-xs-4= smart_listing.sortable 'Date de dernière connexion', :last_sign_in_at
|
|
||||||
%th.col-xs-2 État
|
|
||||||
%th.col-xs-2 Procédure active
|
|
||||||
%th.col-xs-2 Dossier en cours
|
|
||||||
|
|
||||||
- @admins.each do |admin|
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= admin.email
|
|
||||||
%td
|
|
||||||
- if admin.last_sign_in_at.present?
|
|
||||||
= time_ago_in_words(l(admin.last_sign_in_at, format: "%d/%m/%Y %H:%M UTC +02:00"))
|
|
||||||
(
|
|
||||||
= admin.last_sign_in_at.localtime.strftime('%d/%m/%Y')
|
|
||||||
)
|
|
||||||
%td
|
|
||||||
- if admin.invitation_expired?
|
|
||||||
= link_to admin.registration_state, administration_path(admin), remote: true, method: :patch
|
|
||||||
- else
|
|
||||||
= admin.registration_state
|
|
||||||
%td
|
|
||||||
= admin.procedures.publiees.count
|
|
||||||
%td
|
|
||||||
- total_dossier = 0
|
|
||||||
- admin.procedures.each do |procedure| total_dossier += procedure.dossiers.state_not_brouillon.count end
|
|
||||||
= total_dossier
|
|
||||||
= smart_listing.paginate
|
|
||||||
= smart_listing.pagination_per_page_links
|
|
||||||
|
|
||||||
- else
|
|
||||||
%h4.center
|
|
||||||
Aucun administrateur créé
|
|
|
@ -1,15 +0,0 @@
|
||||||
.container
|
|
||||||
.mt-1
|
|
||||||
= form_for @admin, url: { controller: 'administrations', action: :create } do |f|
|
|
||||||
.form-group.form-inline.text-center
|
|
||||||
= f.text_field :email, placeholder: :email, class: 'form-control'
|
|
||||||
|
|
||||||
= f.submit 'Créer un administrateur', class: 'btn btn-success', id: 'submit_new_administrateur'
|
|
||||||
|
|
||||||
= smart_listing_render :admins
|
|
||||||
|
|
||||||
%br
|
|
||||||
%br
|
|
||||||
|
|
||||||
.text-center
|
|
||||||
= link_to 'Deconnexion', administrations_sign_out_path, method: :delete
|
|
|
@ -1 +0,0 @@
|
||||||
<%= smart_listing_update :admins %>
|
|
|
@ -1,23 +0,0 @@
|
||||||
%h2.text-info
|
|
||||||
= image_tag('logo_FC_02_small.png', style: 'height: 55px;')
|
|
||||||
France Connect - Particulier
|
|
||||||
|
|
||||||
%h3 Nouvelle connexion
|
|
||||||
%h4.text-warning{ style: 'margin-left: 20px;' } Email déjà utilisé
|
|
||||||
|
|
||||||
%br
|
|
||||||
%p
|
|
||||||
%h4.center Nous avons trouvé un compte qui utilise déjà cette adresse email.
|
|
||||||
%p.center
|
|
||||||
Afin d'associer ce compte à votre identifiant France Connect, merci de saisir votre mot de passe TPS.
|
|
||||||
%br
|
|
||||||
.center
|
|
||||||
#france-connect-particulier-email
|
|
||||||
= form_for @user, url: { controller: 'france_connect/particulier', action: :check_email }, method: :post do |f|
|
|
||||||
.form-group.form-group-lg
|
|
||||||
= f.text_field :email_france_connect, class: "form-control", readonly: 'readonly'
|
|
||||||
%br
|
|
||||||
= f.password_field :password, class: "form-control", placeholder: "Entrez votre mot de passe"
|
|
||||||
= hidden_field_tag :fci_id, params[:fci_id]
|
|
||||||
= hidden_field_tag :salt, params[:salt]
|
|
||||||
= f.submit 'Terminer', class: %w(btn btn-lg btn-success), style: 'margin-top: 20px;', id: 'valid_new_fcp'
|
|
|
@ -1,32 +0,0 @@
|
||||||
%h2.text-info
|
|
||||||
= image_tag('logo_FC_02_small.png', style: 'height: 55px;')
|
|
||||||
France Connect - Particulier
|
|
||||||
|
|
||||||
%h3 Nouvelle connexion
|
|
||||||
|
|
||||||
%br
|
|
||||||
%p
|
|
||||||
Nous vous avons identifié comme étant
|
|
||||||
|
|
||||||
%h4.text-info.center
|
|
||||||
%strong
|
|
||||||
= @user.gender_fr
|
|
||||||
= @user.given_name
|
|
||||||
= @user.family_name
|
|
||||||
né le
|
|
||||||
%strong
|
|
||||||
= @user.birthdate_fr
|
|
||||||
|
|
||||||
%br
|
|
||||||
%h4
|
|
||||||
Afin de finaliser votre première connexion à TPS, merci de saisir un email valide :
|
|
||||||
%br
|
|
||||||
|
|
||||||
.center
|
|
||||||
#france-connect-particulier-email
|
|
||||||
= form_for @user, url: { controller: 'france_connect/particulier', action: :check_email }, method: :post do |f|
|
|
||||||
.form-group.form-group-lg
|
|
||||||
= f.text_field :email_france_connect, class: "form-control", placeholder: "Entrez votre email"
|
|
||||||
= hidden_field_tag :fci_id, params[:fci_id]
|
|
||||||
= hidden_field_tag :salt, params[:salt]
|
|
||||||
= f.submit 'Terminer', class: %w(btn btn-lg btn-success), style: 'margin-top: 20px;', id: 'valid_new_fcp'
|
|
|
@ -45,7 +45,7 @@
|
||||||
= current_email
|
= current_email
|
||||||
- if administration_signed_in?
|
- if administration_signed_in?
|
||||||
%li
|
%li
|
||||||
= link_to administrations_path, class: "menu-item menu-link" do
|
= link_to manager_root_path, class: "menu-item menu-link" do
|
||||||
= image_tag "icons/super-admin.svg"
|
= image_tag "icons/super-admin.svg"
|
||||||
Passer en super-admin
|
Passer en super-admin
|
||||||
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
- if SwitchDeviseProfileService.new(warden).multiple_devise_profile_connect?
|
||||||
|
|
16
app/views/manager/administrateurs/index.html.haml
Normal file
16
app/views/manager/administrateurs/index.html.haml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
- content_for(:title) do
|
||||||
|
= display_resource_name(page.resource_name)
|
||||||
|
|
||||||
|
- content_for(:search) do
|
||||||
|
- if show_search_bar
|
||||||
|
= render "search", search_term: search_term
|
||||||
|
|
||||||
|
%header.header
|
||||||
|
%h1.header__heading#page-title
|
||||||
|
= content_for(:title)
|
||||||
|
.header__actions
|
||||||
|
= link_to 'nouveau', new_manager_administrateur_path, class: 'button'
|
||||||
|
|
||||||
|
= render "collection", collection_presenter: page, resources: resources
|
||||||
|
|
||||||
|
= paginate resources
|
15
app/views/manager/administrateurs/show.html.haml
Normal file
15
app/views/manager/administrateurs/show.html.haml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- content_for(:title) { page.page_title }
|
||||||
|
|
||||||
|
%header.header
|
||||||
|
%h1.header__heading= content_for(:title)
|
||||||
|
.header__actions
|
||||||
|
- if page.resource.invitation_expired?
|
||||||
|
= link_to "renvoyer l'invitation", reinvite_manager_administrateur_path(page.resource), method: :post, class: "button"
|
||||||
|
|
||||||
|
%dl
|
||||||
|
- page.attributes.each do |attribute|
|
||||||
|
%dt.attribute-label
|
||||||
|
= t("helpers.label.#{resource_name}.#{attribute.name}", default: attribute.name.titleize)
|
||||||
|
|
||||||
|
%dd.attribute-data{ class: "attribute-data--#{attribute.html_class}" }
|
||||||
|
= render_field attribute
|
|
@ -1,21 +1,3 @@
|
||||||
-# # Collection
|
|
||||||
-#
|
|
||||||
-# This partial is used on the `index` and `show` pages
|
|
||||||
-# to display a collection of resources in an HTML table.
|
|
||||||
-#
|
|
||||||
-# ## Local variables:
|
|
||||||
-#
|
|
||||||
-# - `collection_presenter`:
|
|
||||||
-# An instance of [Administrate::Page::Collection][1].
|
|
||||||
-# The table presenter uses `ResourceDashboard::COLLECTION_ATTRIBUTES` to determine
|
|
||||||
-# the columns displayed in the table
|
|
||||||
-# - `resources`:
|
|
||||||
-# An ActiveModel::Relation collection of resources to be displayed in the table.
|
|
||||||
-# By default, the number of resources is limited by pagination
|
|
||||||
-# or by a hard limit to prevent excessive page load times
|
|
||||||
-#
|
|
||||||
-# [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
|
|
||||||
|
|
||||||
%table.collection-data{ "aria-labelledby": "page-title" }
|
%table.collection-data{ "aria-labelledby": "page-title" }
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
|
|
@ -1,14 +1,3 @@
|
||||||
-# # Flash Partial
|
|
||||||
-#
|
|
||||||
-# This partial renders flash messages on every page.
|
|
||||||
-#
|
|
||||||
-# ## Relevant Helpers:
|
|
||||||
-#
|
|
||||||
-# - `flash`:
|
|
||||||
-# Returns a hash,
|
|
||||||
-# where the keys are the type of flash (alert, error, notice, etc)
|
|
||||||
-# and the values are the message to be displayed.
|
|
||||||
|
|
||||||
- if flash.any?
|
- if flash.any?
|
||||||
.flashes
|
.flashes
|
||||||
- flash.each do |key, value|
|
- flash.each do |key, value|
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
-# # Javascript Partial
|
|
||||||
-#
|
|
||||||
-# This partial imports the necessary javascript on each page.
|
|
||||||
-# By default, it includes the application JS,
|
|
||||||
-# but each page can define additional JS sources
|
|
||||||
-# by providing a `content_for(:javascript)` block.
|
|
||||||
|
|
||||||
- Administrate::Engine.javascripts.each do |js_path|
|
- Administrate::Engine.javascripts.each do |js_path|
|
||||||
= javascript_include_tag js_path
|
= javascript_include_tag js_path
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
-# # Sidebar
|
|
||||||
-#
|
|
||||||
-# This partial is used to display the sidebar in Administrate.
|
|
||||||
-# By default, the sidebar contains navigation links
|
|
||||||
-# for all resources in the admin dashboard,
|
|
||||||
-# as defined by the routes in the `admin/` namespace
|
|
||||||
|
|
||||||
%ul.sidebar__list
|
%ul.sidebar__list
|
||||||
%li
|
%li
|
||||||
= link_to "Se déconnecter", administrations_sign_out_path, method: :delete, class: "sidebar__link"
|
= link_to "Se déconnecter", manager_sign_out_path, method: :delete, class: "sidebar__link"
|
||||||
|
|
||||||
%hr{ style: "margin-bottom: 0;" }
|
%hr{ style: "margin-bottom: 0;" }
|
||||||
|
|
||||||
|
@ -15,3 +8,9 @@
|
||||||
- Administrate::Namespace.new(namespace).resources.each do |resource|
|
- Administrate::Namespace.new(namespace).resources.each do |resource|
|
||||||
%li
|
%li
|
||||||
= link_to(display_resource_name(resource), [namespace, resource], class: "sidebar__link sidebar__link--#{nav_link_state(resource)}")
|
= link_to(display_resource_name(resource), [namespace, resource], class: "sidebar__link sidebar__link--#{nav_link_state(resource)}")
|
||||||
|
|
||||||
|
%hr{ style: "margin-bottom: 0;" }
|
||||||
|
|
||||||
|
%ul.sidebar__list
|
||||||
|
%li
|
||||||
|
= link_to "Delayed Job", manager_delayed_job_path, class: "sidebar__link"
|
||||||
|
|
|
@ -1,26 +1,3 @@
|
||||||
-# # Index
|
|
||||||
-#
|
|
||||||
-# This view is the template for the index page.
|
|
||||||
-# It is responsible for rendering the search bar, header and pagination.
|
|
||||||
-# It renders the `_table` partial to display details about the resources.
|
|
||||||
-#
|
|
||||||
-# ## Local variables:
|
|
||||||
-#
|
|
||||||
-# - `page`:
|
|
||||||
-# An instance of [Administrate::Page::Collection][1].
|
|
||||||
-# Contains helper methods to help display a table,
|
|
||||||
-# and knows which attributes should be displayed in the resource's table.
|
|
||||||
-# - `resources`:
|
|
||||||
-# An instance of `ActiveRecord::Relation` containing the resources
|
|
||||||
-# that match the user's search criteria.
|
|
||||||
-# By default, these resources are passed to the table partial to be displayed.
|
|
||||||
-# - `search_term`:
|
|
||||||
-# A string containing the term the user has searched for, if any.
|
|
||||||
-# - `show_search_bar`:
|
|
||||||
-# A boolean that determines if the search bar should be shown.
|
|
||||||
-#
|
|
||||||
-# [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
|
|
||||||
|
|
||||||
- content_for(:title) do
|
- content_for(:title) do
|
||||||
= display_resource_name(page.resource_name)
|
= display_resource_name(page.resource_name)
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
-# # Show
|
|
||||||
-#
|
|
||||||
-# This view is the template for the show page.
|
|
||||||
-# It renders the attributes of a resource,
|
|
||||||
-# as well as a link to its edit page.
|
|
||||||
-#
|
|
||||||
-# ## Local variables:
|
|
||||||
-#
|
|
||||||
-# - `page`:
|
|
||||||
-# An instance of [Administrate::Page::Show][1].
|
|
||||||
-# Contains methods for accessing the resource to be displayed on the page,
|
|
||||||
-# as well as helpers for describing how each attribute of the resource
|
|
||||||
-# should be displayed.
|
|
||||||
-#
|
|
||||||
-# [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
|
|
||||||
|
|
||||||
- content_for(:title) { page.page_title }
|
- content_for(:title) { page.page_title }
|
||||||
|
|
||||||
%header.header
|
%header.header
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
-# # Show
|
|
||||||
-#
|
|
||||||
-# This view is the template for the show page.
|
|
||||||
-# It renders the attributes of a resource,
|
|
||||||
-# as well as a link to its edit page.
|
|
||||||
-#
|
|
||||||
-# ## Local variables:
|
|
||||||
-#
|
|
||||||
-# - `page`:
|
|
||||||
-# An instance of [Administrate::Page::Show][1].
|
|
||||||
-# Contains methods for accessing the resource to be displayed on the page,
|
|
||||||
-# as well as helpers for describing how each attribute of the resource
|
|
||||||
-# should be displayed.
|
|
||||||
-#
|
|
||||||
-# [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
|
|
||||||
|
|
||||||
- content_for(:title) { page.page_title }
|
- content_for(:title) { page.page_title }
|
||||||
- procedure = page.resource
|
- procedure = page.resource
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,17 @@
|
||||||
%th Statut
|
%th Statut
|
||||||
%tbody
|
%tbody
|
||||||
- @dossiers.each do |dossier|
|
- @dossiers.each do |dossier|
|
||||||
|
/ # FIXME: here we have a n+1, we fire a request
|
||||||
|
/ (due to dossier_linked_path) per result
|
||||||
%tr
|
%tr
|
||||||
%td.number-col
|
%td.number-col
|
||||||
= link_to(dossier_path(dossier.procedure, dossier), class: 'cell-link') do
|
= link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do
|
||||||
%span.icon.folder>
|
%span.icon.folder>
|
||||||
= dossier.id
|
= dossier.id
|
||||||
%td= link_to(dossier.procedure.libelle, dossier_path(dossier.procedure, dossier), class: 'cell-link')
|
%td= link_to(dossier.procedure.libelle, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link')
|
||||||
%td= link_to(dossier.user.email, dossier_path(dossier.procedure, dossier), class: 'cell-link')
|
%td= link_to(dossier.user.email, dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link')
|
||||||
%td.status-col
|
%td.status-col
|
||||||
= link_to(dossier_path(dossier.procedure, dossier), class: 'cell-link') do
|
= link_to(dossier_linked_path(current_gestionnaire, dossier), class: 'cell-link') do
|
||||||
= render partial: 'new_gestionnaire/procedures/status', locals: { dossier: dossier }
|
= render partial: 'new_gestionnaire/procedures/status', locals: { dossier: dossier }
|
||||||
- else
|
- else
|
||||||
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé
|
%h2 Aucun dossier correspondant à votre recherche n'a été trouvé
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
= render partial: '/users/recapitulatif/commentaires_flux'
|
|
|
@ -41,12 +41,12 @@ Devise.setup do |config|
|
||||||
# Configure which authentication keys should be case-insensitive.
|
# Configure which authentication keys should be case-insensitive.
|
||||||
# These keys will be downcased upon creating or modifying a user and when used
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
# to authenticate or find a user. Default is :email.
|
# to authenticate or find a user. Default is :email.
|
||||||
config.case_insensitive_keys = [ :email ]
|
config.case_insensitive_keys = [:email]
|
||||||
|
|
||||||
# Configure which authentication keys should have whitespace stripped.
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
# These keys will have whitespace before and after removed upon creating or
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
config.strip_whitespace_keys = [ :email ]
|
config.strip_whitespace_keys = [:email]
|
||||||
|
|
||||||
# Tell if authentication through request.params is enabled. True by default.
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
# It can be set to an array that will enable params authentication only for the
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
|
8
config/locales/models/administrateur/fr.yml
Normal file
8
config/locales/models/administrateur/fr.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fr:
|
||||||
|
activerecord:
|
||||||
|
errors:
|
||||||
|
models:
|
||||||
|
administrateur:
|
||||||
|
attributes:
|
||||||
|
email:
|
||||||
|
blank: 'doit être rempli'
|
|
@ -1,15 +1,23 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
get 'manager/sign_in' => 'administrations/sessions#new'
|
||||||
|
delete 'manager/sign_out' => 'administrations/sessions#destroy'
|
||||||
namespace :manager do
|
namespace :manager do
|
||||||
resources :procedures, only: [:index, :show] do
|
resources :procedures, only: [:index, :show] do
|
||||||
post 'whitelist', on: :member
|
post 'whitelist', on: :member
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :administrateurs, only: [:index, :show]
|
resources :administrateurs, only: [:index, :show, :new, :create] do
|
||||||
|
post 'reinvite', on: :member
|
||||||
root to: "procedures#index"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/ping" => "ping#index", :constraints => {:ip => /127.0.0.1/}
|
authenticate :administration do
|
||||||
|
match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]
|
||||||
|
end
|
||||||
|
|
||||||
|
root to: "administrateurs#index"
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/ping" => "ping#index", :constraints => { :ip => /127.0.0.1/ }
|
||||||
|
|
||||||
devise_for :administrations,
|
devise_for :administrations,
|
||||||
skip: [:password, :registrations, :sessions],
|
skip: [:password, :registrations, :sessions],
|
||||||
|
@ -52,23 +60,11 @@ Rails.application.routes.draw do
|
||||||
get 'users' => 'users#index'
|
get 'users' => 'users#index'
|
||||||
get 'admin' => 'admin#index'
|
get 'admin' => 'admin#index'
|
||||||
|
|
||||||
get 'administrations/sign_in' => 'administrations/sessions#new'
|
|
||||||
delete 'administrations/sign_out' => 'administrations/sessions#destroy'
|
|
||||||
authenticate :administration do
|
|
||||||
resources :administrations, only: [:index, :create, :update] do
|
|
||||||
match "/delayed_job" => DelayedJobWeb, :anchor => false, :via => [:get, :post]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
resources :stats, only: [:index]
|
resources :stats, only: [:index]
|
||||||
|
|
||||||
namespace :france_connect do
|
namespace :france_connect do
|
||||||
get 'particulier' => 'particulier#login'
|
get 'particulier' => 'particulier#login'
|
||||||
get 'particulier/callback' => 'particulier#callback'
|
get 'particulier/callback' => 'particulier#callback'
|
||||||
|
|
||||||
get 'particulier/new' => 'particulier#new'
|
|
||||||
post 'particulier/create' => 'particulier#create'
|
|
||||||
post 'particulier/check_email' => 'particulier#check_email'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :users do
|
namespace :users do
|
||||||
|
@ -90,7 +86,6 @@ Rails.application.routes.draw do
|
||||||
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
post '/recapitulatif/initiate' => 'recapitulatif#initiate'
|
||||||
|
|
||||||
post '/commentaire' => 'commentaires#create'
|
post '/commentaire' => 'commentaires#create'
|
||||||
resources :commentaires, only: [:index]
|
|
||||||
|
|
||||||
get '/carte/position' => 'carte#get_position'
|
get '/carte/position' => 'carte#get_position'
|
||||||
post '/carte/qp' => 'carte#get_qp'
|
post '/carte/qp' => 'carte#get_qp'
|
||||||
|
|
|
@ -43,7 +43,7 @@ class BuildDefaultPreferenceListDossier < ActiveRecord::Migration
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
couples.include?({table: table, column: column})
|
couples.include?({ table: table, column: column })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
has_many :assign_to, dependent: :destroy
|
has_many :assign_to, dependent: :destroy
|
||||||
has_many :procedures, through: :assign_to
|
has_many :procedures, through: :assign_to
|
||||||
|
|
||||||
def build_default_preferences_list_dossier procedure_id=nil
|
def build_default_preferences_list_dossier procedure_id = nil
|
||||||
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
|
PreferenceListDossier.available_columns_for(procedure_id).each do |table|
|
||||||
table.second.each do |column|
|
table.second.each do |column|
|
||||||
if valid_couple_table_attr? table.first, column.first
|
if valid_couple_table_attr? table.first, column.first
|
||||||
|
@ -141,7 +141,7 @@ class ResetAllPreferenceListDossier < ActiveRecord::Migration
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
couples.include?({table: table, column: column})
|
couples.include?({ table: table, column: column })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0]
|
||||||
all_mails = MailReceived.all
|
all_mails = MailReceived.all
|
||||||
groupped = all_mails.group_by { |m| m.procedure_id }
|
groupped = all_mails.group_by { |m| m.procedure_id }
|
||||||
filtered = groupped.reject { |k, v| v.length < 2 }
|
filtered = groupped.reject { |k, v| v.length < 2 }
|
||||||
filtered.each do |k, duplicate_mails|
|
filtered.each_value do |duplicate_mails|
|
||||||
duplicate_mails.pop
|
duplicate_mails.pop
|
||||||
duplicate_mails.each(&:destroy)
|
duplicate_mails.each(&:destroy)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
task set: :environment do
|
task set: :environment do
|
||||||
commentaires_to_process = Commentaire.where(file:nil).where.not(piece_justificative_id: nil).reorder(id: :desc)
|
commentaires_to_process = Commentaire.where(file: nil).where.not(piece_justificative_id: nil).reorder(id: :desc)
|
||||||
|
|
||||||
puts "#{commentaires_to_process.count} commentaires to process..."
|
puts "#{commentaires_to_process.count} commentaires to process..."
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace :'2017_10_30_copy_commentaire_piece_justificative_to_file' do
|
||||||
|
|
||||||
def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323
|
def sanitize_name(name) # from https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/sanitized_file.rb#L323
|
||||||
name = name.gsub(/[^[:word:]\.\-\+]/,"_")
|
name = name.gsub(/[^[:word:]\.\-\+]/,"_")
|
||||||
name = "_#{name}" if name =~ /\A\.+\z/
|
name = "_#{name}" if name.match?(/\A\.+\z/)
|
||||||
name = "unnamed" if name.size == 0
|
name = "unnamed" if name.size == 0
|
||||||
return name.mb_chars.to_s
|
return name.mb_chars.to_s
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace :'2017_12_21_replace_deprecated_mail_template_tags' do
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace_tag(old_tag, new_tag)
|
def replace_tag(old_tag, new_tag)
|
||||||
mails = [ Mails::ClosedMail, Mails::InitiatedMail, Mails::ReceivedMail, Mails::RefusedMail, Mails::WithoutContinuationMail]
|
mails = [Mails::ClosedMail, Mails::InitiatedMail, Mails::ReceivedMail, Mails::RefusedMail, Mails::WithoutContinuationMail]
|
||||||
mails.each do |mail|
|
mails.each do |mail|
|
||||||
replace_tag_in(mail, 'object', old_tag, new_tag)
|
replace_tag_in(mail, 'object', old_tag, new_tag)
|
||||||
replace_tag_in(mail, 'body', old_tag, new_tag)
|
replace_tag_in(mail, 'body', old_tag, new_tag)
|
||||||
|
|
|
@ -10,12 +10,12 @@ describe Admin::AccompagnateursController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
subject { get :show, params: {procedure_id: procedure.id} }
|
subject { get :show, params: { procedure_id: procedure.id } }
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT #update' do
|
describe 'PUT #update' do
|
||||||
subject { put :update, params: {accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign'} }
|
subject { put :update, params: { accompagnateur_id: gestionnaire.id, procedure_id: procedure.id, to: 'assign' } }
|
||||||
|
|
||||||
it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) }
|
it { expect(subject).to redirect_to admin_procedure_accompagnateurs_path(procedure_id: procedure.id) }
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:email) { 'test@plop.com' }
|
let(:email) { 'test@plop.com' }
|
||||||
let(:procedure_id) { nil }
|
let(:procedure_id) { nil }
|
||||||
subject { post :create, params: {gestionnaire: {email: email}, procedure_id: procedure_id} }
|
subject { post :create, params: { gestionnaire: { email: email }, procedure_id: procedure_id } }
|
||||||
|
|
||||||
context 'When email is valid' do
|
context 'When email is valid' do
|
||||||
before do
|
before do
|
||||||
|
@ -169,7 +169,7 @@ describe Admin::GestionnairesController, type: :controller do
|
||||||
let!(:admin) { create :administrateur }
|
let!(:admin) { create :administrateur }
|
||||||
let!(:gestionnaire) { create :gestionnaire, email: email, administrateurs: [admin] }
|
let!(:gestionnaire) { create :gestionnaire, email: email, administrateurs: [admin] }
|
||||||
|
|
||||||
subject { delete :destroy, params: {id: gestionnaire.id} }
|
subject { delete :destroy, params: { id: gestionnaire.id } }
|
||||||
|
|
||||||
context "when gestionaire_id is valid" do
|
context "when gestionaire_id is valid" do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe Admin::MailTemplatesController, type: :controller do
|
||||||
it { expect(response).to redirect_to admin_procedure_mail_templates_path(procedure) }
|
it { expect(response).to redirect_to admin_procedure_mail_templates_path(procedure) }
|
||||||
|
|
||||||
context 'the mail template' do
|
context 'the mail template' do
|
||||||
subject { procedure.reload ; procedure.initiated_mail_template }
|
subject { procedure.reload; procedure.initiated_mail_template }
|
||||||
|
|
||||||
it { expect(subject.subject).to eq(mail_subject) }
|
it { expect(subject.subject).to eq(mail_subject) }
|
||||||
it { expect(subject.body).to eq(mail_body) }
|
it { expect(subject.body).to eq(mail_body) }
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
|
|
||||||
subject { get :show, params: {procedure_id: procedure_id} }
|
subject { get :show, params: { procedure_id: procedure_id } }
|
||||||
|
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
let(:procedure_id) { 9_999_999 }
|
let(:procedure_id) { 9_999_999 }
|
||||||
|
@ -47,7 +47,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:request) { put :update, params: {procedure_id: procedure_id, format: :js, procedure: update_params} }
|
let(:request) { put :update, params: { procedure_id: procedure_id, format: :js, procedure: update_params } }
|
||||||
subject { request }
|
subject { request }
|
||||||
|
|
||||||
it { is_expected.to render_template('show') }
|
it { is_expected.to render_template('show') }
|
||||||
|
@ -75,7 +75,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
let!(:pj) { create(:type_de_piece_justificative, procedure: procedure) }
|
let!(:pj) { create(:type_de_piece_justificative, procedure: procedure) }
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
let(:pj_id) { pj.id }
|
let(:pj_id) { pj.id }
|
||||||
let(:request) { delete :destroy, params: {procedure_id: procedure_id, id: pj_id} }
|
let(:request) { delete :destroy, params: { procedure_id: procedure_id, id: pj_id } }
|
||||||
subject { request }
|
subject { request }
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
let(:procedure_id) { 9_999_999 }
|
let(:procedure_id) { 9_999_999 }
|
||||||
|
@ -98,7 +98,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_up' do
|
describe 'POST #move_up' do
|
||||||
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} }
|
subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
|
|
||||||
context 'when procedure have no type de champ' do
|
context 'when procedure have no type de champ' do
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
@ -124,7 +124,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject).to render_template('show') }
|
it { expect(subject).to render_template('show') }
|
||||||
it 'changes order places' do
|
it 'changes order places' do
|
||||||
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js}
|
post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
|
||||||
type_de_piece_justificative_0.reload
|
type_de_piece_justificative_0.reload
|
||||||
type_de_piece_justificative_1.reload
|
type_de_piece_justificative_1.reload
|
||||||
expect(type_de_piece_justificative_0.order_place).to eq(1)
|
expect(type_de_piece_justificative_0.order_place).to eq(1)
|
||||||
|
@ -135,7 +135,7 @@ describe Admin::PiecesJustificativesController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_down' do
|
describe 'POST #move_down' do
|
||||||
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} }
|
let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
|
||||||
subject { request }
|
subject { request }
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe Admin::PrevisualisationsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
subject { get :show, params: {procedure_id: procedure.id} }
|
subject { get :show, params: { procedure_id: procedure.id } }
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -59,7 +59,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil }
|
let(:procedure_published) { create :procedure, administrateur: admin, published_at: Time.now, archived_at: nil }
|
||||||
let(:procedure_archived) { create :procedure, administrateur: admin, published_at: nil, archived_at: Time.now }
|
let(:procedure_archived) { create :procedure, administrateur: admin, published_at: nil, archived_at: Time.now }
|
||||||
|
|
||||||
subject { delete :destroy, params: {id: procedure.id} }
|
subject { delete :destroy, params: { id: procedure.id } }
|
||||||
|
|
||||||
context 'when procedure is draft' do
|
context 'when procedure is draft' do
|
||||||
let!(:procedure) { procedure_draft }
|
let!(:procedure) { procedure_draft }
|
||||||
|
@ -96,7 +96,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
context "when administrateur does not own the procedure" do
|
context "when administrateur does not own the procedure" do
|
||||||
let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, archived_at: nil }
|
let(:procedure_not_owned) { create :procedure, administrateur: create(:administrateur), published_at: nil, archived_at: nil }
|
||||||
|
|
||||||
subject { delete :destroy, params: {id: procedure_not_owned.id} }
|
subject { delete :destroy, params: { id: procedure_not_owned.id } }
|
||||||
|
|
||||||
it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
|
it { expect{ subject }.to raise_error(ActiveRecord::RecordNotFound) }
|
||||||
end
|
end
|
||||||
|
@ -107,7 +107,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
|
|
||||||
subject { get :edit, params: {id: procedure_id} }
|
subject { get :edit, params: { id: procedure_id } }
|
||||||
|
|
||||||
context 'when user is not connected' do
|
context 'when user is not connected' do
|
||||||
before do
|
before do
|
||||||
|
@ -139,14 +139,14 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
context 'when all attributs are filled' do
|
context 'when all attributs are filled' do
|
||||||
describe 'new procedure in database' do
|
describe 'new procedure in database' do
|
||||||
subject { post :create, params: {procedure: procedure_params} }
|
subject { post :create, params: { procedure: procedure_params } }
|
||||||
|
|
||||||
it { expect { subject }.to change { Procedure.count }.by(1) }
|
it { expect { subject }.to change { Procedure.count }.by(1) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when procedure is correctly save' do
|
context 'when procedure is correctly save' do
|
||||||
before do
|
before do
|
||||||
post :create, params: {procedure: procedure_params}
|
post :create, params: { procedure: procedure_params }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'procedure attributs in database' do
|
describe 'procedure attributs in database' do
|
||||||
|
@ -183,7 +183,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
let(:description) { '' }
|
let(:description) { '' }
|
||||||
|
|
||||||
describe 'no new procedure in database' do
|
describe 'no new procedure in database' do
|
||||||
subject { post :create, params: {procedure: procedure_params} }
|
subject { post :create, params: { procedure: procedure_params } }
|
||||||
|
|
||||||
it { expect { subject }.to change { Procedure.count }.by(0) }
|
it { expect { subject }.to change { Procedure.count }.by(0) }
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
describe 'flash message is present' do
|
describe 'flash message is present' do
|
||||||
before do
|
before do
|
||||||
post :create, params: {procedure: procedure_params}
|
post :create, params: { procedure: procedure_params }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(flash[:alert]).to be_present }
|
it { expect(flash[:alert]).to be_present }
|
||||||
|
@ -210,14 +210,14 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
sign_out admin
|
sign_out admin
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { put :update, params: {id: procedure.id} }
|
subject { put :update, params: { id: procedure.id } }
|
||||||
|
|
||||||
it { is_expected.to redirect_to new_user_session_path }
|
it { is_expected.to redirect_to new_user_session_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when administrateur is connected' do
|
context 'when administrateur is connected' do
|
||||||
before do
|
before do
|
||||||
put :update, params: {id: procedure.id, procedure: procedure_params}
|
put :update, params: { id: procedure.id, procedure: procedure_params }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when admin is the owner of the procedure' do
|
context 'when admin is the owner of the procedure' do
|
||||||
before do
|
before do
|
||||||
put :publish, params: {procedure_id: procedure.id, procedure_path: procedure_path}
|
put :publish, params: { procedure_id: procedure.id, procedure_path: procedure_path }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
procedure2.reload
|
procedure2.reload
|
||||||
end
|
end
|
||||||
|
@ -364,7 +364,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
sign_out admin
|
sign_out admin
|
||||||
sign_in admin_2
|
sign_in admin_2
|
||||||
|
|
||||||
put :publish, params: {procedure_id: procedure.id, procedure_path: 'fake_path'}
|
put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when admin is the owner of the procedure' do
|
context 'when admin is the owner of the procedure' do
|
||||||
before do
|
before do
|
||||||
put :archive, params: {procedure_id: procedure.id}
|
put :archive, params: { procedure_id: procedure.id }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context 'when owner want to re-enable procedure' do
|
context 'when owner want to re-enable procedure' do
|
||||||
before do
|
before do
|
||||||
put :publish, params: {procedure_id: procedure.id, procedure_path: 'fake_path'}
|
put :publish, params: { procedure_id: procedure.id, procedure_path: 'fake_path' }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
sign_out admin
|
sign_out admin
|
||||||
sign_in admin_2
|
sign_in admin_2
|
||||||
|
|
||||||
put :archive, params: {procedure_id: procedure.id}
|
put :archive, params: { procedure_id: procedure.id }
|
||||||
procedure.reload
|
procedure.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
|
|
||||||
describe 'PUT #clone' do
|
describe 'PUT #clone' do
|
||||||
let!(:procedure) { create(:procedure, administrateur: admin) }
|
let!(:procedure) { create(:procedure, administrateur: admin) }
|
||||||
subject { put :clone, params: {procedure_id: procedure.id} }
|
subject { put :clone, params: { procedure_id: procedure.id } }
|
||||||
|
|
||||||
it { expect { subject }.to change(Procedure, :count).by(1) }
|
it { expect { subject }.to change(Procedure, :count).by(1) }
|
||||||
|
|
||||||
|
@ -502,7 +502,7 @@ describe Admin::ProceduresController, type: :controller do
|
||||||
describe 'POST transfer' do
|
describe 'POST transfer' do
|
||||||
let!(:procedure) { create :procedure, administrateur: admin }
|
let!(:procedure) { create :procedure, administrateur: admin }
|
||||||
|
|
||||||
subject { post :transfer, params: {email_admin: email_admin, procedure_id: procedure.id} }
|
subject { post :transfer, params: { email_admin: email_admin, procedure_id: procedure.id } }
|
||||||
|
|
||||||
context 'when admin is unknow' do
|
context 'when admin is unknow' do
|
||||||
let(:email_admin) { 'plop' }
|
let(:email_admin) { 'plop' }
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
|
|
||||||
subject { get :show, params: {procedure_id: procedure_id} }
|
subject { get :show, params: { procedure_id: procedure_id } }
|
||||||
|
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
let(:procedure_id) { 9_999_999 }
|
let(:procedure_id) { 9_999_999 }
|
||||||
|
@ -64,7 +64,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:request) { put :update, params: {procedure_id: procedure.id, procedure: procedure_params}, format: :js }
|
let(:request) { put :update, params: { procedure_id: procedure.id, procedure: procedure_params }, format: :js }
|
||||||
|
|
||||||
context 'when procedure is found' do
|
context 'when procedure is found' do
|
||||||
it { expect { request }.to change(TypeDeChamp, :count).by(1) }
|
it { expect { request }.to change(TypeDeChamp, :count).by(1) }
|
||||||
|
@ -122,7 +122,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
subject { put :update, format: :js, params: {procedure_id: 9_999_999, procedure: procedure_params} }
|
subject { put :update, format: :js, params: { procedure_id: 9_999_999, procedure: procedure_params } }
|
||||||
it 'creates type de champ' do
|
it 'creates type de champ' do
|
||||||
expect(subject.status).to eq(404)
|
expect(subject.status).to eq(404)
|
||||||
end
|
end
|
||||||
|
@ -131,7 +131,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
before do
|
before do
|
||||||
delete :destroy, params: {procedure_id: procedure.id, id: type_de_champ_id, format: :js}
|
delete :destroy, params: { procedure_id: procedure.id, id: type_de_champ_id, format: :js }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when type de champs does not exist' do
|
context 'when type de champs does not exist' do
|
||||||
|
@ -155,7 +155,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_up' do
|
describe 'POST #move_up' do
|
||||||
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} }
|
subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
|
|
||||||
context 'when procedure have no type de champ' do
|
context 'when procedure have no type de champ' do
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
@ -181,7 +181,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject).to render_template('show') }
|
it { expect(subject).to render_template('show') }
|
||||||
it 'changes order places' do
|
it 'changes order places' do
|
||||||
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js}
|
post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
|
||||||
type_de_champ_0.reload
|
type_de_champ_0.reload
|
||||||
type_de_champ_1.reload
|
type_de_champ_1.reload
|
||||||
expect(type_de_champ_0.order_place).to eq(1)
|
expect(type_de_champ_0.order_place).to eq(1)
|
||||||
|
@ -192,7 +192,7 @@ describe Admin::TypesDeChampController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_down' do
|
describe 'POST #move_down' do
|
||||||
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} }
|
let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
|
||||||
subject { request }
|
subject { request }
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
let(:procedure) { create(:procedure, administrateur: admin, published_at: published_at) }
|
||||||
let(:procedure_id) { procedure.id }
|
let(:procedure_id) { procedure.id }
|
||||||
|
|
||||||
subject { get :show, params: {procedure_id: procedure_id} }
|
subject { get :show, params: { procedure_id: procedure_id } }
|
||||||
|
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
let(:procedure_id) { 9_999_999 }
|
let(:procedure_id) { 9_999_999 }
|
||||||
|
@ -65,7 +65,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:request) { put :update, params: {format: :js, procedure_id: procedure.id, procedure: procedure_params} }
|
let(:request) { put :update, params: { format: :js, procedure_id: procedure.id, procedure: procedure_params } }
|
||||||
|
|
||||||
context 'when procedure is found' do
|
context 'when procedure is found' do
|
||||||
it { expect { request }.to change(TypeDeChamp, :count).by(1) }
|
it { expect { request }.to change(TypeDeChamp, :count).by(1) }
|
||||||
|
@ -105,7 +105,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
subject { put :update, params: {format: :js, procedure_id: 9_999_999, procedure: procedure_params} }
|
subject { put :update, params: { format: :js, procedure_id: 9_999_999, procedure: procedure_params } }
|
||||||
it 'creates type de champ' do
|
it 'creates type de champ' do
|
||||||
expect(subject.status).to eq(404)
|
expect(subject.status).to eq(404)
|
||||||
end
|
end
|
||||||
|
@ -114,7 +114,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
|
|
||||||
describe '#destroy' do
|
describe '#destroy' do
|
||||||
before do
|
before do
|
||||||
delete :destroy, params: {procedure_id: procedure.id, id: type_de_champ_id, format: :js}
|
delete :destroy, params: { procedure_id: procedure.id, id: type_de_champ_id, format: :js }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when type de champs does not exist' do
|
context 'when type de champs does not exist' do
|
||||||
|
@ -138,7 +138,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_up' do
|
describe 'POST #move_up' do
|
||||||
subject { post :move_up, params: {procedure_id: procedure.id, index: index, format: :js} }
|
subject { post :move_up, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
|
|
||||||
context 'when procedure have no type de champ' do
|
context 'when procedure have no type de champ' do
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
@ -164,7 +164,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
it { expect(subject).to render_template('show') }
|
it { expect(subject).to render_template('show') }
|
||||||
it 'changes order places' do
|
it 'changes order places' do
|
||||||
post :move_up, params: {procedure_id: procedure.id, index: index, format: :js}
|
post :move_up, params: { procedure_id: procedure.id, index: index, format: :js }
|
||||||
type_de_champ_0.reload
|
type_de_champ_0.reload
|
||||||
type_de_champ_1.reload
|
type_de_champ_1.reload
|
||||||
expect(type_de_champ_0.order_place).to eq(1)
|
expect(type_de_champ_0.order_place).to eq(1)
|
||||||
|
@ -175,7 +175,7 @@ describe Admin::TypesDeChampPrivateController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'POST #move_down' do
|
describe 'POST #move_down' do
|
||||||
let(:request) { post :move_down, params: {procedure_id: procedure.id, index: index, format: :js} }
|
let(:request) { post :move_down, params: { procedure_id: procedure.id, index: index, format: :js } }
|
||||||
let(:index) { 0 }
|
let(:index) { 0 }
|
||||||
|
|
||||||
subject { request }
|
subject { request }
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe Administrations::OmniauthCallbacksController, type: :controller do
|
||||||
let(:administration) { create(:administration, email: email) }
|
let(:administration) { create(:administration, email: email) }
|
||||||
before { administration }
|
before { administration }
|
||||||
|
|
||||||
it { is_expected.to redirect_to(administrations_path) }
|
it { is_expected.to redirect_to(manager_administrateurs_path) }
|
||||||
it do
|
it do
|
||||||
expect(controller).to receive(:sign_in).with(administration)
|
expect(controller).to receive(:sign_in).with(administration)
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe API::V1::DossiersController do
|
||||||
it { expect(described_class).to be < APIController }
|
it { expect(described_class).to be < APIController }
|
||||||
|
|
||||||
describe 'GET index' do
|
describe 'GET index' do
|
||||||
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id} }
|
let(:retour) { get :index, params: { token: admin.api_token, procedure_id: procedure_id } }
|
||||||
|
|
||||||
subject { retour }
|
subject { retour }
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ describe API::V1::DossiersController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when there are multiple pages' do
|
context 'when there are multiple pages' do
|
||||||
let(:retour) { get :index, params: {token: admin.api_token, procedure_id: procedure_id, page: 2} }
|
let(:retour) { get :index, params: { token: admin.api_token, procedure_id: procedure_id, page: 2 } }
|
||||||
|
|
||||||
let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
let!(:dossier1) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
let!(:dossier2) { create(:dossier, :with_entreprise, procedure: procedure, state: 'en_construction') }
|
||||||
|
@ -80,7 +80,7 @@ describe API::V1::DossiersController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET show' do
|
describe 'GET show' do
|
||||||
let(:retour) { get :show, params: {token: admin.api_token, procedure_id: procedure_id, id: dossier_id} }
|
let(:retour) { get :show, params: { token: admin.api_token, procedure_id: procedure_id, id: dossier_id } }
|
||||||
subject { retour }
|
subject { retour }
|
||||||
|
|
||||||
context 'when procedure is not found' do
|
context 'when procedure is not found' do
|
||||||
|
@ -178,7 +178,7 @@ describe API::V1::DossiersController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'piece justificative', vcr: {cassette_name: 'controllers_api_v1_dossiers_controller_piece_justificative'} do
|
describe 'piece justificative', vcr: { cassette_name: 'controllers_api_v1_dossiers_controller_piece_justificative' } do
|
||||||
before do
|
before do
|
||||||
create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user
|
create :piece_justificative, :rib, dossier: dossier, type_de_piece_justificative: dossier.procedure.types_de_piece_justificative.first, user: dossier.user
|
||||||
end
|
end
|
||||||
|
@ -240,7 +240,7 @@ describe API::V1::DossiersController do
|
||||||
super().find { |champ| champ[:type_de_champ][:type_champ] == 'quartier_prioritaire' }
|
super().find { |champ| champ[:type_de_champ][:type_champ] == 'quartier_prioritaire' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'quartier prioritaire', type_champ: 'quartier_prioritaire', order_place: -1, descripton: ''}) }
|
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'quartier prioritaire', type_champ: 'quartier_prioritaire', order_place: -1, descripton: '' }) }
|
||||||
it { expect(subject[:value]).to match(dossier.quartier_prioritaires.first.geometry.symbolize_keys) }
|
it { expect(subject[:value]).to match(dossier.quartier_prioritaires.first.geometry.symbolize_keys) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ describe API::V1::DossiersController do
|
||||||
super().find { |champ| champ[:type_de_champ][:type_champ] == 'cadastre' }
|
super().find { |champ| champ[:type_de_champ][:type_champ] == 'cadastre' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'cadastre', type_champ: 'cadastre', order_place: -1, descripton: ''}) }
|
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'cadastre', type_champ: 'cadastre', order_place: -1, descripton: '' }) }
|
||||||
it { expect(subject[:value]).to match(dossier.cadastres.first.geometry.symbolize_keys) }
|
it { expect(subject[:value]).to match(dossier.cadastres.first.geometry.symbolize_keys) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ describe API::V1::DossiersController do
|
||||||
super().find { |champ| champ[:type_de_champ][:type_champ] == 'user_geometry' }
|
super().find { |champ| champ[:type_de_champ][:type_champ] == 'user_geometry' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'user_geometry', type_champ: 'user_geometry', order_place: -1, descripton: ''}) }
|
it { expect(subject[:type_de_champ]).to match({ id: -1, libelle: 'user_geometry', type_champ: 'user_geometry', order_place: -1, descripton: '' }) }
|
||||||
it { expect(subject[:value]).to match(UserGeometry.new(dossier.json_latlngs).value) }
|
it { expect(subject[:value]).to match(UserGeometry.new(dossier.json_latlngs).value) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -318,7 +318,7 @@ describe API::V1::DossiersController do
|
||||||
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
it { expect(subject.first[:email]).to eq 'plop@plip.com' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'cerfa', vcr: {cassette_name: 'controllers_api_v1_dossiers_controller_cerfa'} do
|
describe 'cerfa', vcr: { cassette_name: 'controllers_api_v1_dossiers_controller_cerfa' } do
|
||||||
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :with_cerfa_upload, procedure: procedure) } }
|
let!(:dossier) { Timecop.freeze(date_creation) { create(:dossier, :with_entreprise, :with_cerfa_upload, procedure: procedure) } }
|
||||||
let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') }
|
let(:content) { File.open('./spec/support/files/piece_justificative_388.pdf') }
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,17 @@ describe API::V1::ProceduresController, type: :controller do
|
||||||
|
|
||||||
describe 'GET show' do
|
describe 'GET show' do
|
||||||
context 'when procedure does not exist' do
|
context 'when procedure does not exist' do
|
||||||
subject { get :show, params: {id: 999_999_999, token: admin.api_token }}
|
subject { get :show, params: { id: 999_999_999, token: admin.api_token } }
|
||||||
it { expect(subject.status).to eq(404) }
|
it { expect(subject.status).to eq(404) }
|
||||||
end
|
end
|
||||||
context 'when procedure does not belong to administrateur' do
|
context 'when procedure does not belong to administrateur' do
|
||||||
let(:procedure) { create(:procedure, administrateur: create(:administrateur)) }
|
let(:procedure) { create(:procedure, administrateur: create(:administrateur)) }
|
||||||
subject { get :show, params:{id: procedure, token: admin.api_token }}
|
subject { get :show, params: { id: procedure, token: admin.api_token } }
|
||||||
it { expect(subject.status).to eq(404) }
|
it { expect(subject.status).to eq(404) }
|
||||||
end
|
end
|
||||||
context 'when procedure exist' do
|
context 'when procedure exist' do
|
||||||
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, administrateur: admin) }
|
let(:procedure) { create(:procedure, :with_two_type_de_piece_justificative, :with_type_de_champ, administrateur: admin) }
|
||||||
subject { get :show, params:{id: procedure, token: admin.api_token }}
|
subject { get :show, params: { id: procedure, token: admin.api_token } }
|
||||||
|
|
||||||
it 'return REST code 200', :show_in_doc do
|
it 'return REST code 200', :show_in_doc do
|
||||||
expect(subject.status).to eq(200)
|
expect(subject.status).to eq(200)
|
||||||
|
@ -25,7 +25,7 @@ describe API::V1::ProceduresController, type: :controller do
|
||||||
describe 'body' do
|
describe 'body' do
|
||||||
let(:module_api_carto) { create(:module_api_carto, use_api_carto: true, quartiers_prioritaires: true, cadastre: true) }
|
let(:module_api_carto) { create(:module_api_carto, use_api_carto: true, quartiers_prioritaires: true, cadastre: true) }
|
||||||
let(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, module_api_carto: module_api_carto, administrateur: admin) }
|
let(:procedure) { create(:procedure, :with_type_de_champ, :with_two_type_de_piece_justificative, module_api_carto: module_api_carto, administrateur: admin) }
|
||||||
let(:response) { get :show, params:{id: procedure.id, token: admin.api_token }}
|
let(:response) { get :show, params: { id: procedure.id, token: admin.api_token } }
|
||||||
subject { JSON.parse(response.body, symbolize_names: true)[:procedure] }
|
subject { JSON.parse(response.body, symbolize_names: true)[:procedure] }
|
||||||
|
|
||||||
it { expect(subject[:id]).to eq(procedure.id) }
|
it { expect(subject[:id]).to eq(procedure.id) }
|
||||||
|
|
|
@ -18,12 +18,12 @@ describe APIController, type: :controller do
|
||||||
end
|
end
|
||||||
context 'when token does not exist' do
|
context 'when token does not exist' do
|
||||||
let(:token) { 'invalid_token' }
|
let(:token) { 'invalid_token' }
|
||||||
subject { get :index, params: {token: token} }
|
subject { get :index, params: { token: token } }
|
||||||
it { expect(subject.status).to eq(401) }
|
it { expect(subject.status).to eq(401) }
|
||||||
end
|
end
|
||||||
context 'when token exist' do
|
context 'when token exist' do
|
||||||
let(:administrateur) { create(:administrateur) }
|
let(:administrateur) { create(:administrateur) }
|
||||||
subject { get :index, params: {token: administrateur.api_token} }
|
subject { get :index, params: { token: administrateur.api_token } }
|
||||||
it { expect(subject.status).to eq(200) }
|
it { expect(subject.status).to eq(200) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe ApplicationController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = ApplicationController
|
before_actions = ApplicationController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:set_raven_context)
|
expect(before_actions).to include(:set_raven_context)
|
||||||
|
|
|
@ -2,20 +2,20 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe Ban::SearchController, type: :controller do
|
describe Ban::SearchController, type: :controller do
|
||||||
describe '#GET get' do
|
describe '#GET get' do
|
||||||
subject { get :get, params: {request: request} }
|
subject { get :get, params: { request: request } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when request return result', vcr: {cassette_name: 'bano_search_paris'} do
|
context 'when request return result', vcr: { cassette_name: 'bano_search_paris' } do
|
||||||
let (:request) { 'Paris' }
|
let (:request) { 'Paris' }
|
||||||
|
|
||||||
it { expect(response.status).to eq 200 }
|
it { expect(response.status).to eq 200 }
|
||||||
it { expect(response.body).to eq '[{"label":"Paris"},{"label":"Paris 63120 Courpière"},{"label":"PARIS (Vaillac) 46240 Cœur de Causse"},{"label":"Paris 40500 Saint-Sever"},{"label":"Paris Buton 37140 Bourgueil"}]' }
|
it { expect(response.body).to eq '[{"label":"Paris"},{"label":"Paris 63120 Courpière"},{"label":"PARIS (Vaillac) 46240 Cœur de Causse"},{"label":"Paris 40500 Saint-Sever"},{"label":"Paris Buton 37140 Bourgueil"}]' }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when request return nothing', vcr: {cassette_name: 'bano_search_nothing'} do
|
context 'when request return nothing', vcr: { cassette_name: 'bano_search_nothing' } do
|
||||||
let (:request) { 'je recherche pas grand chose' }
|
let (:request) { 'je recherche pas grand chose' }
|
||||||
|
|
||||||
it { expect(response.status).to eq 200 }
|
it { expect(response.status).to eq 200 }
|
||||||
|
@ -25,22 +25,22 @@ describe Ban::SearchController, type: :controller do
|
||||||
|
|
||||||
describe '#GET get_address_point' do
|
describe '#GET get_address_point' do
|
||||||
let(:dossier_id) { "1" }
|
let(:dossier_id) { "1" }
|
||||||
subject { get :get_address_point, params: {request: request, dossier_id: dossier_id} }
|
subject { get :get_address_point, params: { request: request, dossier_id: dossier_id } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when request return result', vcr: {cassette_name: 'ban_search_paris'} do
|
context 'when request return result', vcr: { cassette_name: 'ban_search_paris' } do
|
||||||
let(:request) { 'Paris' }
|
let(:request) { 'Paris' }
|
||||||
|
|
||||||
it { expect(response.body).to eq ({lon: '2.3469', lat: '48.8589', zoom: '14', dossier_id: dossier_id}).to_json }
|
it { expect(response.body).to eq ({ lon: '2.3469', lat: '48.8589', zoom: '14', dossier_id: dossier_id }).to_json }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when request return nothing', vcr: {cassette_name: 'ban_search_nothing'} do
|
context 'when request return nothing', vcr: { cassette_name: 'ban_search_nothing' } do
|
||||||
let(:request) { 'je recherche pas grand chose' }
|
let(:request) { 'je recherche pas grand chose' }
|
||||||
|
|
||||||
it { expect(response.body).to eq ({lon: nil, lat: nil, zoom: '14', dossier_id: dossier_id}).to_json }
|
it { expect(response.body).to eq ({ lon: nil, lat: nil, zoom: '14', dossier_id: dossier_id }).to_json }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,34 +1,42 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe FranceConnect::ParticulierController, type: :controller do
|
describe FranceConnect::ParticulierController, type: :controller do
|
||||||
let(:code) { 'plop' }
|
|
||||||
let(:given_name) { 'titi' }
|
|
||||||
let(:family_name) { 'toto' }
|
|
||||||
let(:birthdate) { '20150821' }
|
let(:birthdate) { '20150821' }
|
||||||
let(:gender) { 'M' }
|
|
||||||
let(:birthplace) { '1234' }
|
|
||||||
let(:france_connect_particulier_id) { 'blabla' }
|
|
||||||
let(:email) { 'test@test.com' }
|
let(:email) { 'test@test.com' }
|
||||||
let(:password) { '' }
|
|
||||||
|
|
||||||
let(:user_info) { { france_connect_particulier_id: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, birthplace: birthplace, gender: gender, email_france_connect: email } }
|
let(:user_info) do
|
||||||
|
{
|
||||||
describe '.auth' do
|
france_connect_particulier_id: 'blablabla',
|
||||||
it 'redirect to france connect serveur' do
|
given_name: 'titi',
|
||||||
get :login
|
family_name: 'toto',
|
||||||
expect(response.status).to eq(302)
|
birthdate: birthdate,
|
||||||
end
|
birthplace: '1234',
|
||||||
|
gender: 'M',
|
||||||
|
email_france_connect: email
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.callback' do
|
describe '#auth' do
|
||||||
|
subject { get :login }
|
||||||
|
|
||||||
|
it { is_expected.to have_http_status(:redirect) }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#callback' do
|
||||||
|
let(:code) { 'plop' }
|
||||||
|
|
||||||
|
subject { get :callback, params: { code: code } }
|
||||||
|
|
||||||
context 'when param code is missing' do
|
context 'when param code is missing' do
|
||||||
it 'redirect to login page' do
|
let(:code) { nil }
|
||||||
get :callback
|
|
||||||
expect(response).to redirect_to(new_user_session_path)
|
it { is_expected.to redirect_to(new_user_session_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when param code is empty' do
|
||||||
|
let(:code) { '' }
|
||||||
|
|
||||||
|
it { is_expected.to redirect_to(new_user_session_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when params code is present' do
|
|
||||||
context 'when code is correct' do
|
context 'when code is correct' do
|
||||||
before do
|
before do
|
||||||
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier)
|
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier)
|
||||||
|
@ -36,190 +44,60 @@ describe FranceConnect::ParticulierController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when france_connect_particulier_id exist in database' do
|
context 'when france_connect_particulier_id exist in database' do
|
||||||
let!(:france_connect_information) { create(:france_connect_information, france_connect_particulier_id: france_connect_particulier_id, given_name: given_name, family_name: family_name, birthdate: birthdate, gender: gender, birthplace: birthplace) }
|
let!(:france_connect_information) { create(:france_connect_information, user_info) }
|
||||||
|
|
||||||
context {
|
it { expect { subject }.not_to change { FranceConnectInformation.count } }
|
||||||
subject { get :callback, params: {code: code} }
|
|
||||||
|
|
||||||
it 'does not create a new france_connect_information in database' do
|
|
||||||
expect { subject }.not_to change { FranceConnectInformation.count }
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
context 'when france_connect_particulier_id have an associate user' do
|
context 'when france_connect_particulier_id have an associate user' do
|
||||||
before do
|
let!(:user) { create(:user, email: 'plop@plop.com', france_connect_information: france_connect_information) }
|
||||||
create(:user, email: email, france_connect_information: france_connect_information)
|
|
||||||
|
|
||||||
get :callback, params: {code: code}
|
it do
|
||||||
|
subject
|
||||||
|
expect(user.reload.loged_in_with_france_connect).to eq('particulier')
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:email) { 'plop@plop.com' }
|
context 'and the user has a stored location' do
|
||||||
let(:current_user) { User.find_by_email(email) }
|
|
||||||
let(:stored_location) { '/plip/plop' }
|
let(:stored_location) { '/plip/plop' }
|
||||||
|
before { controller.store_location_for(:user, stored_location) }
|
||||||
|
|
||||||
it 'current user have attribut loged_in_with_france_connect? at true' do
|
it { is_expected.to redirect_to(stored_location) }
|
||||||
expect(current_user.loged_in_with_france_connect?).to be_truthy
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirect to stored location' do
|
|
||||||
subject.store_location_for(:user, stored_location)
|
|
||||||
|
|
||||||
get :callback, params: {code: code}
|
|
||||||
expect(response).to redirect_to(stored_location)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when france_connect_particulier_id does not have an associate user' do
|
context 'when france_connect_particulier_id does not have an associate user' do
|
||||||
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
before do
|
it do
|
||||||
get :callback, params: {code: code}
|
subject
|
||||||
end
|
expect(User.find_by(email: email)).not_to be_nil
|
||||||
|
|
||||||
it 'redirects to check email FC page' do
|
|
||||||
expect(response).to redirect_to(france_connect_particulier_new_path(fci_id: france_connect_information.id, salt: salt))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when france_connect_particulier_id does not exist in database' do
|
context 'when france_connect_particulier_id does not exist in database' do
|
||||||
let(:last_france_connect_information) { FranceConnectInformation.last }
|
|
||||||
let(:salt) { FranceConnectSaltService.new(last_france_connect_information).salt }
|
|
||||||
subject { get :callback, params: {code: code} }
|
|
||||||
|
|
||||||
it { expect { subject }.to change { FranceConnectInformation.count }.by(1) }
|
it { expect { subject }.to change { FranceConnectInformation.count }.by(1) }
|
||||||
|
|
||||||
describe 'FranceConnectInformation attributs' do
|
describe 'FranceConnectInformation attributs' do
|
||||||
before do
|
let(:stored_fci) { FranceConnectInformation.last }
|
||||||
get :callback, params: {code: code}
|
|
||||||
|
before { subject }
|
||||||
|
|
||||||
|
it { expect(stored_fci).to have_attributes(user_info.merge(birthdate: DateTime.parse(birthdate))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { last_france_connect_information }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
|
||||||
it { expect(subject.gender).to eq gender }
|
|
||||||
it { expect(subject.given_name).to eq given_name }
|
|
||||||
it { expect(subject.family_name).to eq family_name }
|
|
||||||
it { expect(subject.email_france_connect).to eq email }
|
|
||||||
it { expect(subject.birthdate.to_time.to_i).to eq birthdate.to_time.to_i }
|
|
||||||
it { expect(subject.birthplace).to eq birthplace }
|
|
||||||
it { expect(subject.france_connect_particulier_id).to eq france_connect_particulier_id }
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirects to check email FC page' do
|
|
||||||
expect(subject).to redirect_to(france_connect_particulier_new_path(fci_id: last_france_connect_information.id, salt: salt))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when code is not correct' do
|
context 'when code is not correct' do
|
||||||
before do
|
before do
|
||||||
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
|
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier) { raise Rack::OAuth2::Client::Error.new(500, error: 'Unknown') }
|
||||||
get :callback, params: {code: code}
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'redirect to login page' do
|
|
||||||
expect(response).to redirect_to(new_user_session_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'display error message' do
|
|
||||||
expect(flash[:alert]).to be_present
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'POST #check_email' do
|
|
||||||
let(:email) { 'plop@gmail.com' }
|
|
||||||
|
|
||||||
let!(:france_connect_information) { create(:france_connect_information) }
|
|
||||||
let(:france_connect_information_id) { france_connect_information.id }
|
|
||||||
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
|
|
||||||
|
|
||||||
subject { post :check_email, params: {fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: email}} }
|
|
||||||
|
|
||||||
context 'when salt and fci_id does not matches' do
|
|
||||||
let(:france_connect_information_fake) { create(:france_connect_information, france_connect_particulier_id: 'iugfjh') }
|
|
||||||
let(:france_connect_information_id) { france_connect_information_fake.id }
|
|
||||||
|
|
||||||
it { is_expected.to redirect_to new_user_session_path }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when salt and fci_id matches' do
|
|
||||||
context 'when email is not used' do
|
|
||||||
context 'when email is valid' do
|
|
||||||
it { expect { subject }.to change { User.count }.by(1) }
|
|
||||||
|
|
||||||
describe 'New user attributs' do
|
|
||||||
before do
|
|
||||||
subject
|
subject
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:user) { User.last }
|
it { expect(response).to redirect_to(new_user_session_path) }
|
||||||
|
|
||||||
it { expect(user.email).to eq email }
|
it { expect(flash[:alert]).to be_present }
|
||||||
it { expect(user.france_connect_information).to eq france_connect_information }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when email is not valid' do
|
|
||||||
let(:email) { 'kdjizjflk' }
|
|
||||||
|
|
||||||
it { expect { subject }.not_to change { User.count } }
|
|
||||||
it { is_expected.to redirect_to(france_connect_particulier_new_path fci_id: france_connect_information.id, salt: salt, user: {email_france_connect: email}) }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when email is used' do
|
|
||||||
let!(:user) { create(:user, email: france_connect_information.email_france_connect) }
|
|
||||||
let(:email) { france_connect_information.email_france_connect }
|
|
||||||
let(:password) { user.password }
|
|
||||||
|
|
||||||
before do
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
subject { post :check_email, params: {fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: email, password: password}} }
|
|
||||||
|
|
||||||
context 'when email and password couple is valid' do
|
|
||||||
it { expect { subject }.not_to change { User.count } }
|
|
||||||
|
|
||||||
describe 'Update user attributs' do
|
|
||||||
before do
|
|
||||||
subject
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(user.france_connect_information).to eq france_connect_information }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when email and password couple is not valid' do
|
|
||||||
let(:password) { 'fake' }
|
|
||||||
|
|
||||||
it { expect(flash.alert).to eq 'Mot de passe invalide' }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'POST #create' do
|
|
||||||
let!(:france_connect_information) { create(:france_connect_information, email_france_connect: email) }
|
|
||||||
let(:france_connect_information_id) { france_connect_information.id }
|
|
||||||
let(:salt) { FranceConnectSaltService.new(france_connect_information).salt }
|
|
||||||
|
|
||||||
subject { post :create, params: {fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: france_connect_information.email_france_connect}} }
|
|
||||||
|
|
||||||
context 'when email is filled' do
|
|
||||||
let(:email) { 'plop@gmail.com' }
|
|
||||||
|
|
||||||
it { expect { subject }.to change { User.count }.by(1) }
|
|
||||||
it { expect(subject).to redirect_to(root_path) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when email is incorrect' do
|
|
||||||
let(:email) { '' }
|
|
||||||
|
|
||||||
it { expect { subject }.not_to change { User.count } }
|
|
||||||
it { expect(subject).to redirect_to(france_connect_particulier_new_path(fci_id: france_connect_information_id, salt: salt, user: {email_france_connect: france_connect_information.email_france_connect})) }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ describe InvitesController, type: :controller do
|
||||||
sign_in signed_in_profile
|
sign_in signed_in_profile
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :create, params: {dossier_id: dossier.id, email: email} }
|
subject { post :create, params: { dossier_id: dossier.id, email: email } }
|
||||||
|
|
||||||
context "when gestionnaire is signed_in" do
|
context "when gestionnaire is signed_in" do
|
||||||
let(:signed_in_profile) { create(:gestionnaire) }
|
let(:signed_in_profile) { create(:gestionnaire) }
|
||||||
|
|
|
@ -1,23 +1,5 @@
|
||||||
require 'spec_helper'
|
describe Manager::AdministrateursController, type: :controller do
|
||||||
|
let(:administration){ create(:administration) }
|
||||||
describe AdministrationsController, type: :controller do
|
|
||||||
let(:administration) { create :administration }
|
|
||||||
|
|
||||||
describe 'GET #index' do
|
|
||||||
subject { get :index }
|
|
||||||
|
|
||||||
context 'when administration user is not connect' do
|
|
||||||
it { expect(subject.status).to eq 302 }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when administration user is connect' do
|
|
||||||
before do
|
|
||||||
sign_in administration
|
|
||||||
end
|
|
||||||
|
|
||||||
it { expect(subject.status).to eq 200 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
let(:email) { 'plop@plop.com' }
|
let(:email) { 'plop@plop.com' }
|
||||||
|
@ -27,7 +9,7 @@ describe AdministrationsController, type: :controller do
|
||||||
sign_in administration
|
sign_in administration
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :create, administrateur: {email: email } }
|
subject { post :create, administrateur: { email: email } }
|
||||||
|
|
||||||
context 'when email and password are correct' do
|
context 'when email and password are correct' do
|
||||||
it 'add new administrateur in database' do
|
it 'add new administrateur in database' do
|
|
@ -95,7 +95,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id} }
|
subject { post :repasser_en_construction, params: { procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||||
|
|
||||||
it 'change state to en_construction' do
|
it 'change state to en_construction' do
|
||||||
subject
|
subject
|
||||||
|
@ -114,7 +114,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id} }
|
subject { post :terminer, params: { process_action: "refuser", procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||||
|
|
||||||
it 'change state to refuse' do
|
it 'change state to refuse' do
|
||||||
subject
|
subject
|
||||||
|
@ -140,7 +140,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
sign_in gestionnaire
|
sign_in gestionnaire
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id} }
|
subject { post :terminer, params: { process_action: "classer_sans_suite", procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||||
|
|
||||||
it 'change state to sans_suite' do
|
it 'change state to sans_suite' do
|
||||||
subject
|
subject
|
||||||
|
@ -174,7 +174,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
expect(NotificationMailer).to receive(:deliver_now!)
|
expect(NotificationMailer).to receive(:deliver_now!)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id} }
|
subject { post :terminer, params: { process_action: "accepter", procedure_id: procedure.id, dossier_id: dossier.id } }
|
||||||
|
|
||||||
it 'change state to accepte' do
|
it 'change state to accepte' do
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -5,11 +5,10 @@ describe NewGestionnaire::GestionnaireController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewGestionnaire::GestionnaireController
|
before_actions = NewGestionnaire::GestionnaireController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:authenticate_gestionnaire!)
|
expect(before_actions).to include(:authenticate_gestionnaire!)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
it "is present" do
|
it "is present" do
|
||||||
before_actions = NewGestionnaire::ProceduresController
|
before_actions = NewGestionnaire::ProceduresController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:ensure_ownership!)
|
expect(before_actions).to include(:ensure_ownership!)
|
||||||
|
@ -46,7 +46,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
it "is present" do
|
it "is present" do
|
||||||
before_actions = NewGestionnaire::ProceduresController
|
before_actions = NewGestionnaire::ProceduresController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:redirect_to_avis_if_needed)
|
expect(before_actions).to include(:redirect_to_avis_if_needed)
|
||||||
|
@ -89,7 +89,7 @@ describe NewGestionnaire::ProceduresController, type: :controller do
|
||||||
|
|
||||||
context "when not logged" do
|
context "when not logged" do
|
||||||
before { subject }
|
before { subject }
|
||||||
it { expect(response).to redirect_to(new_user_session_path)}
|
it { expect(response).to redirect_to(new_user_session_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when logged in" do
|
context "when logged in" do
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe NewUser::DossiersController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewUser::DossiersController
|
before_actions = NewUser::DossiersController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:ensure_ownership!)
|
expect(before_actions).to include(:ensure_ownership!)
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe NewUser::UserController, type: :controller do
|
||||||
it 'is present' do
|
it 'is present' do
|
||||||
before_actions = NewUser::UserController
|
before_actions = NewUser::UserController
|
||||||
._process_action_callbacks
|
._process_action_callbacks
|
||||||
.find_all{|process_action_callbacks| process_action_callbacks.kind == :before}
|
.find_all{ |process_action_callbacks| process_action_callbacks.kind == :before }
|
||||||
.map(&:filter)
|
.map(&:filter)
|
||||||
|
|
||||||
expect(before_actions).to include(:authenticate_user!)
|
expect(before_actions).to include(:authenticate_user!)
|
||||||
|
|
|
@ -37,7 +37,7 @@ describe RootController, type: :controller do
|
||||||
sign_in create(:administration)
|
sign_in create(:administration)
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject).to redirect_to(administrations_path) }
|
it { expect(subject).to redirect_to(manager_root_path) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when nobody is connected' do
|
context 'when nobody is connected' do
|
||||||
|
|
|
@ -298,7 +298,7 @@ describe StatsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#motivation_usage_procedure' do
|
describe '#motivation_usage_procedure' do
|
||||||
let!(:dossier) { create(:dossier, processed_at: 1.week.ago, motivation: "Motivation" ) }
|
let!(:dossier) { create(:dossier, processed_at: 1.week.ago, motivation: "Motivation") }
|
||||||
let!(:dossier1) { create(:dossier, processed_at: 1.week.ago, motivation: "Motivation", procedure: dossier.procedure) }
|
let!(:dossier1) { create(:dossier, processed_at: 1.week.ago, motivation: "Motivation", procedure: dossier.procedure) }
|
||||||
let!(:dossier2) { create(:dossier, processed_at: 1.week.ago) }
|
let!(:dossier2) { create(:dossier, processed_at: 1.week.ago) }
|
||||||
let!(:dossier3) { create(:dossier, processed_at: 1.week.ago) }
|
let!(:dossier3) { create(:dossier, processed_at: 1.week.ago) }
|
||||||
|
|
|
@ -7,7 +7,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
dossier.state = 'en_instruction'
|
dossier.state = 'en_instruction'
|
||||||
dossier.save
|
dossier.save
|
||||||
|
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to root_path }
|
it { is_expected.to redirect_to root_path }
|
||||||
|
@ -18,7 +18,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
let(:dossier) { create(:dossier) }
|
let(:dossier) { create(:dossier) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to(root_path) }
|
it { is_expected.to redirect_to(root_path) }
|
||||||
|
@ -31,26 +31,26 @@ shared_examples 'carte_controller_spec' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects to users/sign_in' do
|
it 'redirects to users/sign_in' do
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
expect(response).to redirect_to('/users/sign_in')
|
expect(response).to redirect_to('/users/sign_in')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success if carto is activated' do
|
it 'returns http success if carto is activated' do
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when procedure not have activate api carto' do
|
context 'when procedure not have activate api carto' do
|
||||||
it 'redirection on user dossier list' do
|
it 'redirection on user dossier list' do
|
||||||
get :show, params: {dossier_id: dossier_with_no_carto.id}
|
get :show, params: { dossier_id: dossier_with_no_carto.id }
|
||||||
expect(response).to redirect_to(root_path)
|
expect(response).to redirect_to(root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when dossier id not exist' do
|
context 'when dossier id not exist' do
|
||||||
it 'redirection on user dossier list' do
|
it 'redirection on user dossier list' do
|
||||||
get :show, params: {dossier_id: bad_dossier_id}
|
get :show, params: { dossier_id: bad_dossier_id }
|
||||||
expect(response).to redirect_to(root_path)
|
expect(response).to redirect_to(root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -61,7 +61,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
describe 'POST #save' do
|
describe 'POST #save' do
|
||||||
context 'Aucune localisation n\'a jamais été enregistrée' do
|
context 'Aucune localisation n\'a jamais été enregistrée' do
|
||||||
it do
|
it do
|
||||||
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
|
post :save, params: { dossier_id: dossier.id, json_latlngs: '' }
|
||||||
expect(response).to redirect_to("/users/dossiers/#{dossier.id}/description")
|
expect(response).to redirect_to("/users/dossiers/#{dossier.id}/description")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -69,7 +69,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
context 'En train de modifier la localisation' do
|
context 'En train de modifier la localisation' do
|
||||||
let(:dossier) { create(:dossier, state: 'en_construction') }
|
let(:dossier) { create(:dossier, state: 'en_construction') }
|
||||||
before do
|
before do
|
||||||
post :save, params: {dossier_id: dossier.id, json_latlngs: ''}
|
post :save, params: { dossier_id: dossier.id, json_latlngs: '' }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'Redirection vers la page récapitulatif' do
|
it 'Redirection vers la page récapitulatif' do
|
||||||
|
@ -83,9 +83,9 @@ shared_examples 'carte_controller_spec' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||||
.to receive(:to_params)
|
.to receive(:to_params)
|
||||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
.and_return({ "QPCODE1234" => { :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } } })
|
||||||
|
|
||||||
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
|
post :save, params: { dossier_id: dossier.id, json_latlngs: json_latlngs }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when json_latlngs params is empty' do
|
context 'when json_latlngs params is empty' do
|
||||||
|
@ -130,9 +130,9 @@ shared_examples 'carte_controller_spec' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
|
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
|
||||||
.to receive(:to_params)
|
.to receive(:to_params)
|
||||||
.and_return([{:surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => {:type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}}])
|
.and_return([{ :surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => { :type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]] } }])
|
||||||
|
|
||||||
post :save, params: {dossier_id: dossier.id, json_latlngs: json_latlngs}
|
post :save, params: { dossier_id: dossier.id, json_latlngs: json_latlngs }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when json_latlngs params is empty' do
|
context 'when json_latlngs params is empty' do
|
||||||
|
@ -172,7 +172,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
it { expect(subject.nom_com).to eq('Le Grau-du-Roi') }
|
it { expect(subject.nom_com).to eq('Le Grau-du-Roi') }
|
||||||
it { expect(subject.code_com).to eq('133') }
|
it { expect(subject.code_com).to eq('133') }
|
||||||
it { expect(subject.code_arr).to eq('000') }
|
it { expect(subject.code_arr).to eq('000') }
|
||||||
it { expect(subject.geometry).to eq({"type" => "MultiPolygon", "coordinates" => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]]}) }
|
it { expect(subject.geometry).to eq({ "type" => "MultiPolygon", "coordinates" => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]] }) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -185,7 +185,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
|
|
||||||
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
||||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||||
get :get_position, params: {dossier_id: dossier.id}
|
get :get_position, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { JSON.parse(response.body) }
|
subject { JSON.parse(response.body) }
|
||||||
|
@ -203,7 +203,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
before do
|
before do
|
||||||
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
stub_request(:get, /http:\/\/api-adresse[.]data[.]gouv[.]fr\/search[?]limit=1&q=/)
|
||||||
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
.to_return(status: 200, body: '{"query": "babouba", "version": "draft", "licence": "ODbL 1.0", "features": [], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||||
get :get_position, params: {dossier_id: dossier.id}
|
get :get_position, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { JSON.parse(response.body) }
|
subject { JSON.parse(response.body) }
|
||||||
|
@ -219,7 +219,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
stub_request(:get, "http://api-adresse.data.gouv.fr/search?limit=1&q=#{adresse}")
|
stub_request(:get, "http://api-adresse.data.gouv.fr/search?limit=1&q=#{adresse}")
|
||||||
.to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
.to_return(status: 200, body: '{"query": "50 avenue des champs u00e9lysu00e9es Paris 75008", "version": "draft", "licence": "ODbL 1.0", "features": [{"geometry": {"coordinates": [2.306888, 48.870374], "type": "Point"}, "type": "Feature", "properties": {"city": "Paris", "label": "50 Avenue des Champs u00c9lysu00e9es 75008 Paris", "housenumber": "50", "id": "ADRNIVX_0000000270748251", "postcode": "75008", "name": "50 Avenue des Champs u00c9lysu00e9es", "citycode": "75108", "context": "75, u00cele-de-France", "score": 0.9054545454545454, "type": "housenumber"}}], "type": "FeatureCollection", "attribution": "BAN"}', headers: {})
|
||||||
|
|
||||||
get :get_position, params: {dossier_id: dossier.id}
|
get :get_position, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
subject { JSON.parse(response.body) }
|
subject { JSON.parse(response.body) }
|
||||||
|
|
||||||
|
@ -245,9 +245,9 @@ shared_examples 'carte_controller_spec' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||||
.to receive(:to_params)
|
.to receive(:to_params)
|
||||||
.and_return({"QPCODE1234" => {:code => "QPCODE1234", :geometry => {:type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]]}}})
|
.and_return({ "QPCODE1234" => { :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } } })
|
||||||
|
|
||||||
post :get_qp, params: {dossier_id: dossier.id, coordinates: coordinates}
|
post :get_qp, params: { dossier_id: dossier.id, coordinates: coordinates }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when coordinates are empty' do
|
context 'when coordinates are empty' do
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
require 'controllers/users/description_controller_shared_example'
|
require 'controllers/users/description_controller_shared_example'
|
||||||
|
|
||||||
describe Users::DescriptionController, type: :controller, vcr: {cassette_name: 'controllers_users_description_controller'} do
|
describe Users::DescriptionController, type: :controller, vcr: { cassette_name: 'controllers_users_description_controller' } do
|
||||||
let(:owner_user) { create(:user) }
|
let(:owner_user) { create(:user) }
|
||||||
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
let(:invite_by_user) { create :user, email: 'invite@plop.com' }
|
||||||
let(:archived_at) { nil }
|
let(:archived_at) { nil }
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe Users::Dossiers::AddSiretController, type: :controller do
|
||||||
sign_in dossier.user
|
sign_in dossier.user
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { get :show, params:{dossier_id: dossier.id }}
|
subject { get :show, params: { dossier_id: dossier.id } }
|
||||||
|
|
||||||
context 'when dossier is not attached at a procedure with individual siret attribut' do
|
context 'when dossier is not attached at a procedure with individual siret attribut' do
|
||||||
it { is_expected.to redirect_to users_dossiers_path }
|
it { is_expected.to redirect_to users_dossiers_path }
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Users::Dossiers::CommentairesController, type: :controller do
|
||||||
|
|
||||||
describe '#POST create' do
|
describe '#POST create' do
|
||||||
subject {
|
subject {
|
||||||
post :create, params:{dossier_id: dossier.id, texte_commentaire: texte_commentaire}
|
post :create, params: { dossier_id: dossier.id, texte_commentaire: texte_commentaire }
|
||||||
dossier.reload
|
dossier.reload
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
||||||
context 'when email is not set' do
|
context 'when email is not set' do
|
||||||
context 'when user is not connected' do
|
context 'when user is not connected' do
|
||||||
before do
|
before do
|
||||||
get :show, params: {id: invite.id}
|
get :show, params: { id: invite.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to new_user_session_path }
|
it { is_expected.to redirect_to new_user_session_path }
|
||||||
|
@ -18,7 +18,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
||||||
before do
|
before do
|
||||||
sign_in invite.user
|
sign_in invite.user
|
||||||
|
|
||||||
get :show, params: {id: invite.id}
|
get :show, params: { id: invite.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response.status).to eq 200 }
|
it { expect(response.status).to eq 200 }
|
||||||
|
@ -27,7 +27,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
||||||
|
|
||||||
context 'when email is set' do
|
context 'when email is set' do
|
||||||
before do
|
before do
|
||||||
get :show, params: {id: invite.id, email: email}
|
get :show, params: { id: invite.id, email: email }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when email is blank' do
|
context 'when email is blank' do
|
||||||
|
@ -57,7 +57,7 @@ describe Users::Dossiers::InvitesController, type: :controller do
|
||||||
|
|
||||||
let(:invite) { create :invite, email: email, dossier: (create :dossier) }
|
let(:invite) { create :invite, email: email, dossier: (create :dossier) }
|
||||||
|
|
||||||
subject { get :show, params: {id: invite.id} }
|
subject { get :show, params: { id: invite.id } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
|
|
|
@ -27,12 +27,12 @@ describe Users::DossiersController, type: :controller do
|
||||||
sign_in dossier.user
|
sign_in dossier.user
|
||||||
end
|
end
|
||||||
it 'returns http success with dossier_id valid' do
|
it 'returns http success with dossier_id valid' do
|
||||||
get :show, params: {id: dossier_id}
|
get :show, params: { id: dossier_id }
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirection vers liste dossier si mauvais dossier ID' do
|
it 'redirection vers liste dossier si mauvais dossier ID' do
|
||||||
get :show, params: {id: siret_not_found}
|
get :show, params: { id: siret_not_found }
|
||||||
expect(response).to redirect_to root_path
|
expect(response).to redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
dossier.state = 'en_instruction'
|
dossier.state = 'en_instruction'
|
||||||
dossier.save
|
dossier.save
|
||||||
|
|
||||||
get :show, params: {id: dossier.id}
|
get :show, params: { id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to root_path }
|
it { is_expected.to redirect_to root_path }
|
||||||
|
@ -51,7 +51,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET #new' do
|
describe 'GET #new' do
|
||||||
subject { get :new, params: {procedure_id: procedure_id} }
|
subject { get :new, params: { procedure_id: procedure_id } }
|
||||||
|
|
||||||
context 'when params procedure_id is present' do
|
context 'when params procedure_id is present' do
|
||||||
context 'when procedure_id is valid' do
|
context 'when procedure_id is valid' do
|
||||||
|
@ -68,7 +68,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
describe 'save user siret' do
|
describe 'save user siret' do
|
||||||
context 'when user have not a saved siret' do
|
context 'when user have not a saved siret' do
|
||||||
context 'when siret is present on request' do
|
context 'when siret is present on request' do
|
||||||
subject { get :new, params: {procedure_id: procedure_id, siret: siret} }
|
subject { get :new, params: { procedure_id: procedure_id, siret: siret } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
|
@ -96,7 +96,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when siret is present on request' do
|
context 'when siret is present on request' do
|
||||||
subject { get :new, params: {procedure_id: procedure_id, siret: siret} }
|
subject { get :new, params: { procedure_id: procedure_id, siret: siret } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
|
@ -203,7 +203,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
sign_in user
|
sign_in user
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: example_siret}} }
|
subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: example_siret } } }
|
||||||
|
|
||||||
it 'create a dossier' do
|
it 'create a dossier' do
|
||||||
expect { subject }.to change { Dossier.count }.by(0)
|
expect { subject }.to change { Dossier.count }.by(0)
|
||||||
|
@ -331,7 +331,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:siret_not_found) { '11111111111111' }
|
let(:siret_not_found) { '11111111111111' }
|
||||||
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret_not_found}} }
|
subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: siret_not_found } } }
|
||||||
|
|
||||||
it 'does not create new dossier' do
|
it 'does not create new dossier' do
|
||||||
expect { subject }.not_to change { Dossier.count }
|
expect { subject }.not_to change { Dossier.count }
|
||||||
|
@ -346,7 +346,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
context 'when REST error 400 is return' do
|
context 'when REST error 400 is return' do
|
||||||
let(:status_entreprise_call) { 400 }
|
let(:status_entreprise_call) { 400 }
|
||||||
|
|
||||||
subject { post :siret_informations, params: {dossier_id: dossier.id, dossier: {siret: siret}} }
|
subject { post :siret_informations, params: { dossier_id: dossier.id, dossier: { siret: siret } } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
|
@ -437,7 +437,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
let!(:dossier_brouillon) { create :dossier, state: "brouillon", user: user }
|
let!(:dossier_brouillon) { create :dossier, state: "brouillon", user: user }
|
||||||
let!(:dossier_not_brouillon) { create :dossier, state: "en_construction", user: user }
|
let!(:dossier_not_brouillon) { create :dossier, state: "en_construction", user: user }
|
||||||
|
|
||||||
subject { delete :destroy, params: {id: dossier.id} }
|
subject { delete :destroy, params: { id: dossier.id } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
|
@ -474,7 +474,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
describe 'PUT #change_siret' do
|
describe 'PUT #change_siret' do
|
||||||
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
|
let(:dossier) { create(:dossier, :with_entreprise, user: user, procedure: procedure) }
|
||||||
|
|
||||||
subject { put :change_siret, params: {dossier_id: dossier.id} }
|
subject { put :change_siret, params: { dossier_id: dossier.id } }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in user
|
sign_in user
|
||||||
|
@ -495,7 +495,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :a_traiter}
|
get :index, params: { liste: :a_traiter }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -508,7 +508,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :en_instruction}
|
get :index, params: { liste: :en_instruction }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -521,7 +521,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :brouillon}
|
get :index, params: { liste: :brouillon }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -534,7 +534,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :termine}
|
get :index, params: { liste: :termine }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -547,7 +547,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :invite}
|
get :index, params: { liste: :invite }
|
||||||
expect(response).to have_http_status(200)
|
expect(response).to have_http_status(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -560,7 +560,7 @@ describe Users::DossiersController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :index, params: {liste: :list_fake}
|
get :index, params: { liste: :list_fake }
|
||||||
expect(response).to redirect_to(users_dossiers_path)
|
expect(response).to redirect_to(users_dossiers_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,12 +10,12 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
|
|
||||||
describe 'GET #show' do
|
describe 'GET #show' do
|
||||||
it 'returns http success' do
|
it 'returns http success' do
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'redirection vers siret si mauvais dossier ID' do
|
it 'redirection vers siret si mauvais dossier ID' do
|
||||||
get :show, params: {dossier_id: bad_dossier_id}
|
get :show, params: { dossier_id: bad_dossier_id }
|
||||||
expect(response).to redirect_to('/')
|
expect(response).to redirect_to('/')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
dossier.state = 'brouillon'
|
dossier.state = 'brouillon'
|
||||||
dossier.save
|
dossier.save
|
||||||
|
|
||||||
get :show, params: {dossier_id: dossier.id}
|
get :show, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to redirect_to root_path }
|
it { is_expected.to redirect_to root_path }
|
||||||
|
@ -38,7 +38,7 @@ describe Users::RecapitulatifController, type: :controller do
|
||||||
describe 'POST #initiate' do
|
describe 'POST #initiate' do
|
||||||
context 'when an user initiate his dossier' do
|
context 'when an user initiate his dossier' do
|
||||||
before do
|
before do
|
||||||
post :initiate, params: {dossier_id: dossier.id}
|
post :initiate, params: { dossier_id: dossier.id }
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'dossier change his state for accepte' do
|
it 'dossier change his state for accepte' do
|
||||||
|
|
|
@ -13,7 +13,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
|
|
||||||
describe 'France Connect attribut' do
|
describe 'France Connect attribut' do
|
||||||
before do
|
before do
|
||||||
post :create, params: {user: {email: user.email, password: user.password}}
|
post :create, params: { user: { email: user.email, password: user.password } }
|
||||||
user.reload
|
user.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
let(:administrateur) { create(:administrateur, email: email, password: password) }
|
let(:administrateur) { create(:administrateur, email: email, password: password) }
|
||||||
|
|
||||||
it 'signs user in' do
|
it 'signs user in' do
|
||||||
post :create, params: {user: {email: user.email, password: user.password}}
|
post :create, params: { user: { email: user.email, password: user.password } }
|
||||||
expect(@response.redirect?).to be(true)
|
expect(@response.redirect?).to be(true)
|
||||||
expect(subject.current_user).to eq(user)
|
expect(subject.current_user).to eq(user)
|
||||||
expect(subject.current_gestionnaire).to be(nil)
|
expect(subject.current_gestionnaire).to be(nil)
|
||||||
|
@ -40,7 +40,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'signs gestionnaire in' do
|
it 'signs gestionnaire in' do
|
||||||
post :create, params: {user: {email: gestionnaire.email, password: gestionnaire.password}}
|
post :create, params: { user: { email: gestionnaire.email, password: gestionnaire.password } }
|
||||||
expect(@response.redirect?).to be(true)
|
expect(@response.redirect?).to be(true)
|
||||||
expect(subject.current_user).to be(nil)
|
expect(subject.current_user).to be(nil)
|
||||||
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
||||||
|
@ -48,7 +48,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'signs administrateur in' do
|
it 'signs administrateur in' do
|
||||||
post :create, params: {user: {email: administrateur.email, password: administrateur.password}}
|
post :create, params: { user: { email: administrateur.email, password: administrateur.password } }
|
||||||
expect(@response.redirect?).to be(true)
|
expect(@response.redirect?).to be(true)
|
||||||
expect(subject.current_user).to be(nil)
|
expect(subject.current_user).to be(nil)
|
||||||
expect(subject.current_gestionnaire).to be(nil)
|
expect(subject.current_gestionnaire).to be(nil)
|
||||||
|
@ -62,7 +62,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'signs user + gestionnaire + administrateur in' do
|
it 'signs user + gestionnaire + administrateur in' do
|
||||||
post :create, params: {user: {email: administrateur.email, password: administrateur.password}}
|
post :create, params: { user: { email: administrateur.email, password: administrateur.password } }
|
||||||
expect(@response.redirect?).to be(true)
|
expect(@response.redirect?).to be(true)
|
||||||
expect(subject.current_user).to eq(user)
|
expect(subject.current_user).to eq(user)
|
||||||
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
expect(subject.current_gestionnaire).to eq(gestionnaire)
|
||||||
|
@ -72,7 +72,7 @@ describe Users::SessionsController, type: :controller do
|
||||||
}
|
}
|
||||||
|
|
||||||
it 'fails to sign in with bad credentials' do
|
it 'fails to sign in with bad credentials' do
|
||||||
post :create, params: {user: {email: user.email, password: 'wrong_password'}}
|
post :create, params: { user: { email: user.email, password: 'wrong_password' } }
|
||||||
expect(@response.unauthorized?).to be(true)
|
expect(@response.unauthorized?).to be(true)
|
||||||
expect(subject.current_user).to be(nil)
|
expect(subject.current_user).to be(nil)
|
||||||
expect(subject.current_gestionnaire).to be(nil)
|
expect(subject.current_gestionnaire).to be(nil)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ChampDecorator do
|
describe ChampDecorator do
|
||||||
let(:champ) {create :champ, type_de_champ: (create :type_de_champ_public, type_champ: type_champ)}
|
let(:champ) { create :champ, type_de_champ: (create :type_de_champ_public, type_champ: type_champ) }
|
||||||
let(:decorator) { champ.decorate }
|
let(:decorator) { champ.decorate }
|
||||||
|
|
||||||
describe 'value' do
|
describe 'value' do
|
||||||
|
|
|
@ -55,21 +55,11 @@ feature 'France Connect Particulier Connexion' do
|
||||||
before do
|
before do
|
||||||
page.find('.login-with-fc').click
|
page.find('.login-with-fc').click
|
||||||
end
|
end
|
||||||
scenario 'he is redirected to france connect particulier page' do
|
|
||||||
expect(page).to have_content('Nouvelle connexion')
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when he fill an email and valid' do
|
|
||||||
before do
|
|
||||||
page.find_by_id('user_email_france_connect').set email
|
|
||||||
page.find_by_id('valid_new_fcp').click
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'he is redirected to user dossiers page' do
|
scenario 'he is redirected to user dossiers page' do
|
||||||
expect(page).to have_content('Dossiers')
|
expect(page).to have_content('Dossiers')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
context 'when is not the first connexion' do
|
context 'when is not the first connexion' do
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -41,7 +41,7 @@ feature 'As a User I wanna create a dossier' do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Identification through siret', vcr: {cassette_name: 'search_ban_paris'}, js: true do
|
scenario 'Identification through siret', vcr: { cassette_name: 'search_ban_paris' }, js: true do
|
||||||
login_as user, scope: :user
|
login_as user, scope: :user
|
||||||
visit commencer_path(procedure_path: procedure_with_siret.path)
|
visit commencer_path(procedure_path: procedure_with_siret.path)
|
||||||
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
expect(page).to have_current_path(users_dossier_path(procedure_with_siret.dossiers.last.id.to_s), only_path: true)
|
||||||
|
|
|
@ -12,7 +12,7 @@ feature 'As a User I want to edit a dossier I own' do
|
||||||
|
|
||||||
context 'After sign_in, I can navigate through dossiers indexes and edit a dossier' do
|
context 'After sign_in, I can navigate through dossiers indexes and edit a dossier' do
|
||||||
scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do
|
scenario 'After sign_in, I can see dossiers "à traiter" (default), and other indexes' do
|
||||||
expect(page.find('#a_traiter')['class'] ).to eq('active procedure-list-element')
|
expect(page.find('#a_traiter')['class']).to eq('active procedure-list-element')
|
||||||
page.find_by_id('brouillon').click
|
page.find_by_id('brouillon').click
|
||||||
page.find_by_id('a_traiter').click
|
page.find_by_id('a_traiter').click
|
||||||
page.find_by_id('en_instruction').click
|
page.find_by_id('en_instruction').click
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe 'user access to the list of his dossier' do
|
describe 'user access to the list of his dossier' do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'en_construction')}
|
let!(:last_updated_dossier) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||||
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
let!(:dossier1) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||||
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
let!(:dossier2) { create(:dossier, :with_entreprise) }
|
||||||
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
let!(:dossier_archived) { create(:dossier, :with_entreprise, user: user, state: 'en_construction') }
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe DossierLinkHelper do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when access as gestionnaire" do
|
context "when access as gestionnaire" do
|
||||||
let(:dossier) { create(:dossier ) }
|
let(:dossier) { create(:dossier) }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
|
|
||||||
before { dossier.procedure.gestionnaires << gestionnaire }
|
before { dossier.procedure.gestionnaires << gestionnaire }
|
||||||
|
@ -17,7 +17,7 @@ describe DossierLinkHelper do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when access as expert" do
|
context "when access as expert" do
|
||||||
let(:dossier) { create(:dossier ) }
|
let(:dossier) { create(:dossier) }
|
||||||
let(:gestionnaire) { create(:gestionnaire) }
|
let(:gestionnaire) { create(:gestionnaire) }
|
||||||
let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
|
let!(:avis) { create(:avis, dossier: dossier, gestionnaire: gestionnaire) }
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe AutoArchiveProcedureJob, type: :job do
|
RSpec.describe AutoArchiveProcedureJob, type: :job do
|
||||||
let!(:procedure) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: nil )}
|
let!(:procedure) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: nil) }
|
||||||
let!(:procedure_hier) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.ago )}
|
let!(:procedure_hier) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.ago) }
|
||||||
let!(:procedure_aujourdhui) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: Date.today )}
|
let!(:procedure_aujourdhui) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: Date.today) }
|
||||||
let!(:procedure_demain) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.from_now )}
|
let!(:procedure_demain) { create(:procedure, published_at: Time.now, archived_at: nil, auto_archive_on: 1.day.from_now) }
|
||||||
|
|
||||||
subject { AutoArchiveProcedureJob.new.perform }
|
subject { AutoArchiveProcedureJob.new.perform }
|
||||||
|
|
||||||
|
@ -18,15 +18,15 @@ RSpec.describe AutoArchiveProcedureJob, type: :job do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when procedures have auto_archive_on set on yesterday or today" do
|
context "when procedures have auto_archive_on set on yesterday or today" do
|
||||||
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'brouillon', archived: false)}
|
let!(:dossier1) { create(:dossier, procedure: procedure_hier, state: 'brouillon', archived: false) }
|
||||||
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
let!(:dossier2) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false) }
|
||||||
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
let!(:dossier3) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false) }
|
||||||
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false)}
|
let!(:dossier4) { create(:dossier, procedure: procedure_hier, state: 'en_construction', archived: false) }
|
||||||
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'en_instruction', archived: false)}
|
let!(:dossier5) { create(:dossier, procedure: procedure_hier, state: 'en_instruction', archived: false) }
|
||||||
let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'accepte', archived: false)}
|
let!(:dossier6) { create(:dossier, procedure: procedure_hier, state: 'accepte', archived: false) }
|
||||||
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refuse', archived: false)}
|
let!(:dossier7) { create(:dossier, procedure: procedure_hier, state: 'refuse', archived: false) }
|
||||||
let!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'sans_suite', archived: false)}
|
let!(:dossier8) { create(:dossier, procedure: procedure_hier, state: 'sans_suite', archived: false) }
|
||||||
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false)}
|
let!(:dossier9) { create(:dossier, procedure: procedure_aujourdhui, state: 'en_construction', archived: false) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
subject
|
subject
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Carto::GeoAPI::Driver do
|
describe Carto::GeoAPI::Driver do
|
||||||
describe '.regions', vcr: {cassette_name: 'geoapi_regions'} do
|
describe '.regions', vcr: { cassette_name: 'geoapi_regions' } do
|
||||||
subject { described_class.regions }
|
subject { described_class.regions }
|
||||||
|
|
||||||
it { expect(subject.code).to eq 200 }
|
it { expect(subject.code).to eq 200 }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.departements', vcr: {cassette_name: 'geoapi_departements'} do
|
describe '.departements', vcr: { cassette_name: 'geoapi_departements' } do
|
||||||
subject { described_class.departements }
|
subject { described_class.departements }
|
||||||
|
|
||||||
it { expect(subject.code).to eq 200 }
|
it { expect(subject.code).to eq 200 }
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe CARTO::SGMAP::API do
|
||||||
before do
|
before do
|
||||||
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
|
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
|
||||||
.with(:body => /.*/,
|
.with(:body => /.*/,
|
||||||
:headers => {'Content-Type' => 'application/json'})
|
:headers => { 'Content-Type' => 'application/json' })
|
||||||
.to_return(status: status, body: body)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
context 'when geojson is empty' do
|
context 'when geojson is empty' do
|
||||||
|
@ -55,7 +55,7 @@ describe CARTO::SGMAP::API do
|
||||||
before do
|
before do
|
||||||
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
|
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
|
||||||
.with(:body => /.*/,
|
.with(:body => /.*/,
|
||||||
:headers => {'Content-Type' => 'application/json'})
|
:headers => { 'Content-Type' => 'application/json' })
|
||||||
.to_return(status: status, body: body)
|
.to_return(status: status, body: body)
|
||||||
end
|
end
|
||||||
context 'when geojson is empty' do
|
context 'when geojson is empty' do
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue