Commit Graph

49 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
1c76493fa1 Prevent flaky specs because of globalize fallbacks initialization
When any helper, lib, mailer, model or view spec is executed
after a feature, controller or request spec Globalize.fallbacks
returns nil and this can cause some flaky specs. With this
patch we are ensuring to initialize Globalize fallbacks
between specs.

Controller, feature and request specs do not need this patch
because of application_controller is currently initializing
Globalize.fallback on each request.
2019-06-07 19:55:01 +02:00
decabeza
14d85406c3 Fix merge conflicts 2019-04-23 23:38:08 +02:00
Juanjo Bazán
f1e4fb946d updates Devise spec helpers required 2019-04-16 17:28:07 +02:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Javi Martín
dc65c0cdb1 Fix space differences with Madrid's fork 2018-11-30 14:06:33 +01:00
Javi Martín
b153f5f902 Remove redundant Capybara actions
Resetting sessions and driver is automatically done by requiring
'capybara/rspec', as shown by the (lack of) that configuration for RSpec
in the Capybara README, manual testing of those settings, and Capybara's
code itself.
2018-11-30 13:37:16 +01:00
Javi Martín
2f860236a5 Reset page driver after every spec using it
There were some issues because some specs  directly used the driver but
didn't reset it after the test.
2018-11-30 13:34:01 +01:00
Javi Martín
ab870c756a Use Date.current to find published milestones
Using `Date.today` caused some milestones to be published before/after
the date defined by `Rails.application.config.time_zone`.

See also commit AyuntamientoMadird/consul@088c76d for a more detailed
explanation.
2018-11-06 13:02:35 +01:00
Javi Martín
02b8bc6f69 Simplify the way to freeze time in specs 2018-09-19 14:10:18 +02:00
Raimond Garcia
3e4d095e6f Merge pull request #2719 from javierv/2718-fix_flaky_milestone_spec
Fix flaky spec: Budget Investments Show milestones
2018-07-12 16:07:48 +02:00
Javier Martín
de0afe1621 Don't monkey patch ActiveSupport.
It could have side effects (for example, a conflict after upgrading to
Rails 5).

Thanks @aitbw for the suggestion!
2018-07-09 00:06:55 +02:00
Javier Martín
f2ef27d3ae Always set Globalize.locale after I18n.locale.
The test "Budget Investments Show milestones" was failing in certain
cases where `Globalize.locale` had been changed in a previous test.

Since having different values in `Globalize.locale` and `I18n.locale`
has proven to be an issue on the test enviroment, this commit also
changes application code in order to avoid similar situations on
production.

See issue #2718.
2018-07-03 00:52:20 +02:00
Raúl Fuentes
83ca0656b4 Add test for all functinality
new setting set to nil on test to prevent prevent unforeseen
consequences on testing environment
2018-05-22 15:41:10 +02:00
Angel Perez
0a6ee897a7 Configure Capybara sessions to reset after each example 2018-03-27 14:47:51 -04:00
rgarcia
3a182629ca Remove default profiling
This makes tests run a tiny bit faster and cleans up the logs when
running specs locally

