Browse Source

add rspec.

saberma 10 years ago
parent
commit
b566c3f6b7
5 changed files with 34 additions and 7 deletions
  1. 13 0
      Gemfile.lock
  2. 5 0
      Rakefile
  3. 7 5
      china_city.gemspec
  4. 7 0
      lib/china_city/engine.rb
  5. 2 2
      spec/dummy/config/application.rb

+ 13 - 0
Gemfile.lock

@@ -34,6 +34,7 @@ GEM
     arel (4.0.0)
     atomic (1.1.12)
     builder (3.1.4)
+    diff-lcs (1.2.4)
     erubis (2.7.0)
     hike (1.2.3)
     i18n (0.6.4)
@@ -61,6 +62,17 @@ GEM
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
     rake (10.1.0)
+    rspec-core (2.14.4)
+    rspec-expectations (2.14.0)
+      diff-lcs (>= 1.1.3, < 2.0)
+    rspec-mocks (2.14.2)
+    rspec-rails (2.14.0)
+      actionpack (>= 3.0)
+      activesupport (>= 3.0)
+      railties (>= 3.0)
+      rspec-core (~> 2.14.0)
+      rspec-expectations (~> 2.14.0)
+      rspec-mocks (~> 2.14.0)
     sprockets (2.10.0)
       hike (~> 1.2)
       multi_json (~> 1.0)
@@ -85,4 +97,5 @@ PLATFORMS
 
 DEPENDENCIES
   china_city!
+  rspec-rails
   sqlite3

+ 5 - 0
Rakefile

@@ -21,3 +21,8 @@ load 'rails/tasks/engine.rake'
 
 Bundler::GemHelper.install_tasks
 
+require 'rspec/core'
+require 'rspec/core/rake_task'
+desc "Run all specs in spec directory (excluding plugin specs)"
+RSpec::Core::RakeTask.new(:spec)
+task :default => :spec

+ 7 - 5
china_city.gemspec

@@ -7,15 +7,17 @@ require "china_city/version"
 Gem::Specification.new do |s|
   s.name        = "china_city"
   s.version     = ChinaCity::VERSION
-  s.authors     = ["TODO: Your name"]
-  s.email       = ["TODO: Your email"]
-  s.homepage    = "TODO"
-  s.summary     = "TODO: Summary of ChinaCity."
-  s.description = "TODO: Description of ChinaCity."
+  s.authors     = ["saberma"]
+  s.email       = ["mahb45@gmail.com"]
+  s.homepage    = "https://github.com/saberma/china_city"
+  s.summary     = ""
+  s.description = ""
 
   s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
+  s.test_files = Dir["spec/**/*"]
 
   s.add_dependency "rails", "~> 4.0.0"
 
   s.add_development_dependency "sqlite3"
+  s.add_development_dependency "rspec-rails"
 end

+ 7 - 0
lib/china_city/engine.rb

@@ -1,5 +1,12 @@
 module ChinaCity
   class Engine < ::Rails::Engine
     isolate_namespace ChinaCity
+
+    config.generators do |g|
+      g.test_framework      :rspec,        fixture: false
+      # g.fixture_replacement :factory_girl, dir: 'spec/factories'
+      g.assets false
+      g.helper false
+    end
   end
 end

+ 2 - 2
spec/dummy/config/application.rb

@@ -1,9 +1,9 @@
 require File.expand_path('../boot', __FILE__)
 
 # Pick the frameworks you want:
-require "active_record/railtie"
+# require "active_record/railtie"
 require "action_controller/railtie"
-require "action_mailer/railtie"
+# require "action_mailer/railtie"
 require "sprockets/railtie"
 # require "rails/test_unit/railtie"