Extract a common spec helper

In order to write tests for the `word_wrap` method we have, we need a
spec helper that we can require. We don't need anything fancy. The
doublespeak_spec_helper is doing most of what we want except for the
Doublespeak require.
This commit is contained in:
Elliot Winkler 2015-10-07 11:09:59 -06:00
parent 07fe5eb6c8
commit 878e9582e1
4 changed files with 27 additions and 43 deletions

View File

@ -5,20 +5,14 @@ Tests::CurrentBundle.instance.assert_appraisal!
#--- #---
require 'rspec/core' require 'rspec/core'
require 'pry'
require 'pry-byebug' require 'spec_helper'
Dir[ File.join(File.expand_path('../support/acceptance/**/*.rb', __FILE__)) ].sort.each do |file| Dir[ File.join(File.expand_path('../support/acceptance/**/*.rb', __FILE__)) ].sort.each do |file|
require file require file
end end
RSpec.configure do |config| RSpec.configure do |config|
config.order = :random
config.expect_with :rspec do |c|
c.syntax = :expect
end
if config.respond_to?(:infer_spec_type_from_file_location!) if config.respond_to?(:infer_spec_type_from_file_location!)
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
end end
@ -27,5 +21,3 @@ RSpec.configure do |config|
config.include AcceptanceTests::Matchers config.include AcceptanceTests::Matchers
end end
$VERBOSE = true

View File

@ -1,18 +1,2 @@
require 'shoulda/matchers/doublespeak' require 'shoulda/matchers/doublespeak'
require 'spec_helper'
PROJECT_ROOT = File.expand_path('../..', __FILE__)
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
RSpec.configure do |config|
config.order = :random
config.expect_with :rspec do |c|
c.syntax = :expect
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.mock_with :rspec
end

23
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,23 @@
PROJECT_ROOT = File.expand_path('../..', __FILE__)
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
require 'pry'
require 'pry-byebug'
require 'rspec'
RSpec.configure do |config|
config.order = :random
config.expect_with :rspec do |c|
c.syntax = :expect
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.mock_with :rspec
end
$VERBOSE = true

View File

@ -16,26 +16,13 @@ ENV['RAILS_ENV'] = 'test'
require 'rspec/rails' require 'rspec/rails'
require 'shoulda-matchers' require 'shoulda-matchers'
PROJECT_ROOT = File.expand_path('../..', __FILE__) require 'spec_helper'
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
Dir[ File.join(File.expand_path('../support/unit/**/*.rb', __FILE__)) ].sort.each do |file| Dir[ File.join(File.expand_path('../support/unit/**/*.rb', __FILE__)) ].sort.each do |file|
require file require file
end end
RSpec.configure do |config| RSpec.configure do |config|
config.order = :random
config.expect_with :rspec do |c|
c.syntax = :expect
end
if config.files_to_run.one?
config.default_formatter = 'doc'
end
config.mock_with :rspec
if config.respond_to?(:infer_spec_type_from_file_location!) if config.respond_to?(:infer_spec_type_from_file_location!)
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
end end
@ -69,5 +56,3 @@ Shoulda::Matchers.configure do |config|
with.library :rails with.library :rails
end end
end end
$VERBOSE = true