Fix Hound CI violations

This commit is contained in:
Chrisbr 2014-05-10 10:24:58 +02:00
parent 0661b86b1c
commit 546977fc02
3 changed files with 26 additions and 19 deletions

View file

@ -59,10 +59,11 @@ describe Admin::ConferenceController do
describe 'POST #create' do
context 'with valid attributes' do
it 'saves the conference to the database' do
expect {
expected = expect do
post :create, conference:
attributes_for(:conference, short_title: 'dps15')
}.to change(Conference, :count).by(1)
end
expected.to change { Conference.count }.by 1
end
it 'redirects to conference#show' do
@ -76,10 +77,11 @@ describe Admin::ConferenceController do
context 'with invalid attributes' do
it 'does not save the conference to the database' do
expect {
expected = expect do
post :create, conference:
attributes_for(:conference, short_title: nil)
}.to_not change(Conference, :count)
end
expected.to_not change { Conference.count }
end
it 're-renders the new template' do
@ -91,9 +93,11 @@ describe Admin::ConferenceController do
context 'with duplicate conference short title' do
it 'does not save the conference to the database' do
expect {
post :create, conference: attributes_for(:conference)
}.to_not change(Conference, :count)
expected = expect do
post :create, conference:
attributes_for(:conference)
end
expected.to_not change { Conference.count }
end
it 're-renders the new template' do

View file

@ -1,8 +1,8 @@
require 'coveralls'
Coveralls.wear!('rails')
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
if Rails.configuration.database_configuration['test']['database'] == ':memory:'
load "#{Rails.root}/db/schema.rb"
@ -18,7 +18,7 @@ require 'rspec/rails'
# 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
# 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|
# ## Mock Framework
@ -41,16 +41,16 @@ RSpec.configure do |config|
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
config.order = 'random'
# Include factory_girls syntax
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
config.expect_with :rspec do |c|
c.syntax = :expect
# Enables devise sign_in function
config.include Devise::TestHelpers, type: :controller
end
end