diff --git a/.ruby-version b/.ruby-version index 276cbf9e2..ec1cf33c3 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.0 +2.6.3 diff --git a/.travis.yml b/.travis.yml index 730632329..f94dd3699 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,19 @@ language: ruby +dist: bionic cache: bundler +services: + - postgresql + - elasticsearch +addons: + postgresql: "9.4" + chrome: stable bundler_args: '--without development' env: global: - DATABASE_URL=postgres://postgres@localhost/timeoverflow_test - CC_TEST_REPORTER_ID=025bc15a0fa9afa52d86ee24fea845cf1d363f48a466bcf2cef8ab80c29acb28 +before_install: + - gem install bundler:1.17.3 before_script: - bundle exec rake db:setup - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter @@ -14,7 +23,3 @@ before_script: - sleep 10 after_script: - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -services: - - elasticsearch -addons: - chrome: stable diff --git a/Capfile b/Capfile index da85f9d98..961d5b90b 100644 --- a/Capfile +++ b/Capfile @@ -18,7 +18,7 @@ require 'capistrano/deploy' require 'capistrano/rails' stage = ARGV.first -if stage == 'staging' # Sorry, production is not ready yet +if stage != 'production' # Sorry, production is not ready yet require 'capistrano/rbenv' end diff --git a/Gemfile b/Gemfile index e034724ba..f8b962925 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem "rdiscount" gem 'activeadmin', '~> 1.2.1' gem 'has_scope' gem 'pundit', '~> 2.0.0' -gem 'pg', '0.17.1' +gem 'pg', '0.21.0' gem 'hstore_translate' gem 'dalli' gem 'devise', '~> 4.5.0' @@ -61,8 +61,8 @@ group :test do gem 'shoulda-matchers', '~> 3.1.2' gem 'fabrication' gem 'faker', '~> 1.9' - gem 'capybara', '~> 3.13' - gem 'selenium-webdriver', '~> 3.141' - gem 'webdrivers', '~> 3.0' - gem 'simplecov', '~> 0.16.1', require: false + gem 'capybara', '~> 3.15' + gem 'selenium-webdriver', '~> 3.142' + gem 'webdrivers', '~> 4.1.2' + gem 'simplecov', '~> 0.17', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 1a521d77c..0e5810de5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,21 +1,21 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11) - actionpack (= 4.2.11) - actionview (= 4.2.11) - activejob (= 4.2.11) + actionmailer (4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11) - actionview (= 4.2.11) - activesupport (= 4.2.11) + actionpack (4.2.11.1) + actionview (= 4.2.11.1) + activesupport (= 4.2.11.1) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11) - activesupport (= 4.2.11) + actionview (4.2.11.1) + activesupport (= 4.2.11.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) @@ -32,17 +32,17 @@ GEM ransack (~> 1.3) sass (~> 3.1) sprockets (< 4.1) - activejob (4.2.11) - activesupport (= 4.2.11) + activejob (4.2.11.1) + activesupport (= 4.2.11.1) globalid (>= 0.3.0) - activemodel (4.2.11) - activesupport (= 4.2.11) + activemodel (4.2.11.1) + activesupport (= 4.2.11.1) builder (~> 3.1) - activerecord (4.2.11) - activemodel (= 4.2.11) - activesupport (= 4.2.11) + activerecord (4.2.11.1) + activemodel (= 4.2.11.1) + activesupport (= 4.2.11.1) arel (~> 6.0) - activesupport (4.2.11) + activesupport (4.2.11.1) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) @@ -71,7 +71,7 @@ GEM builder (3.2.3) byebug (4.0.5) columnize (= 0.9.0) - capistrano (3.4.0) + capistrano (3.4.1) i18n rake (>= 10.0.0) sshkit (~> 1.3) @@ -84,7 +84,7 @@ GEM capistrano-rbenv (2.1.3) capistrano (~> 3.1) sshkit (~> 1.3) - capybara (3.13.2) + capybara (3.15.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -92,8 +92,8 @@ GEM rack-test (>= 0.6.3) regexp_parser (~> 1.2) xpath (~> 3.2) - childprocess (0.9.0) - ffi (~> 1.0, >= 1.0.11) + childprocess (1.0.1) + rake (< 13.0) chronic (0.10.2) coderay (1.1.2) coffee-rails (4.1.0) @@ -104,7 +104,7 @@ GEM execjs coffee-script-source (1.8.0) columnize (0.9.0) - concurrent-ruby (1.1.3) + concurrent-ruby (1.1.5) connection_pool (2.2.1) crass (1.0.4) dalli (2.7.2) @@ -117,7 +117,7 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.3) - docile (1.3.1) + docile (1.3.2) domain_name (0.5.20170223) unf (>= 0.0.5, < 1.0.0) dotenv (2.7.1) @@ -147,12 +147,11 @@ GEM i18n (>= 0.7) faraday (0.9.1) multipart-post (>= 1.2, < 3) - ffi (1.10.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic_i18n (0.6.0) gli (2.16.0) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) has_scope (0.6.0) actionpack (>= 3.2, < 5) @@ -206,23 +205,22 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_mime (1.0.1) - mini_portile2 (2.3.0) + mini_portile2 (2.4.0) minitest (5.11.3) multi_json (1.11.2) multipart-post (2.0.0) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (2.9.2) - net_http_ssl_fix (0.0.10) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) netrc (0.11.0) - nokogiri (1.8.5) - mini_portile2 (~> 2.3.0) + nokogiri (1.10.3) + mini_portile2 (~> 2.4.0) orm_adapter (0.5.0) parallel (1.12.1) parser (2.5.0.0) ast (~> 2.4.0) pdf-core (0.7.0) - pg (0.17.1) + pg (0.21.0) polyamorous (1.3.3) activerecord (>= 3.0) powerpack (0.1.1) @@ -239,16 +237,16 @@ GEM rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.11) - actionmailer (= 4.2.11) - actionpack (= 4.2.11) - actionview (= 4.2.11) - activejob (= 4.2.11) - activemodel (= 4.2.11) - activerecord (= 4.2.11) - activesupport (= 4.2.11) + rails (4.2.11.1) + actionmailer (= 4.2.11.1) + actionpack (= 4.2.11.1) + actionview (= 4.2.11.1) + activejob (= 4.2.11.1) + activemodel (= 4.2.11.1) + activerecord (= 4.2.11.1) + activesupport (= 4.2.11.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11) + railties (= 4.2.11.1) sprockets-rails rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) @@ -261,14 +259,14 @@ GEM rails-i18n (4.0.3) i18n (~> 0.6) railties (~> 4.0) - railties (4.2.11) - actionpack (= 4.2.11) - activesupport (= 4.2.11) + railties (4.2.11.1) + actionpack (= 4.2.11.1) + activesupport (= 4.2.11.1) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (3.0.0) raindrops (0.16.0) - rake (12.3.1) + rake (12.3.3) ransack (1.8.6) actionpack (>= 3.0) activerecord (>= 3.0) @@ -277,7 +275,7 @@ GEM polyamorous (~> 1.3.2) rdiscount (2.1.7.1) redis (4.0.1) - regexp_parser (1.3.0) + regexp_parser (1.6.0) responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) @@ -312,7 +310,7 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) - rubyzip (1.2.2) + rubyzip (1.2.3) rufus-scheduler (3.4.2) et-orbi (~> 1.0) sass (3.4.21) @@ -324,8 +322,8 @@ GEM tilt (>= 1.1, < 3) select2-rails (4.0.1) thor (~> 0.14) - selenium-webdriver (3.141.0) - childprocess (~> 0.5) + selenium-webdriver (3.142.3) + childprocess (>= 0.5, < 2.0) rubyzip (~> 1.2, >= 1.2.2) shoulda-matchers (3.1.2) activesupport (>= 4.0.0) @@ -340,7 +338,7 @@ GEM simple_form (3.1.0) actionpack (~> 4.0) activemodel (~> 4.0) - simplecov (0.16.1) + simplecov (0.17.0) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) @@ -356,7 +354,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.8.1) + sshkit (1.20.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) thor (0.20.3) @@ -383,11 +381,10 @@ GEM binding_of_caller (>= 0.7.2) railties (>= 4.0) sprockets-rails (>= 2.0, < 4.0) - webdrivers (3.7.2) - net_http_ssl_fix + webdrivers (4.1.2) nokogiri (~> 1.6) rubyzip (~> 1.0) - selenium-webdriver (~> 3.0) + selenium-webdriver (>= 3.0, < 4.0) whenever (0.9.4) chronic (>= 0.6.3) xpath (3.2.0) @@ -406,7 +403,7 @@ DEPENDENCIES capistrano (~> 3.1) capistrano-rails (~> 1.1) capistrano-rbenv (~> 2.1) - capybara (~> 3.13) + capybara (~> 3.15) coffee-rails dalli database_cleaner (= 1.6.2) @@ -423,7 +420,7 @@ DEPENDENCIES kaminari (~> 1.1.1) letter_opener (= 1.4.1) localeapp (= 2.1.1) - pg (= 0.17.1) + pg (= 0.21.0) prawn (~> 2.2.0) prawn-table (~> 0.2.2) pundit (~> 2.0.0) @@ -436,21 +433,21 @@ DEPENDENCIES rufus-scheduler (~> 3.4.2) sass-rails (~> 5.0.7) select2-rails - selenium-webdriver (~> 3.141) + selenium-webdriver (~> 3.142) shoulda-matchers (~> 3.1.2) sidekiq (= 5.1.3) sidekiq-cron (= 0.6.3) simple_form (>= 3.0.0) - simplecov (~> 0.16.1) + simplecov (~> 0.17) skylight uglifier (= 2.7.2) unicorn web-console (= 2.1.3) - webdrivers (~> 3.0) + webdrivers (~> 4.1.2) whenever RUBY VERSION - ruby 2.3.0p0 + ruby 2.6.3p62 BUNDLED WITH - 1.16.2 + 1.17.3 diff --git a/config/database.yml b/config/database.yml index 61b9c86f2..83e46dd15 100644 --- a/config/database.yml +++ b/config/database.yml @@ -16,7 +16,7 @@ defaults: &defaults collation: 'es_ES.UTF-8' ctype: 'es_ES.UTF-8' template: 'template0' - encoding: utf8 + encoding: 'UTF8' development: <<: *defaults @@ -33,3 +33,7 @@ staging: production: # Set DATABASE_URL environment variable url: <%= ENV['DATABASE_URL'] %> + +next: + <<: *defaults + database: <%= ENV.fetch('DATABASE_NAME', 'timeoverflow_production') %> diff --git a/config/deploy.rb b/config/deploy.rb index d842d9643..eb4d44cf7 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,5 +1,5 @@ # config valid only for current version of Capistrano -lock '3.4.0' +lock '3.4.1' set :application, 'timeoverflow' set :repo_url, 'git@github.com:coopdevs/timeoverflow.git' @@ -57,3 +57,14 @@ end end end + +task "deploy:db:load" do + on primary :db do + within release_path do + with rails_env: fetch(:rails_env) do + execute :rake, "db:schema:load" + end + end + end +end +before "deploy:migrate", "deploy:db:load" if ENV["COLD"] diff --git a/config/deploy/next.rb b/config/deploy/next.rb new file mode 100644 index 000000000..6b603eb07 --- /dev/null +++ b/config/deploy/next.rb @@ -0,0 +1 @@ +server 'next.timeoverflow.org', user: 'timeoverflow', roles: %w(app db web) diff --git a/config/environments/next.rb b/config/environments/next.rb new file mode 100644 index 000000000..1ba241c29 --- /dev/null +++ b/config/environments/next.rb @@ -0,0 +1,98 @@ +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.cache_classes = true + + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. + config.eager_load = true + + # Full error reports are disabled and caching is turned on. + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like + # NGINX, varnish or squid. + # config.action_dispatch.rack_cache = true + + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.serve_static_files = true + + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass + + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = true # false + + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + config.force_ssl = true + + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug + + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production. + # config.cache_store = :mem_cache_store + config.cache_store = :dalli_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + config.action_mailer.raise_delivery_errors = true + + config.action_mailer.delivery_method = :smtp + config.action_mailer.default_url_options = { + host: ENV["MAIL_LINK_HOST"], + protocol: (ENV["MAIL_LINK_PROTO"] || "https") + } + + # Retrieve SMTP configuration from environment variables + # starting with `SMTP_` + smtp_env = Hash[ENV.map do |k,v| + if /^SMTP_(.*)$/ === k + [$1.downcase.to_sym, YAML.load(v)] + end + end.compact] + + if smtp_env.present? + config.action_mailer.smtp_settings = smtp_env + end + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners. + config.active_support.deprecation = :notify + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false +end diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 70a0c7ff9..23159639d 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -347,8 +347,8 @@ ca: mailers_globals: footer: text: "%{organization_name} en" - text_donation: L'associació ADBdT ofereix TimeOverflow de forma gratuïta als Bancs de Temps. Amb una donació de %{href} pots ajudar a mantenir i millorar la plataforma. - text_donation_link: 1€ al mes + text_donation: L'associació ADBdT ofereix TimeOverflow de forma gratuïta als Bancs de Temps. Si vols contribuir a mantenir i millorar la plataforma, %{href}. + text_donation_link: visita aquesta web multi_transfers: multi_transfers: 'Transferències múltiples ' step: diff --git a/config/locales/es.yml b/config/locales/es.yml index 5b9aee99c..08f25c588 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -347,8 +347,8 @@ es: mailers_globals: footer: text: "%{organization_name} en" - text_donation: La asociación ADBdT ofrece TimeOverflow de forma gratuita a los Bancos de Tiempo. Con una donación de %{href} puedes ayudar a mantener y mejorar la plataforma. - text_donation_link: 1€ al mes + text_donation: La asociación ADBdT ofrece TimeOverflow de forma gratuita a los Bancos de Tiempo. Si quieres contribuir a mantener y mejorar la plataforma, %{href}. + text_donation_link: visita esta web multi_transfers: multi_transfers: Transferencias múltiples step: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 950df53d9..e852e5089 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -22,9 +22,9 @@ eu: created_at: Sortua updated_at: Eguneratua inquiry: - is_group: + is_group: Taldeko eskaera offer: - is_group: + is_group: Taldeko eskaintza organization: address: Helbidea city: Herria @@ -73,7 +73,7 @@ eu: notifications: Jasotako jakinarazpenak organization: Antolaketa phone: Telefono zenbakia - push_notifications: + push_notifications: Mugikorrean mezuak jaso registration_date: Erregistratze eguna registration_number: Erabiltzaile kodea superadmin: Sistemaren administratzailea @@ -97,7 +97,7 @@ eu: models: category: one: Gaia - other: '' + other: gaiak comment: one: Azalpena other: Azalpenak @@ -235,10 +235,10 @@ eu: edit_user: Erabiltzailea editatu help_current_password: Zure pasahitza behar dugu aldaketak baieztatzeko help_password: Aldatu nahi ez baduzu, utzi zurian. - password: - password_confirmation: - unhappy: - update: + password: Pasahitza + password_confirmation: Pasahitza baieztatu + unhappy: Triste + update: Eguneratu new: password: Pasahitza password_confirmation: Pasahitza baieztatu. @@ -275,8 +275,10 @@ eu: unlocked: Zure kontua desblokeatua izan da. Sartu jarraitzeko. errors: internal_server_error: - description: - title: + description: |- + Kontsulta honetan oker bat dagoela dirudi. Mezu bat bidali dugu , teknikarien sailera eta ahal bezain laxter konpontzen saiatuko gara. + Sentitzen dugu. + title: Zerbitzariaren barne akatsa. messages: already_confirmed: Baieztatu izan da , Saiatu sartzen. confirmation_period_expired: "%{period}an baieztatzea beharrezkoa da. Eskatu berria." @@ -287,8 +289,8 @@ eu: one: Arazo batek ez du uzten %{resource} gorde dadin. other: "%{count} arazok ez dute uzten %{resource} gorde dadin" not_found: - description: - title: + description: Bila zabiltzan orrialdea ez da exititzen. Helbidea oker idatzia egon daiteke edo orrialdea lekuz aldatua izan da. + title: Ez da topatu global: add_new: Berria sortu all: Dena. @@ -298,21 +300,21 @@ eu: balance: Balantzea cancel_membership: Betirako borratu contact_details: Kontaktuaren datuak - create: + create: Sortu date: Eguna. delete: Ezabatu demote: Ohiko erabiltzaile biurtu edit: Aldaketak egin filter: Iragazkia - from: + from: tik give_time: Denbora eman - home: + home: Etxea information: Informazioa locales_header: Hizkuntza aldatu member_count: Erabiltzaile zenbakia more: 'Gehiago ikusi ' movements: Mugimenduak - next: + next: Hurrengoa promote: Administratzaile bihurtu reason: Arrazoia required_field: Derrigorrez bete beharrekoa @@ -323,7 +325,7 @@ eu: statistics: Estatistika table: actions: Ekintzak - to: + to: ra inquiries: edit: submit: Eskaera aldatu @@ -341,39 +343,39 @@ eu: report: report_title: TXOSTENA locales: - ar: + ar: Arabiera ca: Katalanera - en: Inglesa + en: Ingelesa es: Espainiera - eu: - fr: - gl: - pt: - pt-BR: Portugesa + eu: Euskara + fr: Fantsesa + gl: Galiziera + pt: Portugalera + pt-BR: Portugaldarra mailers_globals: footer: text: "%{organization_name}" text_donation: ADBdt elkarteak TimeOverflow zerbitzua , dohainik eskaintzen die denbora bankuei. Plataforma mantendu eta hobetzeko lagun dezakete %{href} ko emari batekin. text_donation_link: hilean €1ekin multi_transfers: - multi_transfers: + multi_transfers: Transferentzia ugariak step: confirm: - description: - type_of_transfer: + description: Aldaketak baieztatu + type_of_transfer: Transferentzia motak select_type: - description: + description: Transferentzia mota hautatu set_params: - description: + description: Transferitzera zoazen kantitatea zehaztu, iradokizunak , eskaintzak ( baldin badaude) set_source: - description: + description: Denbora transferituko duzun kontua, aukeratu. set_target: - description: - success: + description: Denbora jasoko duten kontuak aukera itzazu. + success: Arrakastatsu eginiko transferentziak types: - many_to_one: - one_to_many: - one_to_one: + many_to_one: Ugaritik bakarrera + one_to_many: Bakarretik ugarira + one_to_one: Banaka offers: edit: submit: Eskaintza aldatu @@ -404,12 +406,12 @@ eu: contact_information: kontaktuaren informazioa pages: about: - app-mobile: - app-mobile-text: + app-mobile: Mugikorrerako Appa + app-mobile-text: TimeOverflow mugikorrean erabiltzeko Appa prest da
App hau Bartzelonako udaletxearen laguntzari esker sortu da . %{impulsem_link} (Barcelona Activa) 2017-2018 programaren bitartez. banner-button: Sartzea eskatzen du banner-subtitle: Martxan jartzen edo erakustaldi bat eginez lagunduko dizugu banner-title: Denbora banku bat al zara? - donate-link: + donate-link: Eman ezazu hilean €1 donate-text: komunitate askori babesteko asmotan ADBdt elkarteak , TimeOverflow plataforma eskaintzen die Denbora Banku guztiei. Hausnar ezazu %{donate_link} mantenu eta berritze lanetan laguntzeko. donate-title: Laguntzan parte hartu empower-adbdt: ADBdt @@ -432,7 +434,7 @@ eu: feature-text-4: Denbora bankuko partaideek, sistemaren bidez, beste partaideekin kontatua egin dezakete feature-text-5: Eskaintza eta eskariak argitaratu feature-text-6: Beste erabiltzaileei orduak ordaindu - impulsem-link: + impulsem-link: Impulsem el que fas subtitle: TimeOverflow librea dohakoa eta kolaborazio bidezkoa da title: Denbora bankuek diseinaturiko softwarea, title2: Denbora bankuentzat @@ -547,7 +549,7 @@ eu: create: Erabiltzaile berria sortu manage_warning: manage_warning_angular: " {{username}} erabiltzailearen onurak, aldatuko diztuzu" - members: + members: Kideak user_created: "%{uid} %{name} erabiltzailea gorde da" member_card: active_ago: diff --git a/config/secrets.yml b/config/secrets.yml index f915c5e4c..8dc976e9c 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -9,3 +9,6 @@ staging: production: secret_key_base: <%= ENV['SECRET_TOKEN'] %> + +next: + secret_key_base: <%= ENV['SECRET_TOKEN'] %> diff --git a/db/schema.rb b/db/schema.rb index bfcd9e381..af9a2d203 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -14,9 +14,7 @@ ActiveRecord::Schema.define(version: 20190412163011) do # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" enable_extension "hstore" - enable_extension "pg_trgm" create_table "accounts", force: :cascade do |t| t.integer "accountable_id" diff --git a/spec/controllers/inquiries_controller_spec.rb b/spec/controllers/inquiries_controller_spec.rb index 694be650f..495c13a4f 100644 --- a/spec/controllers/inquiries_controller_spec.rb +++ b/spec/controllers/inquiries_controller_spec.rb @@ -1,17 +1,19 @@ require "spec_helper" RSpec.describe InquiriesController do - let (:test_organization) { Fabricate(:organization) } - let (:member) { Fabricate(:member, organization: test_organization) } - let (:another_member) { Fabricate(:member, organization: test_organization) } - let (:test_category) { Fabricate(:category) } - let! (:inquiry) do + let(:test_organization) { Fabricate(:organization) } + let(:member) { Fabricate(:member, organization: test_organization) } + let(:another_member) { Fabricate(:member, organization: test_organization) } + let(:test_category) { Fabricate(:category) } + let!(:inquiry) do Fabricate(:inquiry, user: member.user, organization: test_organization, category: test_category) end + include_context "stub browser locale" + before { set_browser_locale("ca") } describe "GET #index" do @@ -40,10 +42,9 @@ describe "POST #create" do context "with valid params" do - context "with a logged user" do + context "with a logged user" do it "creates a new inquiry" do login(another_member.user) - expect do post "create", inquiry: { user: another_member.user, category_id: test_category.id, @@ -57,16 +58,14 @@ describe "PUT #update" do context "with valid params" do context "with a logged user" do + before { login(member.user) } + it "located the requested @inquiry" do - login(member.user) - put "update", id: inquiry.id, inquiry: Fabricate.to_params(:inquiry) expect(assigns(:inquiry)).to eq(inquiry) end it "changes @inquiry's attributes" do - login(member.user) - put "update", id: inquiry.id, inquiry: Fabricate.to_params(:inquiry, @@ -84,7 +83,7 @@ end context "with invalid params" do - context "with a logged user" do + context "with a logged user" do it "does not change @inquiry's attributes" do login(member.user) @@ -103,9 +102,9 @@ end describe "DELETE destroy" do + before { login(member.user) } + it "toggle active field" do - login(member.user) - delete :destroy, id: inquiry.id inquiry.reload @@ -113,8 +112,6 @@ end it "redirects to inquiries#index" do - login(member.user) - delete :destroy, id: inquiry.id expect(response).to redirect_to inquiries_url end diff --git a/spec/features/brand_logo_spec.rb b/spec/features/brand_logo_spec.rb index bd89399f3..9420715a6 100644 --- a/spec/features/brand_logo_spec.rb +++ b/spec/features/brand_logo_spec.rb @@ -39,3 +39,23 @@ end end +RSpec.feature 'sign out' do + let!(:user) do + Fabricate( + :user, + email: 'user@timeoverflow.org', + password: 'papapa22', + terms_accepted_at: 1.day.from_now + ) + end + + context 'without a user' do + it 'does not render the logo' do + sign_in_with(user.email, user.password) + click_link user.email + click_link I18n.t('application.navbar.sign_out') + + expect(page).to have_no_css('.organization-brand-logo') + end + end +end diff --git a/spec/features/sign_in_spec.rb b/spec/features/sign_in_spec.rb index bad23fd2a..03b83d9d9 100644 --- a/spec/features/sign_in_spec.rb +++ b/spec/features/sign_in_spec.rb @@ -7,7 +7,7 @@ context 'with a valid password' do it 'signs the user in' do - expect(Capybara.current_session.driver.browser.manage.cookie_named('_timeoverflow_session')).to be_falsy + Capybara.current_session.driver.browser.manage.delete_cookie('_timeoverflow_session') sign_in_with(user.email, user.password) @@ -19,6 +19,7 @@ context 'with an invalid password' do it 'shows an error' do sign_in_with(user.email, 'wrong_password') + expect(page).to have_content(I18n.t('devise.failure.invalid')) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 44cd48558..daa6c289b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -157,3 +157,20 @@ def set_browser_locale(locale) with.library :rails end end + +# Rails 4.2 call `initialize` inside `recycle!`. However Ruby 2.6 doesn't allow calling `initialize` twice. +# More info: https://github.com/rails/rails/issues/34790 +if Rails.version < "5" + module ActionController + class TestResponse < ActionDispatch::TestResponse + def recycle! + # hack to avoid MonitorMixin double-initialize error + @mon_mutex_owner_object_id = nil + @mon_mutex = nil + initialize + end + end + end +else + puts "⚠ Monkeypatch for ActionController::TestResponse no longer needed! Remove me please!" +end