Merge 7e7dadac88 into adfa9cc871
This commit is contained in:
commit
dab1885cbf
10 changed files with 382 additions and 18 deletions
1
Gemfile
1
Gemfile
|
|
@ -76,6 +76,7 @@ group :development, :test do
|
||||||
gem 'rspec', '>= 3.0.0.beta'
|
gem 'rspec', '>= 3.0.0.beta'
|
||||||
gem 'rspec-rails', '>= 3.0.0.beta'
|
gem 'rspec-rails', '>= 3.0.0.beta'
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
|
gem 'database_cleaner'
|
||||||
end
|
end
|
||||||
|
|
||||||
# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
|
# FIXME: We should use http://weblog.rubyonrails.org/2012/3/21/strong-parameters/
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ GEM
|
||||||
thor
|
thor
|
||||||
d3_rails (3.4.6)
|
d3_rails (3.4.6)
|
||||||
railties (>= 3.1.0)
|
railties (>= 3.1.0)
|
||||||
|
database_cleaner (1.2.0)
|
||||||
devise (3.2.4)
|
devise (3.2.4)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
|
@ -305,6 +306,7 @@ DEPENDENCIES
|
||||||
cocoon
|
cocoon
|
||||||
coveralls
|
coveralls
|
||||||
d3_rails
|
d3_rails
|
||||||
|
database_cleaner
|
||||||
devise
|
devise
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
formtastic (~> 2.3.0.rc3)
|
formtastic (~> 2.3.0.rc3)
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,23 @@ class Admin::ConferenceController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@conference = Conference.new(params[:conference])
|
@conference = Conference.new(params[:conference])
|
||||||
if @conference.save
|
if @conference.save
|
||||||
redirect_to(admin_conference_path(:id => @conference.short_title), :notice => 'Conference was successfully created.')
|
redirect_to(admin_conference_path(id: @conference.short_title),
|
||||||
|
notice: 'Conference was successfully created.')
|
||||||
else
|
else
|
||||||
render :action => "new"
|
render action: 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@conference = Conference.find_by(short_title: params[:id])
|
@conference = Conference.find_by(short_title: params[:id])
|
||||||
@conference.update_attributes(params[:conference])
|
short_title = @conference.short_title
|
||||||
flash[:notice] = "Updated Conference"
|
if @conference.update_attributes(params[:conference])
|
||||||
redirect_to(admin_conference_path(:id => @conference.short_title), :notice => 'Conference was successfully updated.')
|
redirect_to(admin_conference_path(id: @conference.short_title),
|
||||||
|
notice: 'Conference was successfully updated.')
|
||||||
|
else
|
||||||
|
redirect_to(admin_conference_path(id: short_title),
|
||||||
|
notice: 'Conference update failed.')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
@ -34,7 +40,7 @@ class Admin::ConferenceController < ApplicationController
|
||||||
@conference = Conference.find_by(short_title: params[:id])
|
@conference = Conference.find_by(short_title: params[:id])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.json { render :json => @conference.to_json }
|
format.json { render json: @conference.to_json }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ class User < ActiveRecord::Base
|
||||||
accepts_nested_attributes_for :person
|
accepts_nested_attributes_for :person
|
||||||
accepts_nested_attributes_for :roles
|
accepts_nested_attributes_for :roles
|
||||||
|
|
||||||
before_save :setup_role
|
before_create :setup_role
|
||||||
before_create :create_person
|
before_create :create_person
|
||||||
|
|
||||||
def role?(role)
|
def role?(role)
|
||||||
Rails.logger.debug("Checking role in user")
|
Rails.logger.debug("Checking role in user")
|
||||||
return !!self.roles.find_by_name(role.to_s.camelize)
|
!!roles.find_by_name(role.to_s.downcase.camelize)
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_roles
|
def get_roles
|
||||||
|
|
@ -27,12 +27,14 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup_role
|
def setup_role
|
||||||
if self.id == 1
|
if User.count == 0
|
||||||
self.role_ids = [3]
|
admin = Role.where(name: 'Admin').first
|
||||||
|
self.role_ids = [admin.id] unless admin.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.role_ids.empty?
|
if self.role_ids.empty?
|
||||||
self.role_ids = [1]
|
participant = Role.where(name: 'Participant').first
|
||||||
|
self.role_ids = [participant.id] unless participant.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
231
spec/controllers/conferences_controller_spec.rb
Normal file
231
spec/controllers/conferences_controller_spec.rb
Normal file
|
|
@ -0,0 +1,231 @@
|
||||||
|
#!/bin/env ruby
|
||||||
|
# encoding: utf-8
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Admin::ConferenceController do
|
||||||
|
|
||||||
|
shared_examples 'access as administration or organizer' do
|
||||||
|
|
||||||
|
describe 'PATCH #update' do
|
||||||
|
context 'valid attributes' do
|
||||||
|
it 'locates the requested @conference' do
|
||||||
|
patch :update, id: @conference.short_title, conference:
|
||||||
|
attributes_for(:conference, title: 'Example Con')
|
||||||
|
|
||||||
|
expect(assigns(:conference)).to eq(@conference)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'changes @conference attributes' do
|
||||||
|
patch :update, id: @conference.short_title, conference:
|
||||||
|
attributes_for(:conference, title: 'Example Con',
|
||||||
|
short_title: 'ExCon')
|
||||||
|
|
||||||
|
@conference.reload
|
||||||
|
expect(@conference.title).to eq('Example Con')
|
||||||
|
expect(@conference.short_title).to eq('ExCon')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to the updated @conference' do
|
||||||
|
patch :update, id: @conference.short_title, conference:
|
||||||
|
attributes_for(:conference, title: 'Example Con')
|
||||||
|
|
||||||
|
expect(response).to redirect_to admin_conference_path(
|
||||||
|
@conference.short_title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'invalid attributes' do
|
||||||
|
it 'does not change conference attributes' do
|
||||||
|
patch :update, id: @conference.short_title, conference:
|
||||||
|
attributes_for(:conference, title: 'Example Con',
|
||||||
|
short_title: nil)
|
||||||
|
|
||||||
|
@conference.reload
|
||||||
|
expect(@conference.title).to eq('The dog and pony show')
|
||||||
|
expect(@conference.short_title).to eq('dps14')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 're-renders the #show template' do
|
||||||
|
patch :update, id: @conference.short_title, conference:
|
||||||
|
attributes_for(:conference, title: 'Example Con',
|
||||||
|
short_title: nil)
|
||||||
|
|
||||||
|
expect(response).to redirect_to admin_conference_path(
|
||||||
|
@conference.short_title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST #create' do
|
||||||
|
context 'with valid attributes' do
|
||||||
|
it 'saves the conference to the database' do
|
||||||
|
expected = expect do
|
||||||
|
post :create, conference:
|
||||||
|
attributes_for(:conference, short_title: 'dps15')
|
||||||
|
end
|
||||||
|
expected.to change { Conference.count }.by 1
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to conference#show' do
|
||||||
|
post :create, conference:
|
||||||
|
attributes_for(:conference, short_title: 'dps15')
|
||||||
|
|
||||||
|
expect(response).to redirect_to admin_conference_path(
|
||||||
|
assigns[:conference].short_title)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with invalid attributes' do
|
||||||
|
it 'does not save the conference to the database' do
|
||||||
|
expected = expect do
|
||||||
|
post :create, conference:
|
||||||
|
attributes_for(:conference, short_title: nil)
|
||||||
|
end
|
||||||
|
expected.to_not change { Conference.count }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 're-renders the new template' do
|
||||||
|
post :create, conference:
|
||||||
|
attributes_for(:conference, short_title: nil)
|
||||||
|
expect(response).to render_template :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with duplicate conference short title' do
|
||||||
|
it 'does not save the conference to the database' do
|
||||||
|
expected = expect do
|
||||||
|
post :create, conference:
|
||||||
|
attributes_for(:conference)
|
||||||
|
end
|
||||||
|
expected.to_not change { Conference.count }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 're-renders the new template' do
|
||||||
|
post :create, conference: attributes_for(:conference)
|
||||||
|
expect(response).to render_template :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #show' do
|
||||||
|
it 'assigns the requested conference to @conference' do
|
||||||
|
get :show, id: @conference.short_title
|
||||||
|
expect(assigns(:conference)).to eq @conference
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the show template' do
|
||||||
|
get :show, id: @conference.short_title
|
||||||
|
expect(response).to render_template :show
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #index' do
|
||||||
|
it 'populates an array with conferences' do
|
||||||
|
con2 = create(:conference, short_title: 'dps15',
|
||||||
|
title: 'The dog and pony show 2015')
|
||||||
|
get :index
|
||||||
|
expect(assigns(:conferences)).to match_array([@conference, con2])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the index template' do
|
||||||
|
get :index
|
||||||
|
expect(response).to render_template :index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #new' do
|
||||||
|
it 'assigns a new conference to @conference' do
|
||||||
|
get :new
|
||||||
|
expect(assigns(:conference)).to be_a_new(Conference)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders the :new template' do
|
||||||
|
get :new
|
||||||
|
expect(response).to render_template :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'administrator access' do
|
||||||
|
before(:each) do
|
||||||
|
@conference = create(:conference)
|
||||||
|
@admin = create(:admin)
|
||||||
|
sign_in(@admin)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'access as administration or organizer'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'organizer access' do
|
||||||
|
before(:each) do
|
||||||
|
@conference = create(:conference)
|
||||||
|
@organizer = create(:organizer)
|
||||||
|
sign_in(@organizer)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'access as administration or organizer'
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'access as participant or guest' do |success_path|
|
||||||
|
describe 'GET #show' do
|
||||||
|
it 'requires admin privileges' do
|
||||||
|
get :show, id: @conference.short_title
|
||||||
|
expect(response).to redirect_to(send(success_path))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #index' do
|
||||||
|
it 'requires admin privileges' do
|
||||||
|
get :index
|
||||||
|
expect(response).to redirect_to(send(success_path))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #new' do
|
||||||
|
it 'requires admin privileges' do
|
||||||
|
get :new
|
||||||
|
expect(response).to redirect_to(send(success_path))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST #create' do
|
||||||
|
it 'requires admin privileges' do
|
||||||
|
post :create, conference: attributes_for(:conference,
|
||||||
|
short_title: 'ExCon')
|
||||||
|
expect(response).to redirect_to(send(success_path))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'PATCH #update' do
|
||||||
|
it 'requires admin privileges' do
|
||||||
|
patch :update, id: @conference.short_title,
|
||||||
|
conference: attributes_for(:conference,
|
||||||
|
short_title: 'ExCon')
|
||||||
|
expect(response).to redirect_to(send(success_path))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'participant access' do
|
||||||
|
before(:each) do
|
||||||
|
@conference = create(:conference)
|
||||||
|
@participant = create(:participant)
|
||||||
|
sign_in(@participant)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'access as participant or guest', :root_path
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'guest access' do
|
||||||
|
|
||||||
|
before(:each) do
|
||||||
|
@conference = create(:conference)
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like 'access as participant or guest', :new_user_session_path
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
16
spec/factories/role.rb
Normal file
16
spec/factories/role.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :role do
|
||||||
|
|
||||||
|
factory :admin_role do
|
||||||
|
name 'Admin'
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :organizer_role do
|
||||||
|
name 'Organizer'
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :participant_role do
|
||||||
|
name 'Participant'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -6,5 +6,17 @@ FactoryGirl.define do
|
||||||
password 'changeme'
|
password 'changeme'
|
||||||
password_confirmation 'changeme'
|
password_confirmation 'changeme'
|
||||||
confirmed_at Time.now
|
confirmed_at Time.now
|
||||||
|
|
||||||
|
factory :participant do
|
||||||
|
after(:create) { |user| user.role_ids = create(:participant_role).id }
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :admin do
|
||||||
|
after(:create) { |user| user.role_ids = create(:admin_role).id }
|
||||||
|
end
|
||||||
|
|
||||||
|
factory :organizer do
|
||||||
|
after(:create) { |user| user.role_ids = create(:organizer_role).id }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
70
spec/models/user_spec.rb
Normal file
70
spec/models/user_spec.rb
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/bin/env ruby
|
||||||
|
# encoding: utf-8
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe User do
|
||||||
|
|
||||||
|
# It is necessary to build roles before user
|
||||||
|
let!(:organizer_role) { create(:organizer_role) }
|
||||||
|
let!(:participant_role) { create(:participant_role) }
|
||||||
|
let!(:admin_role) { create(:admin_role) }
|
||||||
|
let!(:admin) { create(:user) }
|
||||||
|
|
||||||
|
it 'returns the correct role' do
|
||||||
|
participant = create(:user, email: 'participant@example.de')
|
||||||
|
expect(admin.roles.first).to eq(admin_role)
|
||||||
|
expect(participant.roles.first).to eq(participant_role)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns the correct roles' do
|
||||||
|
roles = [organizer_role.id, participant_role.id, admin_role.id]
|
||||||
|
user_with_all_roles = create(:user, email: 'participant@example.de')
|
||||||
|
user_with_all_roles.role_ids = roles
|
||||||
|
user_with_all_roles.save
|
||||||
|
|
||||||
|
expect(user_with_all_roles.roles.length).to eq(3)
|
||||||
|
expect(user_with_all_roles.roles[0]).to eq(participant_role)
|
||||||
|
expect(user_with_all_roles.roles[1]).to eq(organizer_role)
|
||||||
|
expect(user_with_all_roles.roles[2]).to eq(admin_role)
|
||||||
|
end
|
||||||
|
|
||||||
|
describe '#role?' do
|
||||||
|
shared_examples '#role?' do |user, role, expected|
|
||||||
|
it "returns #{expected} for #{role}" do
|
||||||
|
user_obj = create(user, email: 'e@example.com')
|
||||||
|
expect(user_obj.role?(role)).to be expected
|
||||||
|
expect(user_obj.role?(role.downcase)).to be expected
|
||||||
|
expect(user_obj.role?(role.upcase)).to be expected
|
||||||
|
expect(user_obj.role?(role.downcase.capitalize)).to be expected
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'admin' do
|
||||||
|
it_behaves_like '#role?', :admin, 'orgAnizer', false
|
||||||
|
it_behaves_like '#role?', :admin, 'adMin', true
|
||||||
|
it_behaves_like '#role?', :admin, 'partiCipant', false
|
||||||
|
|
||||||
|
it 'assigns first user admin role' do
|
||||||
|
expect(admin.role?('Admin')).to be true
|
||||||
|
expect(admin.role_ids).to match_array([admin_role.id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'participant' do
|
||||||
|
it_behaves_like '#role?', :participant, 'orgAnizer', false
|
||||||
|
it_behaves_like '#role?', :participant, 'adMin', false
|
||||||
|
it_behaves_like '#role?', :participant, 'partiCipant', true
|
||||||
|
|
||||||
|
it 'assigns second user participant role' do
|
||||||
|
participant = create(:user, email: 'participant@example.de')
|
||||||
|
expect(participant.role_ids).to match_array([participant_role.id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'organizer' do
|
||||||
|
it_behaves_like '#role?', :organizer, 'orgAnizer', true
|
||||||
|
it_behaves_like '#role?', :organizer, 'adMin', false
|
||||||
|
it_behaves_like '#role?', :organizer, 'partiCipant', false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
require 'coveralls'
|
require 'coveralls'
|
||||||
Coveralls.wear!('rails')
|
Coveralls.wear!('rails')
|
||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
|
|
||||||
if Rails.configuration.database_configuration['test']['database'] == ':memory:'
|
if Rails.configuration.database_configuration['test']['database'] == ':memory:'
|
||||||
load "#{Rails.root}/db/schema.rb"
|
load "#{Rails.root}/db/schema.rb"
|
||||||
load "#{Rails.root}/db/seeds.rb"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
|
|
@ -18,7 +17,7 @@ require 'rspec/rails'
|
||||||
# run twice. It is recommended that you do not name files matching this glob to
|
# run twice. It is recommended that you do not name files matching this glob to
|
||||||
# end with _spec.rb. You can configure this pattern with with the --pattern
|
# end with _spec.rb. You can configure this pattern with with the --pattern
|
||||||
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# ## Mock Framework
|
# ## Mock Framework
|
||||||
|
|
@ -35,17 +34,20 @@ RSpec.configure do |config|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
# examples within a transaction, remove the following line or assign false
|
# examples within a transaction, remove the following line or assign false
|
||||||
# instead of true.
|
# instead of true.
|
||||||
config.use_transactional_fixtures = true
|
config.use_transactional_fixtures = false
|
||||||
|
|
||||||
# Run specs in random order to surface order dependencies. If you find an
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
# order dependency and want to debug it, you can fix the order by providing
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
# the seed, which is printed after each run.
|
# the seed, which is printed after each run.
|
||||||
# --seed 1234
|
# --seed 1234
|
||||||
config.order = "random"
|
config.order = 'random'
|
||||||
|
|
||||||
# Include factory_girls syntax
|
# Include factory_girls syntax
|
||||||
config.include FactoryGirl::Syntax::Methods
|
config.include FactoryGirl::Syntax::Methods
|
||||||
|
|
||||||
|
# Enables devise sign_in function
|
||||||
|
config.include Devise::TestHelpers, type: :controller
|
||||||
|
|
||||||
# As we start from scratch in April 2014, let's forbid the old :should syntax
|
# As we start from scratch in April 2014, let's forbid the old :should syntax
|
||||||
config.expect_with :rspec do |c|
|
config.expect_with :rspec do |c|
|
||||||
c.syntax = :expect
|
c.syntax = :expect
|
||||||
|
|
|
||||||
22
spec/support/database_cleaner.rb
Normal file
22
spec/support/database_cleaner.rb
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
RSpec.configure do |config|
|
||||||
|
|
||||||
|
config.before(:suite) do
|
||||||
|
DatabaseCleaner.clean_with(:truncation)
|
||||||
|
end
|
||||||
|
|
||||||
|
config.before(:each) do
|
||||||
|
DatabaseCleaner.strategy = :transaction
|
||||||
|
end
|
||||||
|
|
||||||
|
config.before(:each, js: true) do
|
||||||
|
DatabaseCleaner.strategy = :truncation
|
||||||
|
end
|
||||||
|
|
||||||
|
config.before(:each) do
|
||||||
|
DatabaseCleaner.start
|
||||||
|
end
|
||||||
|
|
||||||
|
config.after(:each) do
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue