Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.

Commit

Permalink
Add test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaut committed Feb 26, 2015
1 parent 55fd3e2 commit 7ac3fc6
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.lock
2 changes: 2 additions & 0 deletions Gemfile
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gemspec
4 changes: 4 additions & 0 deletions Gemfile.rails40
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gemspec

gem 'rails', '~> 4.0.0'
4 changes: 4 additions & 0 deletions Gemfile.rails41
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gemspec

gem 'rails', '~> 4.1.0'
4 changes: 4 additions & 0 deletions Gemfile.rails42
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
gemspec

gem 'rails', '~> 4.2.0'
8 changes: 8 additions & 0 deletions Rakefile
@@ -0,0 +1,8 @@
require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.warning = true
t.verbose = true
end
34 changes: 34 additions & 0 deletions test/turbolinks/test_helper.rb
@@ -0,0 +1,34 @@
require 'rails'
require 'abstract_controller'
require 'abstract_controller/railties/routes_helpers'
require 'action_controller'
require 'turbolinks'

require 'active_support/testing/autorun'
require 'active_support/test_case'
ActiveSupport::TestCase.test_order = :random if ActiveSupport::TestCase.respond_to?(:test_order=)

class TestApplication < Rails::Application
config.secret_token = Digest::SHA1.hexdigest(Time.now.to_s)
config.secret_key_base = SecureRandom.hex
config.eager_load = false

initialize!

routes.draw do
get ':controller(/:action)'
end
end

module ActionController
class Base
extend AbstractController::Railties::RoutesHelpers.with(TestApplication.routes)
end

class TestCase
def before_setup
@routes = TestApplication.routes
super
end
end
end
4 changes: 3 additions & 1 deletion turbolinks.gemspec
Expand Up @@ -9,6 +9,8 @@ Gem::Specification.new do |s|
s.homepage = 'https://github.com/rails/turbolinks/'
s.summary = 'Turbolinks makes following links in your web application faster (use with Rails Asset Pipeline)'
s.files = Dir["lib/assets/javascripts/*.js.coffee", "lib/turbolinks.rb", "lib/turbolinks/*.rb", "README.md", "MIT-LICENSE", "test/*"]

s.test_files = Dir["test/*"]

s.add_dependency 'coffee-rails'
s.add_development_dependency 'rake'
end

0 comments on commit 7ac3fc6

Please sign in to comment.