We can still configure rspec to run the profiler when we go into improving spec performance
2018-02-06 12:22:34 +01:00
Angel Perez
9a0eca73d7 Fix: Deprecation warnings when running test suite (#2287) 2018-01-09 17:54:46 -04:00
Bertocq
581a6eb3ef Upgrade from factory_girl_rails to factory_bot_rails
Guide at https://github.com/thoughtbot/factory_bot/blob/v4.9.0/UPGRADE_FROM_FACTORY_GIRL.md
2018-01-07 23:32:37 +01:00
Bertocq
1441de5107 Enable RSpec/HookArgument cop and fix issues
To be consistent about before/after arguments, as `:each` or `:example`
 are same and default scopes, best not to send an argument in those
 scenarios.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
2018-01-07 02:07:19 +01:00
rgarcia
b1c785408c brings back knapsackpro binding 2017-12-05 20:10:40 +01:00
rgarcia
834bbf4be3 removes unnecessary binding 2017-12-05 20:10:40 +01:00
rgarcia
e2d4fbd9ce knapsack_pro setup 2017-12-05 20:10:40 +01:00
BertoCQ
8d7a467397 Merge pull request #1746 from consul/rubocop/rails_fixes
Rubocop fixes 🤖: Rails edition 💎🛤
2017-07-11 22:28:55 +02:00
Bertocq
5a358bce17 Fix all Rails/FilePath rubocop issues 2017-07-10 23:08:02 +02:00
Senén Rodero Rodríguez
1f22286e29 Create rspec shared examples to test followable features on any followable entity. 2017-07-07 13:34:54 +02:00
Bertocq
29b58298db Fix Style/NegatedIf rubocop issue 2017-07-05 11:55:52 +02:00
Alberto Miedes Garcés
861a723724 Only show public_voter if votable.total_votes are above threshold 2017-01-07 17:22:18 +01:00
rgarcia
0939479263 removes custom knapsack configuration 2016-11-20 11:58:31 +01:00
rgarcia
a0a4f3c38e removes time offset warning for parallel builds 2016-11-20 11:56:50 +01:00
rgarcia
f3512a4a6f tries to speed up build with knapsack 2016-11-19 20:13:51 +01:00
rgarcia
bb3c4c6399 adds consistency to ruby code style
Keep a blank line before and after private
Keep a blank line before and after protected
Remove extra empty line at class body end
Remove extra blank line
Add final newline
Use 2 (not 3) spaces for indentation
Use 2 (not 4) spaces for indentation
Remove space before comma
Add space after comma
Remove trailing whitespaces
Remove unnecessary spacing
Use snake_case for variable names
Do not use then for multi-line if
Remove unused block argument - i
Use the new Ruby 1.9 hash syntax
Remove unused assignment to variable
Indent when as deep as case
Align attributes
Align end with def
2016-11-15 11:18:43 +01:00
kikito
289182b145 Adds invisible_captcha to proposals, debates & sps 2016-04-27 16:12:32 +02:00
kikito
eda47effc4 Configures tests to minimize flackyness
Reference: https://bibwild.wordpress.com/2016/02/18/struggling-towards-reliable-capybara-javascript-testing/

The only thing I did not do was removing the random order in the tests.
2016-02-24 11:37:07 +01:00
Josep Jaume Rey Peroy
c83b1804e2 Use en as default locale on tests 2015-11-27 18:04:46 +01:00
Juanjo Bazán
bbf96259fc adds controller check for anonymous votes 2015-09-01 17:49:02 +02:00
Juanjo Bazán
3a15895617 loads seeds for testing 2015-09-01 17:49:01 +02:00
kikito
048f7c9b73 Adds bullet to dev & test, but makes it visible only on-demmand
The logs are always stored in log/bullet.log

If you run the specs with `BULLET=true bin/rspec`:
* Any feature test which makes bullet angry will fail

If you run rails with `BULLET=true bin/rails s`:
* It will print the bullet logs in both the rails log and the bullet log
* It will show a footer on each page with the N+1 queries etc.
2015-08-26 17:24:08 +02:00
Juanjo Bazán
862a239d87 fixes specs and makes stats for admins eyes only 2015-08-17 22:00:54 +02:00
Juanjo Bazán
7e1cd2940d Fix conflicts 2015-08-17 21:08:15 +02:00
rgarcia
bea38226fe fixes spacing 2015-08-16 22:45:43 +02:00
Eloy Gomez
d16b2bef28 Include devise helpers in controller specs 2015-08-08 12:58:02 +02:00
rgarcia
3eac8d0bd8 adds email specs [#23] 2015-08-07 20:58:24 +02:00
rgarcia
6803dc9d74 configures email_spec gem [#23] 2015-08-07 20:48:20 +02:00
rgarcia
24924497f3 fixes conflicts [#21] 2015-07-27 21:55:43 +02:00
kikito
d8367464c6 Configure DatabaseCleaner exactly like it says on its documentation 2015-07-27 19:05:15 +02:00
rgarcia
39711caaf6 fixes transaction fixtures call [#21] 2015-07-27 11:39:25 +02:00
rgarcia
0aaa8169f0 tmp commit [#21] 2015-07-27 11:12:55 +02:00
rgarcia
26b16ee874 configures database_cleaner 2015-07-26 13:44:22 +02:00
rgarcia
8a3ca2a77f configures factory_girl [#5] 2015-07-16 19:24:54 +02:00
rgarcia
4aa16e78c2 configure rspec 2015-07-15 13:59:26 +02:00