diff --git a/Gemfile b/Gemfile index 3f6d2b90e..09a70cfe5 100644 --- a/Gemfile +++ b/Gemfile @@ -31,7 +31,7 @@ gem 'devise' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development - +gem 'acts-as-taggable-on' gem "responders" gem 'foundation-rails' gem 'acts_as_votable' diff --git a/Gemfile.lock b/Gemfile.lock index d0dfefaaa..9124a06fd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,6 +36,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + acts-as-taggable-on (3.5.0) + activerecord (>= 3.2, < 5) acts_as_votable (0.10.0) arel (6.0.2) bcrypt (3.1.10) @@ -189,6 +191,7 @@ PLATFORMS ruby DEPENDENCIES + acts-as-taggable-on acts_as_votable byebug capybara diff --git a/app/assets/stylesheets/debates.scss b/app/assets/stylesheets/debates.scss new file mode 100644 index 000000000..cb4df7794 --- /dev/null +++ b/app/assets/stylesheets/debates.scss @@ -0,0 +1,7 @@ +#tag_cloud { + width: 400px; + line-height: 1.6em; + .s { font-size: 0.8em; } + .m { font-size: 1.2em; } + .l { font-size: 1.8em; } +} \ No newline at end of file diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index 53545887e..2bf5a0024 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -1,8 +1,13 @@ class DebatesController < ApplicationController before_action :set_debate, only: [:show, :edit, :update] - + before_action :authenticate_user!, only: [:new, :create] + def index - @debates = Debate.all + if params[:tag] + @debates = Debate.tagged_with(params[:tag]) + else + @debates = Debate.all + end end def show @@ -16,7 +21,9 @@ class DebatesController < ApplicationController end def create - @debate = Debate.create(debate_params) + @debate = Debate.new(debate_params) + @debate.author = current_user + @debate.save respond_with @debate end @@ -32,7 +39,7 @@ class DebatesController < ApplicationController end def debate_params - params.require(:debate).permit(:title, :description, :external_link, :terms_of_service) + params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service) end end diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb new file mode 100644 index 000000000..4ccafe235 --- /dev/null +++ b/app/controllers/registrations_controller.rb @@ -0,0 +1,9 @@ +class RegistrationsController < Devise::RegistrationsController + + private + + def sign_up_params + params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation) + end + +end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be7945..e3f79f023 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,7 @@ module ApplicationHelper + + def tags(debate) + debate.tag_list.map { |tag| link_to sanitize(tag), debates_path(tag: tag) }.join(', ').html_safe + end + end diff --git a/app/models/debate.rb b/app/models/debate.rb index 5e810d061..727d805e7 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -1,9 +1,13 @@ require 'numeric' class Debate < ActiveRecord::Base acts_as_votable + acts_as_taggable + + belongs_to :author, class_name: 'User', foreign_key: 'author_id' validates :title, presence: true validates :description, presence: true + validates :author, presence: true validates :terms_of_service, acceptance: { allow_nil: false }, on: :create @@ -24,4 +28,5 @@ class Debate < ActiveRecord::Base def total_votes votes_for.size end + end \ No newline at end of file diff --git a/app/models/user.rb b/app/models/user.rb index c8220270d..9c55bc59e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,6 +1,8 @@ class User < ActiveRecord::Base - # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable + + def name + "#{first_name} #{last_name}" + end end diff --git a/app/views/debates/_debate.html.erb b/app/views/debates/_debate.html.erb index 4f99c9df9..d6c899bbe 100644 --- a/app/views/debates/_debate.html.erb +++ b/app/views/debates/_debate.html.erb @@ -1,6 +1,12 @@ -
+

<%= link_to debate.title, debate %>

<%= debate.description %>

-

Creado el: <%= l debate.created_at.to_date %>

+ +

+ Creado el: <%= l debate.created_at.to_date %> + por: <%= debate.author.name %> +

+ +

<%= render 'shared/tags', debate: debate %>

-

\ No newline at end of file +



\ No newline at end of file diff --git a/app/views/debates/_form.html.erb b/app/views/debates/_form.html.erb index 98de3c538..9d0af3892 100644 --- a/app/views/debates/_form.html.erb +++ b/app/views/debates/_form.html.erb @@ -20,7 +20,12 @@

