Browse files

Merge pull request #9 from parndt/less_rails

Fixes issue #7 by not requiring the full Rails stack, only activerecord and railties.
  • Loading branch information...
2 parents abad3a0 + 39011eb commit 13a8b3e7af0f6b0215d0e48103e312a7bf80e6b1 @stevehodgkiss committed Mar 17, 2012
Showing with 42 additions and 96 deletions.
  1. +1 −3 Gemfile
  2. +29 −83 Gemfile.lock
  3. +4 −2 generator_spec.gemspec
  4. +6 −6 lib/generator_spec/test_case.rb
  5. +2 −2 spec/spec_helper.rb
View
4 Gemfile
@@ -1,5 +1,3 @@
source "http://rubygems.org"
-gemspec
-
-gem "fakefs"
+gemspec
View
112 Gemfile.lock
@@ -1,97 +1,43 @@
PATH
remote: .
specs:
- generator_spec (0.8.4)
- rails (>= 3.0, < 4.0)
- rspec-rails
+ generator_spec (0.8.5)
+ activerecord (>= 3.0, < 4.0)
GEM
- remote: http://rubygems.org/
+ remote: https://rubygems.org/
specs:
- abstract (1.0.0)
- actionmailer (3.0.10)
- actionpack (= 3.0.10)
- mail (~> 2.2.19)
- actionpack (3.0.10)
- activemodel (= 3.0.10)
- activesupport (= 3.0.10)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.5.0)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.14)
- rack-test (~> 0.5.7)
- tzinfo (~> 0.3.23)
- activemodel (3.0.10)
- activesupport (= 3.0.10)
- builder (~> 2.1.2)
- i18n (~> 0.5.0)
- activerecord (3.0.10)
- activemodel (= 3.0.10)
- activesupport (= 3.0.10)
- arel (~> 2.0.10)
- tzinfo (~> 0.3.23)
- activeresource (3.0.10)
- activemodel (= 3.0.10)
- activesupport (= 3.0.10)
- activesupport (3.0.10)
- arel (2.0.10)
- builder (2.1.2)
- diff-lcs (1.1.2)
- erubis (2.6.6)
- abstract (>= 1.0.0)
+ activemodel (3.2.2)
+ activesupport (= 3.2.2)
+ builder (~> 3.0.0)
+ activerecord (3.2.2)
+ activemodel (= 3.2.2)
+ activesupport (= 3.2.2)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.2)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ builder (3.0.0)
+ diff-lcs (1.1.3)
fakefs (0.3.1)
- i18n (0.5.0)
- mail (2.2.19)
- activesupport (>= 2.3.6)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.16)
- polyglot (0.3.2)
- rack (1.2.3)
- rack-mount (0.6.14)
- rack (>= 1.0.0)
- rack-test (0.5.7)
- rack (>= 1.0)
- rails (3.0.10)
- actionmailer (= 3.0.10)
- actionpack (= 3.0.10)
- activerecord (= 3.0.10)
- activeresource (= 3.0.10)
- activesupport (= 3.0.10)
- bundler (~> 1.0)
- railties (= 3.0.10)
- railties (3.0.10)
- actionpack (= 3.0.10)
- activesupport (= 3.0.10)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (~> 0.14.4)
- rake (0.9.2)
- rdoc (3.9.3)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
+ i18n (0.6.0)
+ multi_json (1.1.0)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
- rspec-rails (2.6.1)
- actionpack (~> 3.0)
- activesupport (~> 3.0)
- railties (~> 3.0)
- rspec (~> 2.6.0)
- thor (0.14.6)
- treetop (1.4.10)
- polyglot
- polyglot (>= 0.3.1)
- tzinfo (0.3.29)
+ rspec-mocks (2.8.0)
+ tzinfo (0.3.32)
PLATFORMS
ruby
DEPENDENCIES
- fakefs
+ fakefs (~> 0.3.1)
generator_spec!
+ rspec
View
6 generator_spec.gemspec
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency "rails", ">= 3.0", "< 4.0"
- s.add_dependency "rspec-rails"
+ s.add_dependency 'activerecord', ['>= 3.0', '< 4.0']
+ s.add_dependency 'railties', ['>= 3.0', '< 4.0']
+ s.add_development_dependency 'rspec'
+ s.add_development_dependency 'fakefs', '~> 0.3.1'
end
View
12 lib/generator_spec/test_case.rb
@@ -1,25 +1,25 @@
-require 'rspec/rails'
+require 'active_record'
+require 'rspec'
require 'rails/generators/test_case'
require 'generator_spec/matcher'
module GeneratorSpec
module TestCase
extend ActiveSupport::Concern
- include RSpec::Rails::RailsExampleGroup
include Matcher
include FileUtils
-
+
included do
cattr_accessor :test_case, :test_case_instance
-
+
self.test_case = Class.new(Rails::Generators::TestCase) do
def fake_test_case; end
def add_assertion; end
end
self.test_case_instance = self.test_case.new(:fake_test_case)
self.test_case.tests described_class
end
-
+
module ClassMethods
def tests(klass)
self.test_case.generator_class = klass
@@ -33,7 +33,7 @@ def destination(path)
self.test_case.destination_root = path
end
end
-
+
def method_missing(method_sym, *arguments, &block)
self.test_case_instance.send(method_sym, *arguments, &block)
end
View
4 spec/spec_helper.rb
@@ -1,6 +1,6 @@
require 'bundler/setup'
-require 'rails/all'
-require 'rspec/rails'
+require 'active_record'
+require 'rspec'
require 'generator_spec/test_case'
require 'fakefs/spec_helpers'

0 comments on commit 13a8b3e

Please sign in to comment.