Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-sass.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glex.spb@gmail.com>2014-09-03 01:48:44 +0400
committerGleb Mazovetskiy <glex.spb@gmail.com>2014-09-03 01:49:24 +0400
commit6fe694cbd0627c45db4ed5ac3935d783ea0f02c8 (patch)
tree81a1a455fdf680018947b49c459eb6886b7dc4fc
parent2e441b24699cbd60a5cee4bcae84428293af7ff7 (diff)
Port over fixes from branch next
-rw-r--r--Gemfile3
-rw-r--r--assets/stylesheets/_bootstrap.scss (renamed from assets/stylesheets/bootstrap.scss)0
-rw-r--r--assets/stylesheets/bootstrap/_list-group.scss3
-rw-r--r--assets/stylesheets/bootstrap/_variables.scss2
-rw-r--r--assets/stylesheets/bootstrap/bootstrap.scss50
-rw-r--r--bootstrap-sass.gemspec7
-rw-r--r--bower.json2
-rw-r--r--lib/bootstrap-sass/version.rb2
-rw-r--r--tasks/bower.rake4
-rw-r--r--tasks/converter/less_conversion.rb17
-rw-r--r--test/compass_test.rb10
-rw-r--r--test/compilation_test.rb17
-rw-r--r--test/dummy_rails/README.rdoc2
-rw-r--r--test/dummy_rails/config/application.rb18
-rw-r--r--test/dummy_sass_only/compile.rb8
-rw-r--r--test/gemfiles/sass_3_2.gemfile1
-rw-r--r--test/gemfiles/sass_3_3.gemfile4
-rw-r--r--test/gemfiles/sass_3_4.gemfile7
-rw-r--r--test/gemfiles/sass_head.gemfile4
-rw-r--r--test/node_mincer_test.rb11
-rw-r--r--test/node_sass_test.rb11
-rw-r--r--test/pages_test.rb6
-rw-r--r--test/sass_test.rb14
-rw-r--r--test/sprockets_rails_test.rb16
-rw-r--r--test/support/dummy_rails_integration.rb22
-rw-r--r--test/support/reporting.rb17
-rw-r--r--test/test_helper.rb23
-rw-r--r--test/test_helper_rails.rb6
28 files changed, 158 insertions, 129 deletions
diff --git a/Gemfile b/Gemfile
index 0b58b8bc..c3e88743 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,6 +2,9 @@ source 'https://rubygems.org'
gemspec
+# Compass for the dummy app
+gem 'compass', require: false
+
group :development do
gem 'byebug', platform: :mri_21, require: false
end
diff --git a/assets/stylesheets/bootstrap.scss b/assets/stylesheets/_bootstrap.scss
index 65204aad..65204aad 100644
--- a/assets/stylesheets/bootstrap.scss
+++ b/assets/stylesheets/_bootstrap.scss
diff --git a/assets/stylesheets/bootstrap/_list-group.scss b/assets/stylesheets/bootstrap/_list-group.scss
index 49c64ebe..36c297c0 100644
--- a/assets/stylesheets/bootstrap/_list-group.scss
+++ b/assets/stylesheets/bootstrap/_list-group.scss
@@ -74,8 +74,7 @@ a.list-group-item {
&.disabled:focus {
background-color: $list-group-disabled-bg;
color: $list-group-disabled-color;
- cursor: not-allowed;
-
+
// Force color to inherit for custom content
.list-group-item-heading {
color: inherit;
diff --git a/assets/stylesheets/bootstrap/_variables.scss b/assets/stylesheets/bootstrap/_variables.scss
index 1abd52ee..2d17e0c7 100644
--- a/assets/stylesheets/bootstrap/_variables.scss
+++ b/assets/stylesheets/bootstrap/_variables.scss
@@ -1,4 +1,4 @@
-// When true, asset path helpers are used, otherwise regular url() is used
+// When true, asset path helpers are used, otherwise the regular CSS `url()` is used.
// When there no function is defined, `fn('')` is parsed as string that equals the right hand side
// NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
$bootstrap-sass-asset-helper: (twbs-font-path("") != unquote('twbs-font-path("")')) !default;
diff --git a/assets/stylesheets/bootstrap/bootstrap.scss b/assets/stylesheets/bootstrap/bootstrap.scss
deleted file mode 100644
index 4d6f8aac..00000000
--- a/assets/stylesheets/bootstrap/bootstrap.scss
+++ /dev/null
@@ -1,50 +0,0 @@
-// Core variables and mixins
-@import "variables";
-@import "mixins";
-
-// Reset and dependencies
-@import "normalize";
-@import "print";
-@import "glyphicons";
-
-// Core CSS
-@import "scaffolding";
-@import "type";
-@import "code";
-@import "grid";
-@import "tables";
-@import "forms";
-@import "buttons";
-
-// Components
-@import "component-animations";
-@import "dropdowns";
-@import "button-groups";
-@import "input-groups";
-@import "navs";
-@import "navbar";
-@import "breadcrumbs";
-@import "pagination";
-@import "pager";
-@import "labels";
-@import "badges";
-@import "jumbotron";
-@import "thumbnails";
-@import "alerts";
-@import "progress-bars";
-@import "media";
-@import "list-group";
-@import "panels";
-@import "responsive-embed";
-@import "wells";
-@import "close";
-
-// Components w/ JavaScript
-@import "modals";
-@import "tooltip";
-@import "popovers";
-@import "carousel";
-
-// Utility classes
-@import "utilities";
-@import "responsive-utilities";
diff --git a/bootstrap-sass.gemspec b/bootstrap-sass.gemspec
index 6d106be1..a938a54d 100644
--- a/bootstrap-sass.gemspec
+++ b/bootstrap-sass.gemspec
@@ -14,19 +14,20 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'sass', '~> 3.2'
# Testing dependencies
- s.add_development_dependency 'test-unit', '~> 2.5.5'
+ s.add_development_dependency 'minitest', '~> 5.4.0'
+ s.add_development_dependency 'minitest-reporters', '~> 1.0.5'
# Integration testing
s.add_development_dependency 'capybara'
s.add_development_dependency 'poltergeist'
# Dummy Rails app dependencies
+ s.add_development_dependency 'actionpack', '>= 4.1.5'
+ s.add_development_dependency 'activesupport', '>= 4.1.5'
s.add_development_dependency 'json', '>= 1.8.1'
s.add_development_dependency 'sprockets-rails', '>= 2.1.3'
s.add_development_dependency 'autoprefixer-rails', '~> 1.1'
s.add_development_dependency 'jquery-rails', '>= 3.1.0'
s.add_development_dependency 'slim-rails'
s.add_development_dependency 'uglifier'
- # Compass dummy app
- s.add_development_dependency 'compass'
# Converter
s.add_development_dependency 'term-ansicolor'
diff --git a/bower.json b/bower.json
index d9d575fc..c815772b 100644
--- a/bower.json
+++ b/bower.json
@@ -10,7 +10,7 @@
],
"description": "bootstrap-sass is a Sass-powered version of Bootstrap, ready to drop right into your Sass powered applications.",
"main": [
- "assets/stylesheets/bootstrap.scss",
+ "assets/stylesheets/_bootstrap.scss",
"assets/fonts/bootstrap/glyphicons-halflings-regular.eot",
"assets/fonts/bootstrap/glyphicons-halflings-regular.svg",
"assets/fonts/bootstrap/glyphicons-halflings-regular.ttf",
diff --git a/lib/bootstrap-sass/version.rb b/lib/bootstrap-sass/version.rb
index 6f2a395f..e3edc5e4 100644
--- a/lib/bootstrap-sass/version.rb
+++ b/lib/bootstrap-sass/version.rb
@@ -1,4 +1,4 @@
module Bootstrap
VERSION = '3.2.0.1'
- BOOTSTRAP_SHA = '1098453f831fad3fdfcbf036237ed064a5d29b26'
+ BOOTSTRAP_SHA = 'c068162161154a4b85110ea1e7dd3d7897ce2b72'
end
diff --git a/tasks/bower.rake b/tasks/bower.rake
index 16e484fd..9cbe993e 100644
--- a/tasks/bower.rake
+++ b/tasks/bower.rake
@@ -1,5 +1,4 @@
require 'find'
-require 'bootstrap-sass'
require 'json'
require 'pathname'
@@ -13,6 +12,7 @@ namespace :bower do
desc 'update main and version in bower.json'
task :generate do
+ require 'bootstrap-sass'
Dir.chdir Bootstrap.gem_path do
spec = JSON.parse(File.read 'bower.json')
js_paths = File.read(File.join Bootstrap.javascripts_path, 'bootstrap-sprockets.js').lines.map do |line|
@@ -20,7 +20,7 @@ namespace :bower do
end.compact
spec['main'] =
- find_files.(File.join(Bootstrap.stylesheets_path, 'bootstrap.scss')) +
+ find_files.(File.join(Bootstrap.stylesheets_path, '_bootstrap.scss')) +
find_files.(Bootstrap.fonts_path) +
js_paths
diff --git a/tasks/converter/less_conversion.rb b/tasks/converter/less_conversion.rb
index 85938c19..a903aec5 100644
--- a/tasks/converter/less_conversion.rb
+++ b/tasks/converter/less_conversion.rb
@@ -89,7 +89,7 @@ class Converter
when 'variables.less'
file = insert_default_vars(file)
file = unindent <<-SCSS + "\n" + file, 14
- // When true, asset path helpers are used, otherwise regular `url()`` is used.
+ // When true, asset path helpers are used, otherwise the regular CSS `url()` is used.
// When there no function is defined, `fn('')` is parsed as string that equals the right hand side
// NB: in Sass 3.3 there is a native function: function-exists(twbs-font-path)
$bootstrap-sass-asset-helper: #{sass_fn_exists('twbs-font-path')} !default;
@@ -125,18 +125,17 @@ class Converter
file = replace_all(file, " @include bg-variant($brand-primary);\n}", "}\n@include bg-variant('.bg-primary', $brand-primary);")
end
- name = name.sub(/\.less$/, '.scss')
- path = File.join save_to, name
- unless name == 'bootstrap.scss'
- path = File.join File.dirname(path), '_' + File.basename(path)
- end
+ path = File.join save_to, name.sub(/\.less$/, '.scss')
+ path = File.join File.dirname(path), '_' + File.basename(path)
save_file(path, file)
log_processed File.basename(path)
end
- # generate imports valid relative to both load path and file directory
- save_file File.expand_path("#{save_to}/../bootstrap.scss"),
- File.read("#{save_to}/bootstrap.scss").gsub(/ "/, ' "bootstrap/')
+ # move bootstrap/_bootstrap.scss to _bootstrap.scss adjusting import paths
+ main_from = "#{save_to}/_bootstrap.scss"
+ main_to = File.expand_path("#{save_to}/../_bootstrap.scss")
+ save_file main_to, File.read(main_from).gsub(/ "/, ' "bootstrap/')
+ File.delete(main_from)
end
def bootstrap_less_files
diff --git a/test/compass_test.rb b/test/compass_test.rb
index 00d76610..1811ca24 100644
--- a/test/compass_test.rb
+++ b/test/compass_test.rb
@@ -1,13 +1,9 @@
require 'test_helper'
-class CompassTest < Test::Unit::TestCase
+class CompassTest < Minitest::Test
def test_create_project
- command = 'rm -rf tmp/new-compass-project; compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
- success = if ENV['VERBOSE']
- system command
- else
- silence_stream(STDOUT) { system(command) }
- end
+ command = 'rm -rf tmp/new-compass-project; bundle exec compass create tmp/new-compass-project -r bootstrap-sass --using bootstrap --trace --force'
+ success = silence_stdout_if(!ENV['VERBOSE']) { system(command) }
assert success, 'Compass project creation failed!'
end
end
diff --git a/test/compilation_test.rb b/test/compilation_test.rb
index 86c5d4d3..6808813a 100644
--- a/test/compilation_test.rb
+++ b/test/compilation_test.rb
@@ -1,17 +1,18 @@
require 'test_helper'
require 'fileutils'
+require 'sass'
-class CompilationTest < Test::Unit::TestCase
+class CompilationTest < Minitest::Test
def test_compilation
path = 'assets/stylesheets'
- %w(bootstrap bootstrap/_theme).each do |file|
+ %w(_bootstrap bootstrap/_theme).each do |file|
+ FileUtils.rm_rf('.sass-cache', secure: true)
engine = Sass::Engine.for_file("#{path}/#{file}.scss", syntax: :scss, load_paths: [path])
- assert_nothing_raised do
- FileUtils.mkdir_p("tmp/#{File.dirname(file)}")
- File.open("tmp/#{file}.css", 'w') { |f|
- f.write engine.render
- }
- end
+ FileUtils.mkdir_p("tmp/#{File.dirname(file)}")
+ File.open("tmp/#{file}.css", 'w') { |f|
+ f.write engine.render
+ }
+ assert true # nothing was raised
end
end
end
diff --git a/test/dummy_rails/README.rdoc b/test/dummy_rails/README.rdoc
index 20e9b573..5604f2d2 100644
--- a/test/dummy_rails/README.rdoc
+++ b/test/dummy_rails/README.rdoc
@@ -1,3 +1,3 @@
== README
-This is a dummy app for testing REP \ No newline at end of file
+This is a minimal Rails app for testing
diff --git a/test/dummy_rails/config/application.rb b/test/dummy_rails/config/application.rb
index a375d4ac..e990bdd7 100644
--- a/test/dummy_rails/config/application.rb
+++ b/test/dummy_rails/config/application.rb
@@ -1,14 +1,30 @@
require File.expand_path('../boot', __FILE__)
-require 'rails/all'
+require 'rails'
+
+%w(
+ action_controller
+ action_view
+ sprockets
+).each do |framework|
+ require "#{framework}/railtie"
+end
+
require 'slim-rails'
require 'jquery-rails'
+require 'compass'
require 'bootstrap-sass'
require 'uglifier'
module Dummy
class Application < Rails::Application
config.assets.enabled = true if config.assets.respond_to?(:enabled)
+ config.to_prepare do
+ if ENV['VERBOSE']
+ STDERR.puts "Loaded Rails #{Rails::VERSION::STRING}, Sprockets #{Sprockets::VERSION}",
+ "Asset paths: #{Rails.application.config.assets.paths}"
+ end
+ end
end
end
diff --git a/test/dummy_sass_only/compile.rb b/test/dummy_sass_only/compile.rb
index 8710aa03..09e67855 100644
--- a/test/dummy_sass_only/compile.rb
+++ b/test/dummy_sass_only/compile.rb
@@ -1,12 +1,12 @@
require 'sass'
require 'bootstrap-sass'
+require 'fileutils'
-css = Sass.compile(
- File.read(File.expand_path('./import_all.sass', File.dirname(__FILE__))),
- :syntax => 'sass'
-)
+scss_path = File.expand_path('./import_all.sass', File.dirname(__FILE__))
+css = Sass.compile File.read(scss_path), syntax: 'sass'
if ARGV[0]
+ FileUtils.mkdir_p File.dirname(ARGV[0])
File.open(ARGV[0], 'w') { |f| f.write css }
else
puts css
diff --git a/test/gemfiles/sass_3_2.gemfile b/test/gemfiles/sass_3_2.gemfile
index 8adf7d99..6618ad74 100644
--- a/test/gemfiles/sass_3_2.gemfile
+++ b/test/gemfiles/sass_3_2.gemfile
@@ -1,5 +1,6 @@
source "https://rubygems.org"
gem 'sass', '~> 3.2.0'
+gem 'compass', require: false
gemspec path: '../../'
diff --git a/test/gemfiles/sass_3_3.gemfile b/test/gemfiles/sass_3_3.gemfile
index 94362673..98fd4051 100644
--- a/test/gemfiles/sass_3_3.gemfile
+++ b/test/gemfiles/sass_3_3.gemfile
@@ -1,6 +1,6 @@
source "https://rubygems.org"
-gem 'sass', '~> 3.3.6'
-gem 'compass', '~> 1.0.0.alpha.19'
+gem 'sass', '~> 3.3.14'
+gem 'compass', '~> 1.0.1', require: false
gemspec path: '../../'
diff --git a/test/gemfiles/sass_3_4.gemfile b/test/gemfiles/sass_3_4.gemfile
new file mode 100644
index 00000000..fd89fa72
--- /dev/null
+++ b/test/gemfiles/sass_3_4.gemfile
@@ -0,0 +1,7 @@
+source "https://rubygems.org"
+
+gem 'sass', '~> 3.4.1'
+gem 'compass', '~> 1.0.1', require: false
+
+gemspec path: '../../'
+
diff --git a/test/gemfiles/sass_head.gemfile b/test/gemfiles/sass_head.gemfile
index 4fd0a4c1..0cfe4f4f 100644
--- a/test/gemfiles/sass_head.gemfile
+++ b/test/gemfiles/sass_head.gemfile
@@ -1,6 +1,6 @@
source "https://rubygems.org"
-gem 'sass', git: 'https://github.com/nex3/sass'
-gem 'compass', git: 'https://github.com/chriseppstein/compass', branch: 'master'
+gem 'sass', git: 'https://github.com/nex3/sass', branch: 'stable' # master is not compatible with Compass master
+gem 'compass', git: 'https://github.com/chriseppstein/compass', branch: 'master', require: false
gemspec path: '../../'
diff --git a/test/node_mincer_test.rb b/test/node_mincer_test.rb
index ad9697ab..c18a0860 100644
--- a/test/node_mincer_test.rb
+++ b/test/node_mincer_test.rb
@@ -1,7 +1,7 @@
require 'test_helper'
require 'json'
-class NodeMincerTest < Test::Unit::TestCase
+class NodeMincerTest < Minitest::Test
DUMMY_PATH = 'test/dummy_node_mincer'
def test_font_helper_without_suffix
@@ -21,13 +21,14 @@ class NodeMincerTest < Test::Unit::TestCase
end
def setup
- tmp_dir = File.join Bootstrap.gem_path, 'tmp/node-mincer'
+ tmp_dir = File.join GEM_PATH, 'tmp/node-mincer'
command = "node manifest.js #{tmp_dir}"
- Dir.chdir DUMMY_PATH do
- assert silence_stream(STDOUT) {
+ success = Dir.chdir DUMMY_PATH do
+ silence_stdout_if !ENV['VERBOSE'] do
system(command)
- }, 'Node.js Mincer compilation failed'
+ end
end
+ assert success, 'Node.js Mincer compilation failed'
manifest = JSON.parse(File.read("#{tmp_dir}/manifest.json"))
css_name = manifest["assets"]["application.css"]
@css = File.read("#{tmp_dir}/#{css_name}")
diff --git a/test/node_sass_test.rb b/test/node_sass_test.rb
index 0010009e..d1c68ec8 100644
--- a/test/node_sass_test.rb
+++ b/test/node_sass_test.rb
@@ -1,15 +1,16 @@
require 'test_helper'
require 'fileutils'
-class NodeSassTest < Test::Unit::TestCase
+class NodeSassTest < Minitest::Test
def test_node_sass_compilation
path = 'assets/stylesheets'
%w(bootstrap bootstrap/_theme).each do |file|
- FileUtils.mkdir_p "tmp/node-sass"
+ FileUtils.mkdir_p 'tmp/node-sass'
command = "node-sass #{path}/#{file} -o tmp/node-sass/#{File.basename file}.css"
- assert silence_stream(STDOUT) {
- system(command)
- }, 'node-sass compilation failed'
+ success = silence_stderr_if !ENV['VERBOSE'] do
+ system command
+ end
+ assert success, 'node-sass compilation failed'
end
end
end
diff --git a/test/pages_test.rb b/test/pages_test.rb
index cbd5266d..b86c7ed5 100644
--- a/test/pages_test.rb
+++ b/test/pages_test.rb
@@ -1,7 +1,7 @@
-require 'test_helper'
+require 'test_helper_rails'
class PagesTest < ActionDispatch::IntegrationTest
- include ::IntegrationTest
+ include ::DummyRailsIntegration
def test_visit_root
visit root_path
@@ -11,4 +11,4 @@ class PagesTest < ActionDispatch::IntegrationTest
screenshot!
end
-end \ No newline at end of file
+end
diff --git a/test/sass_test.rb b/test/sass_test.rb
index 7f4acac7..fc54c77b 100644
--- a/test/sass_test.rb
+++ b/test/sass_test.rb
@@ -1,6 +1,7 @@
require 'test_helper'
+require 'shellwords'
-class SassTest < Test::Unit::TestCase
+class SassTest < Minitest::Test
DUMMY_PATH = 'test/dummy_sass_only'
def test_font_helper
@@ -12,13 +13,14 @@ class SassTest < Test::Unit::TestCase
%x[rm -rf .sass-cache/]
%x[bundle]
end
- css_path = File.join Bootstrap.gem_path, 'tmp/bootstrap-sass-only.css'
- command = "bundle exec ruby compile.rb #{css_path}"
- Dir.chdir DUMMY_PATH do
- assert silence_stream(STDOUT) {
+ css_path = File.join GEM_PATH, 'tmp/bootstrap-sass-only.css'
+ command = "bundle exec ruby compile.rb #{Shellwords.escape css_path}"
+ success = Dir.chdir DUMMY_PATH do
+ silence_stdout_if !ENV['VERBOSE'] do
system(command)
- }, 'Sass-only compilation failed'
+ end
end
+ assert success, 'Sass-only compilation failed'
@css = File.read(css_path)
end
end
diff --git a/test/sprockets_rails_test.rb b/test/sprockets_rails_test.rb
index cdc502ce..686cfa06 100644
--- a/test/sprockets_rails_test.rb
+++ b/test/sprockets_rails_test.rb
@@ -3,12 +3,18 @@ require 'fileutils'
require 'find'
require 'shellwords'
-class SprocketsRailsTest < ActiveSupport::TestCase
+class SprocketsRailsTest < Minitest::Test
def test_sprockets_digest_asset_refs
- system "cd #{Shellwords.escape Rails.root.to_s} && bundle exec rake assets:precompile GEMFILE=#{Bootstrap.gem_path}/Gemfile RAILS_ENV=production"
- Dir.glob(Rails.root.join('public', 'assets', 'app*.*')) do |path|
- next unless path =~ /\.(css|js)$/
+ root = 'test/dummy_rails'
+ command = "bundle exec rake assets:precompile GEMFILE=#{GEM_PATH}/Gemfile RAILS_ENV=production"
+ compiled = Dir.chdir root do
+ silence_stderr_if !ENV['VERBOSE'] do
+ system(command)
+ end
+ end
+ assert compiled, 'Could not precompile assets'
+ Dir.glob(File.join(root, 'public', 'assets', 'app*.{css,js}')) do |path|
File.open(path, 'r') do |f|
f.read.scan /url\("?[^"]+\.(?:jpg|png|eot|woff|ttf|svg)[^"]*"?\)/ do |m|
assert_match /-[0-9a-f]{12,}\./, m
@@ -16,6 +22,6 @@ class SprocketsRailsTest < ActiveSupport::TestCase
end
end
ensure
- system "rm -rf #{Rails.root}/public/assets/ #{Rails.root}/tmp/cache/"
+ FileUtils.rm_rf %W(#{root}/public/assets/ #{root}/tmp/cache/), secure: true
end
end
diff --git a/test/support/dummy_rails_integration.rb b/test/support/dummy_rails_integration.rb
new file mode 100644
index 00000000..8ea0bd2c
--- /dev/null
+++ b/test/support/dummy_rails_integration.rb
@@ -0,0 +1,22 @@
+require 'capybara'
+require 'fileutils'
+module DummyRailsIntegration
+ include Capybara::DSL
+
+ def setup
+ super
+ FileUtils.rm_rf('test/dummy_rails/tmp/cache', secure: true)
+ end
+
+ def teardown
+ super
+ Capybara.reset_sessions!
+ Capybara.use_default_driver
+ end
+
+ def screenshot!
+ path = "tmp/#{name}.png"
+ page.driver.render(File.join(GEM_PATH, path), full: true)
+ STDERR.puts "Screenshot saved to #{path}"
+ end
+end
diff --git a/test/support/reporting.rb b/test/support/reporting.rb
new file mode 100644
index 00000000..1d473634
--- /dev/null
+++ b/test/support/reporting.rb
@@ -0,0 +1,17 @@
+module Kernel
+ def silence_stdout_if(cond, &run)
+ silence_stream_if(cond, STDOUT, &run)
+ end
+
+ def silence_stderr_if(cond, &run)
+ silence_stream_if(cond, STDERR, &run)
+ end
+
+ def silence_stream_if(cond, stream, &run)
+ if cond
+ silence_stream(stream, &run)
+ else
+ run.call
+ end
+ end
+end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 034d503b..21e946c4 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -1,18 +1,18 @@
-ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
+require 'minitest/autorun'
+require 'minitest/reporters'
+Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
-$:.unshift("#{File.dirname(__FILE__)}/..")
-require File.expand_path('dummy_rails/config/environment', File.dirname(__FILE__))
+require 'active_support/core_ext/kernel/reporting'
-require 'test-unit'
-
-require 'sass'
-
-require 'rails/test_help'
+Dir.chdir 'test' do
+ Dir['support/**/*.rb'].each do |file|
+ require file
+ end
+end
-Dir[File.expand_path("./support/**/*.rb", File.dirname(__FILE__))].each { |f| require f }
+GEM_PATH = File.expand_path('../', File.dirname(__FILE__))
#= Capybara + Poltergeist
-require 'capybara/rails'
require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
@@ -20,7 +20,8 @@ Capybara.register_driver :poltergeist do |app|
app,
# inspector: '/Applications/Chromium.app/Contents/MacOS/Chromium', # open in inspector: page.driver.debug
window_size: [1280, 1024],
- js_errors: true, debug: true
+ timeout: 90,
+ js_errors: true
)
end
diff --git a/test/test_helper_rails.rb b/test/test_helper_rails.rb
new file mode 100644
index 00000000..2dd877a8
--- /dev/null
+++ b/test/test_helper_rails.rb
@@ -0,0 +1,6 @@
+ENV['RAILS_ENV'] = ENV['RACK_ENV'] = 'test'
+
+require 'test_helper'
+require 'dummy_rails/config/environment'
+require 'rails/test_help'
+require 'capybara/rails'