Explica con todo el detalle que puedas y de una manera sencilla la idea y que crees que conseguiríamos con ella

<%= f.text_area :description %> - <% if action_name == 'new' %> +
+ <%= f.label :tag_list, "Temas (separados por comas)" %>
+ <%= f.text_field :tag_list, value: @debate.tag_list.to_s %> +
+ + <% if @debate.new_record? %> <%= f.check_box :terms_of_service %> Acepto la política de privacidad y el aviso legal <% end %> diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index ffd5803ee..50ac86a50 100644 --- a/app/views/debates/index.html.erb +++ b/app/views/debates/index.html.erb @@ -4,5 +4,7 @@ <%= render @debates %>
-
+<%= render 'shared/tag_cloud' %> + +

<%= link_to 'New Debate', new_debate_path %> diff --git a/app/views/debates/show.html.erb b/app/views/debates/show.html.erb index 132152b3b..5319939bd 100644 --- a/app/views/debates/show.html.erb +++ b/app/views/debates/show.html.erb @@ -1,7 +1,10 @@

<%= @debate.title %>

<%= @debate.description %>

-

Creado el: <%= l @debate.created_at.to_date %>

+

+ Creado el: <%= l @debate.created_at.to_date %> + por: <%= @debate.author.name %> +

@@ -18,6 +21,9 @@ Votos <%= @debate.total_votes %>
+

+<%= render 'shared/tags', debate: @debate %> +

