switch test-unit -> rspec, erb -> slim, fixture -> factory_girl

This commit is contained in:
fahchen
2013-01-30 17:36:48 +08:00
parent a17f0ff48b
commit 4f6004e0a4
11 changed files with 89 additions and 7 deletions

10
Gemfile
View File

@@ -41,3 +41,13 @@ gem 'jbuilder', '~> 1.0.1'
# Mongodb
gem 'mongoid', git: 'git://github.com/mongoid/mongoid.git', branch: '4.0.0-dev'
gem 'slim-rails'
# Server
gem 'thin'
group :test, :development do
gem 'rspec-rails', '~> 2.12.2'
gem 'factory_girl_rails', '~> 4.2.0'
end

View File

@@ -99,9 +99,17 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.4.0)
daemons (1.1.9)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (1.0.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.0)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
hike (1.2.1)
i18n (0.6.1)
jbuilder (1.0.2)
@@ -126,12 +134,36 @@ GEM
rake (10.0.3)
rdoc (3.12)
json (~> 1.4)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.1)
rspec-rails (2.12.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
sass (3.2.5)
slim (1.3.6)
temple (~> 0.5.5)
tilt (~> 1.3.3)
slim-rails (1.1.0)
actionpack (>= 3.0, < 4.1)
activesupport (>= 3.0, < 4.1)
railties (>= 3.0, < 4.1)
slim (~> 1.3)
sprockets (2.8.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
temple (0.5.5)
thin (1.5.0)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.17.0)
thread_safe (0.1.0)
atomic
@@ -153,11 +185,15 @@ DEPENDENCIES
activerecord-deprecated_finders!
arel!
coffee-rails!
factory_girl_rails (~> 4.2.0)
jbuilder (~> 1.0.1)
jquery-rails
mongoid!
rails!
rspec-rails (~> 2.12.2)
sass-rails!
slim-rails
sprockets-rails!
thin
turbolinks
uglifier (>= 1.0.3)

View File

@@ -32,5 +32,10 @@ module QingshuiTemple
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"
config.generators do |g|
g.test_framework :rspec
g.fixture_replacement :factory_girl, :dir => "spec/factories"
end
end
end

38
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1,38 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred
# automatically. This will be the default behavior in future versions of
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
# Run specs in random order to surface order dependencies. If you find an
# 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"
end

View File

0
test/fixtures/.keep vendored
View File

View File

View File

View File

View File

View File

@@ -1,7 +0,0 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Add more helper methods to be used by all tests here...
end