Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Set up testing for project

  • Loading branch information...
commit bb4827422d04bca56ad55bb38f7c0bd7bb45e280 1 parent 34e34ed
@parndt parndt authored
View
3  .gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+Gemfile.lock
+spec/dummy
View
18 .travis.yml
@@ -0,0 +1,18 @@
+before_script:
+ - "bundle exec rake refinery:testing:dummy_app > /dev/null"
+script: "bundle exec rspec ./spec"
+notifications:
+ email:
+ - parndt@gmail.com
+ - ugis.ozolss@gmail.com
+env:
+ - DB=postgres
+ - DB=mysql
+ - DB=sqlite3
+rvm:
+ - 1.8.7
+ - ree
+ - 1.9.2
+ - 1.9.3
+ - rbx
+ - jruby
View
63 Gemfile
@@ -0,0 +1,63 @@
+source 'http://rubygems.org'
+
+gemspec
+
+git 'git://github.com/resolve/refinerycms.git' do
+ gem 'refinerycms'
+
+ group :development, :test do
+ gem 'refinerycms-testing'
+ end
+end
+
+group :development, :test do
+ require 'rbconfig'
+
+ gem 'sqlite3'
+ gem 'mysql2'
+ gem 'pg'
+
+ platforms :mswin, :mingw do
+ gem 'win32console'
+ gem 'rb-fchange', '~> 0.0.5'
+ gem 'rb-notifu', '~> 0.0.4'
+ end
+
+ platforms :ruby do
+ gem 'spork', '0.9.0.rc9'
+ gem 'guard-spork'
+
+ unless ENV['TRAVIS']
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
+ gem 'rb-fsevent', '>= 0.3.9'
+ gem 'growl', '~> 1.0.3'
+ end
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
+ gem 'rb-inotify', '>= 0.5.1'
+ gem 'libnotify', '~> 0.1.3'
+ gem 'therubyracer', '~> 0.9.9'
+ end
+ end
+ end
+
+ platforms :jruby do
+ unless ENV['TRAVIS']
+ if RbConfig::CONFIG['target_os'] =~ /darwin/i
+ gem 'growl', '~> 1.0.3'
+ end
+ if RbConfig::CONFIG['target_os'] =~ /linux/i
+ gem 'rb-inotify', '>= 0.5.1'
+ gem 'libnotify', '~> 0.1.3'
+ end
+ end
+ end
+end
+
+# Refinery/rails should pull in the proper versions of these
+group :assets do
+ gem 'sass-rails'
+ gem 'coffee-rails'
+ gem 'uglifier'
+end
+
+gem 'jquery-rails'
View
19 Rakefile
@@ -0,0 +1,19 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+
+ENGINE_PATH = File.dirname(__FILE__)
+APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
+
+if File.exists?(APP_RAKEFILE)
+ load 'rails/tasks/engine.rake'
+end
+
+require "refinerycms-testing"
+Refinery::Testing::Railtie.load_tasks
+Refinery::Testing::Railtie.load_dummy_tasks(ENGINE_PATH)
+
+load File.expand_path('../tasks/rspec.rake', __FILE__)
View
2  db/migrate/20101208082840_create_inquiries.rb
@@ -14,8 +14,6 @@ def up
add_index ::Refinery::Inquiry.table_name, :id
end
-
- Refinery::Inquiries::Engine.load_seed
end
def down
View
59 spec/spec_helper.rb
@@ -0,0 +1,59 @@
+require 'rubygems'
+
+def setup_environment
+ # Configure Rails Environment
+ ENV["RAILS_ENV"] ||= 'test'
+
+ require File.expand_path("../dummy/config/environment", __FILE__)
+
+ require 'rspec/rails'
+ require 'capybara/rspec'
+ require 'factory_girl_rails'
+
+ Rails.backtrace_cleaner.remove_silencers!
+
+ RSpec.configure do |config|
+ config.mock_with :rspec
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+ config.filter_run :focus => true
+ config.run_all_when_everything_filtered = true
+ end
+
+ # set javascript driver for capybara
+ Capybara.javascript_driver = :selenium
+
+ # minimize password hashing stretches
+ Devise.stretches = 1
+end
+
+def each_run
+ ActiveSupport::Dependencies.clear
+
+ FactoryGirl.reload
+
+ # Requires supporting files with custom matchers and macros, etc,
+ # in ./support/ and its subdirectories including factories.
+ ([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
+ Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
+ }.flatten.sort.each do |support_file|
+ require support_file
+ end
+end
+
+# If spork is available in the Gemfile it'll be used but we don't force it.
+unless (begin; require 'spork'; rescue LoadError; nil end).nil?
+ Spork.prefork do
+ # Loading more in this block will cause your tests to run faster. However,
+ # if you change any configuration or code from libraries loaded here, you'll
+ # need to restart spork for it take effect.
+ setup_environment
+ end
+
+ Spork.each_run do
+ # This code will be run each time you run your specs.
+ each_run
+ end
+else
+ setup_environment
+ each_run
+end
View
4 tasks/rspec.rake
@@ -0,0 +1,4 @@
+require 'rspec/core/rake_task'
+
+desc "Run specs"
+RSpec::Core::RakeTask.new
Please sign in to comment.
Something went wrong with that request. Please try again.