<%= link_to 'Edit', edit_debate_path(@debate) %> | diff --git a/app/views/devise/menu/_login_items.html.erb b/app/views/devise/menu/_login_items.html.erb new file mode 100644 index 000000000..89b9ad253 --- /dev/null +++ b/app/views/devise/menu/_login_items.html.erb @@ -0,0 +1,9 @@ +<% if user_signed_in? %> +
  • + <%= link_to('Logout', destroy_user_session_path, :method => :delete) %> +
  • +<% else %> +
  • + <%= link_to('Login', new_user_session_path) %> +
  • +<% end %> \ No newline at end of file diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 5a238ce6e..8c4da21cd 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -3,9 +3,20 @@ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> <%= devise_error_messages! %> + +
    + <%= f.label :first_name %>
    + <%= f.text_field :first_name, autofocus: true %> +
    + +
    + <%= f.label :last_name %>
    + <%= f.text_field :last_name %> +
    +
    <%= f.label :email %>
    - <%= f.email_field :email, autofocus: true %> + <%= f.email_field :email %>
    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 10302f65f..bb1a5c28f 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -14,6 +14,9 @@

    <%= notice %>

    <%= alert %>

    + + <%= render 'devise/menu/login_items' %> + <%= yield %> \ No newline at end of file diff --git a/app/views/shared/_tag_cloud.html.erb b/app/views/shared/_tag_cloud.html.erb new file mode 100644 index 000000000..bb61c5a4d --- /dev/null +++ b/app/views/shared/_tag_cloud.html.erb @@ -0,0 +1,5 @@ +
    + <% tag_cloud Debate.tag_counts, %w[s m l] do |tag, css_class| %> + <%= link_to sanitize("#{tag.name}(#{tag.taggings_count})"), debates_path(tag: tag.name), class: css_class %> + <% end %> +
    diff --git a/app/views/shared/_tags.html.erb b/app/views/shared/_tags.html.erb new file mode 100644 index 000000000..990c0d41f --- /dev/null +++ b/app/views/shared/_tags.html.erb @@ -0,0 +1,3 @@ +<% if debate.tags.any? %> + Temas: <%= tags(debate) %> +<% end %> \ No newline at end of file diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb new file mode 100644 index 000000000..ead1691e4 --- /dev/null +++ b/config/initializers/acts_as_taggable_on.rb @@ -0,0 +1 @@ +ActsAsTaggableOn.delimiter = ',' \ No newline at end of file diff --git a/config/locales/devise.es.yml b/config/locales/devise.es.yml new file mode 100644 index 000000000..f39099f57 --- /dev/null +++ b/config/locales/devise.es.yml @@ -0,0 +1,58 @@ +es: + devise: + confirmations: + confirmed: "Tu cuenta ha sido confirmada." + send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña." + send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos recibirás un correo electrónico en unos minutos con instrucciones sobre cómo restablecer tu contraseña." + failure: + already_authenticated: "Ya has iniciado sesión." + inactive: "Tu cuenta aún no ha sido activada." + invalid: "%{authentication_keys} o contraseña inválidos." + locked: "Tu cuenta ha sido bloqueada." + last_attempt: "Tienes un último intento antes de que tu cuenta sea bloqueada." + not_found_in_database: "%{authentication_keys} o contraseña inválidos." + timeout: "Tu sesión ha expirado, por favor inicia sesión nuevamente para continuar." + unauthenticated: "Necesitas iniciar sesión o registrarte para continuar." + unconfirmed: "Debes confirmar tu cuenta para continuar." + mailer: + confirmation_instructions: + subject: "Instrucciones de confirmación" + reset_password_instructions: + subject: "Instrucciones para restablecer tu contraseña" + unlock_instructions: + subject: "Instrucciones de desbloqueo" + omniauth_callbacks: + failure: "No se te ha podido autorizar de %{kind} debido a \"%{reason}\"." + success: "Identificado correctamente de %{kind}." + passwords: + no_token: "No puedes acceder a esta página si no es a través de un enlace para restablecer la contraseña. Si has accedido desde el enlace para restablecer la contraseña, asegúrate de que la URL esté completa." + send_instructions: "Recibirás un correo electrónico con instrucciones sobre cómo restablecer tu contraseña en unos minutos." + send_paranoid_instructions: "Si tu correo electrónico existe en nuestra base de datos, recibirás un enlace para restablecer la contraseña en unos minutos." + updated: "Tu contraseña ha cambiado correctamente. Has sido identificado correctamente." + updated_not_active: "Tu contraseña se ha cambiado correctamente." + registrations: + destroyed: "¡Adiós! Tu cuenta ha sido cancelada. Esperamos volver a verte pronto." + signed_up: "¡Bienvenido! Has sido identificado." + signed_up_but_inactive: "Te has registrado correctamente, pero no has podido iniciar sesión porque tu cuenta no ha sido activada." + signed_up_but_locked: "Te has registrado correctamente, pero no has podido iniciar sesión porque tu cuenta está bloqueada." + signed_up_but_unconfirmed: "Se te ha enviado un mensaje con un enlace de confirmación. Por favor visita el enlace para activar tu cuenta." + update_needs_confirmation: "Has actualizado tu cuenta correctamente, sin embargo necesitamos verificar tu nueva cuenta de correo. Por favor revisa tu correo electrónico y visita el enlace para finalizar la confirmación de tu nueva dirección de correo electrónico." + updated: "Has actualizado tu cuenta correctamente." + sessions: + signed_in: "Has iniciado sesión correctamente." + signed_out: "Has cerrado la sesión correctamente." + already_signed_out: "Has cerrado la sesión correctamente." + unlocks: + send_instructions: "Recibirás un correo electrónico en unos minutos con instrucciones sobre cómo desbloquear tu cuenta." + send_paranoid_instructions: "Si tu cuenta existe, recibirás un correo electrónico en unos minutos con instrucciones sobre cómo desbloquear tu cuenta." + unlocked: "Tu cuenta ha sido desbloqueada. Por favor inicia sesión para continuar." + errors: + messages: + already_confirmed: "ya has sido confirmado, por favor intenta iniciar sesión." + confirmation_period_expired: "necesitas ser confirmado en %{period}, por favor vuelve a solicitarla." + expired: "ha expirado, por favor vuelve a solicitarla." + not_found: "no se ha encontrado." + not_locked: "no estaba bloqueado." + not_saved: + one: "1 error impidió que este %{resource} fuera guardado:" + other: "%{count} errores impidieron que este %{resource} fuera guardado:" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3124c7852..948beedb8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,6 @@ Rails.application.routes.draw do - devise_for :users + devise_for :users, :controllers => { registrations: 'registrations' } + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb b/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb new file mode 100644 index 000000000..3be763bfd --- /dev/null +++ b/db/migrate/20150717164054_add_first_name_and_last_name_to_users.rb @@ -0,0 +1,6 @@ +class AddFirstNameAndLastNameToUsers < ActiveRecord::Migration + def change + add_column :users, :first_name, :string + add_column :users, :last_name, :string + end +end diff --git a/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..2cf5741f8 --- /dev/null +++ b/db/migrate/20150718075238_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -0,0 +1,25 @@ +# This migration comes from acts_as_taggable_on_engine (originally 1) +class ActsAsTaggableOnMigration < ActiveRecord::Migration + def self.up + create_table :tags do |t| + t.string :name + end + + create_table :taggings do |t| + t.references :tag + t.references :taggable, polymorphic: true + t.references :tagger, polymorphic: true + t.string :context, limit: 128 + t.datetime :created_at + end + + add_index :tags, :name, unique: true + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end + + def self.down + drop_table :taggings + drop_table :tags + end +end diff --git a/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 000000000..6bbd5ab3d --- /dev/null +++ b/db/migrate/20150718075337_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from acts_as_taggable_on_engine (originally 3) +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration + def self.up + add_column :tags, :taggings_count, :integer, default: 0 + end + + def self.down + remove_column :tags, :taggings_count + end +end diff --git a/db/schema.rb b/db/schema.rb index 3ead9ea4e..a9958aba6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150717180105) do +ActiveRecord::Schema.define(version: 20150718075337) do create_table "debates", force: :cascade do |t| t.string "title" @@ -21,6 +21,26 @@ ActiveRecord::Schema.define(version: 20150717180105) do t.datetime "updated_at", null: false end + create_table "taggings", force: :cascade do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", limit: 128 + t.datetime "created_at" + end + + add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id" + add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + + create_table "tags", force: :cascade do |t| + t.string "name" + t.integer "taggings_count", default: 0 + end + + add_index "tags", ["name"], name: "index_tags_on_name", unique: true + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -34,6 +54,8 @@ ActiveRecord::Schema.define(version: 20150717180105) do t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "first_name" + t.string "last_name" end add_index "users", ["email"], name: "index_users_on_email", unique: true diff --git a/spec/factories.rb b/spec/factories.rb index eb65ecdca..b34315ef0 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,8 +1,17 @@ FactoryGirl.define do + + factory :user do + first_name 'Manuela' + last_name 'Carmena' + sequence(:email) { |n| "manuela#{n}@madrid.es" } + password 'judgmentday' + end + factory :debate do title 'Debate title' description 'Debate description' terms_of_service '1' + association :author, factory: :user end factory :vote do diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 48f7d3b62..ecc4892af 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -12,6 +12,7 @@ feature 'Debates' do expect(page).to have_content "Debate title" expect(page).to have_content "Debate description" expect(page).to have_content "Creado el: #{I18n.l Date.today}" + expect(page).to have_content "por: #{Debate.first.author.name}" end end @@ -23,9 +24,13 @@ feature 'Debates' do expect(page).to have_content "Debate title" expect(page).to have_content "Debate description" expect(page).to have_content "Creado el: #{I18n.l Date.today}" + expect(page).to have_content "por: #{debate.author.name}" end scenario 'Create' do + author = create(:user) + login_as(author) + visit new_debate_path fill_in 'debate_title', with: 'Acabar con los desahucios' fill_in 'debate_description', with: 'Esto es un tema muy importante porque...' @@ -36,6 +41,8 @@ feature 'Debates' do expect(page).to have_content 'Debate creado correctamente' expect(page).to have_content 'Acabar con los desahucios' expect(page).to have_content 'Esto es un tema muy importante porque...' + expect(page).to have_content "Creado el: #{I18n.l Date.today}" + expect(page).to have_content "por: #{author.name}" end scenario 'Update' do diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb new file mode 100644 index 000000000..61376480d --- /dev/null +++ b/spec/features/tags_spec.rb @@ -0,0 +1,99 @@ +require 'rails_helper' + +feature 'Tags' do + + scenario 'Index' do + earth = create(:debate, tag_list: 'Medio Ambiente') + money = create(:debate, tag_list: 'Economía') + + visit debates_path + + within "#debate-#{earth.id}" do + expect(page).to have_content "Temas: Medio Ambiente" + end + + within "#debate-#{money.id}" do + expect(page).to have_content "Temas: Economía" + end + end + + scenario 'Filtered' do + 2.times { create(:debate, tag_list: 'Salud') } + 2.times { create(:debate, tag_list: 'Hacienda') } + + visit debates_path + first(:link, "Salud").click + + expect(page).to have_css('.debate', count: 2) + expect(page).to have_content('Temas: Salud') + expect(page).to_not have_content('Temas: Hacienda') + end + + scenario 'Show' do + debate = create(:debate, tag_list: 'Hacienda, Economía') + + visit debate_path(debate) + + expect(page).to have_content "Temas: Hacienda, Economía" + end + + scenario 'Tag Cloud' do + 1.times { create(:debate, tag_list: 'Medio Ambiente') } + 5.times { create(:debate, tag_list: 'Corrupción') } + 10.times { create(:debate, tag_list: 'Economía') } + + visit debates_path + + within "#tag-cloud" do + expect(page).to have_css(".s", text: "Medio Ambiente(1)") + expect(page).to have_css(".m", text: "Corrupción(5)") + expect(page).to have_css(".l", text: "Economía(10)") + end + end + + scenario 'Create' do + user = create(:user) + login_as(user) + + visit new_debate_path + fill_in 'debate_title', with: 'Title' + fill_in 'debate_description', with: 'Description' + check 'debate_terms_of_service' + + fill_in 'debate_tag_list', with: "Impuestos, Economía, Hacienda" + + click_button 'Crear Debate' + + expect(page).to have_content 'Debate creado correctamente' + expect(page).to have_content 'Temas: Impuestos, Economía, Hacienda' + end + + scenario 'Update' do + debate = create(:debate, tag_list: 'Economía') + + login_as(debate.author) + visit edit_debate_path(debate) + + expect(page).to have_selector("input[value='Economía']") + + fill_in 'debate_tag_list', with: "Economía, Hacienda" + click_button 'Actualizar Debate' + + expect(page).to have_content 'Debate actualizado correctamente' + expect(page).to have_content 'Temas: Economía, Hacienda' + end + + scenario 'Delete' do + debate = create(:debate, tag_list: 'Economía') + + login_as(debate.author) + visit edit_debate_path(debate) + + fill_in 'debate_tag_list', with: "" + click_button 'Actualizar Debate' + + expect(page).to have_content 'Debate actualizado correctamente' + expect(page).to_not have_content 'Temas:' + end + +end \ No newline at end of file diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb new file mode 100644 index 000000000..30755c56f --- /dev/null +++ b/spec/features/users_spec.rb @@ -0,0 +1,43 @@ +require 'rails_helper' + +feature 'Users' do + + scenario 'Sign up' do + visit '/' + click_link 'Login' + click_link 'Sign up' + + fill_in 'user_first_name', with: 'Manuela' + fill_in 'user_last_name', with: 'Carmena' + fill_in 'user_email', with: 'manuela@madrid.es' + fill_in 'user_password', with: 'judgementday' + fill_in 'user_password_confirmation', with: 'judgementday' + + click_button 'Sign up' + + expect(page).to have_content '¡Bienvenido! Has sido identificado.' + end + + scenario 'Sign in' do + user = create(:user, email: 'manuela@madrid.es', password: 'judgementday') + + visit '/' + click_link 'Login' + fill_in 'user_email', with: 'manuela@madrid.es' + fill_in 'user_password', with: 'judgementday' + click_button 'Log in' + + expect(page).to have_content 'Has iniciado sesión correctamente.' + end + + scenario 'Sign out' do + user = create(:user) + login_as(user) + + visit "/" + click_link 'Logout' + + expect(page).to have_content 'Has cerrado la sesión correctamente.' + end + +end diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index 490eea985..f277f1d7b 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -10,6 +10,11 @@ describe Debate do expect(@debate).to be_valid end + it "should not be valid without an author" do + @debate.author = nil + expect(@debate).to_not be_valid + end + it "should not be valid without a title" do @debate.title = nil expect(@debate).to_not be_valid diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 5c5fedee7..fc6f2bb68 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -6,6 +6,10 @@ require 'spec_helper' require 'rspec/rails' require 'capybara/rails' require 'capybara/rspec' + +include Warden::Test::Helpers +Warden.test_mode! + ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config|