minitest-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +23 -0
  3. data/.gemtest +0 -0
  4. data/CHANGELOG.rdoc +5 -0
  5. data/Manifest.txt +30 -0
  6. data/README.rdoc +34 -0
  7. data/Rakefile +26 -0
  8. data/lib/generators/minitest.rb +12 -0
  9. data/lib/generators/minitest/controller/controller_generator.rb +18 -0
  10. data/lib/generators/minitest/helper/helper_generator.rb +13 -0
  11. data/lib/generators/minitest/helper/templates/helper_test.rb +7 -0
  12. data/lib/generators/minitest/integration/integration_generator.rb +13 -0
  13. data/lib/generators/minitest/integration/templates/integration_test.rb +10 -0
  14. data/lib/generators/minitest/mailer/mailer_generator.rb +14 -0
  15. data/lib/generators/minitest/mailer/templates/functional_test.rb +23 -0
  16. data/lib/generators/minitest/model/model_generator.rb +24 -0
  17. data/lib/generators/minitest/model/templates/fixtures.yml +23 -0
  18. data/lib/generators/minitest/model/templates/model_spec.rb +18 -0
  19. data/lib/generators/minitest/model/templates/model_test.rb +11 -0
  20. data/lib/generators/minitest/observer/observer_generator.rb +13 -0
  21. data/lib/generators/minitest/observer/templates/unit_test.rb +11 -0
  22. data/lib/generators/minitest/performance/performance_generator.rb +13 -0
  23. data/lib/generators/minitest/performance/templates/performance_test.rb +12 -0
  24. data/lib/generators/minitest/plugin/plugin_generator.rb +13 -0
  25. data/lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt +7 -0
  26. data/lib/generators/minitest/plugin/templates/test_helper.rb +4 -0
  27. data/lib/generators/minitest/scaffold/scaffold_generator.rb +17 -0
  28. data/lib/generators/minitest/scaffold/templates/functional_test.rb +53 -0
  29. data/lib/minitest-rails.rb +44 -0
  30. data/lib/minitest/rails/tasks/minitest.rake +29 -0
  31. data/test/test_controller_generator.rb +39 -0
  32. data/test/test_minitest.rb +8 -0
  33. data/test/test_model_generator.rb +39 -0
  34. metadata +166 -0
  35. metadata.gz.sig +2 -0
Binary file
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
File without changes
@@ -0,0 +1,5 @@
1
+ === 0.0.1 / 2011-05-24
2
+
3
+ * 1 major enhancement
4
+
5
+ * Hello world!
@@ -0,0 +1,30 @@
1
+ .autotest
2
+ CHANGELOG.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/generators/minitest.rb
7
+ lib/generators/minitest/controller/controller_generator.rb
8
+ lib/generators/minitest/helper/helper_generator.rb
9
+ lib/generators/minitest/helper/templates/helper_test.rb
10
+ lib/generators/minitest/integration/integration_generator.rb
11
+ lib/generators/minitest/integration/templates/integration_test.rb
12
+ lib/generators/minitest/mailer/mailer_generator.rb
13
+ lib/generators/minitest/mailer/templates/functional_test.rb
14
+ lib/generators/minitest/model/model_generator.rb
15
+ lib/generators/minitest/model/templates/fixtures.yml
16
+ lib/generators/minitest/model/templates/model_spec.rb
17
+ lib/generators/minitest/model/templates/model_test.rb
18
+ lib/generators/minitest/observer/observer_generator.rb
19
+ lib/generators/minitest/observer/templates/unit_test.rb
20
+ lib/generators/minitest/performance/performance_generator.rb
21
+ lib/generators/minitest/performance/templates/performance_test.rb
22
+ lib/generators/minitest/plugin/plugin_generator.rb
23
+ lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt
24
+ lib/generators/minitest/plugin/templates/test_helper.rb
25
+ lib/generators/minitest/scaffold/scaffold_generator.rb
26
+ lib/generators/minitest/scaffold/templates/functional_test.rb
27
+ lib/minitest-rails.rb
28
+ lib/minitest/rails/tasks/minitest.rake
29
+ test/test_minitest.rb
30
+ test/test_model_generator.rb
@@ -0,0 +1,34 @@
1
+ = minitest-rails
2
+
3
+ MiniTest integration for Rails 3.1.
4
+
5
+ == Install
6
+
7
+ gem install minitest-rails
8
+
9
+ This installs the following gems:
10
+
11
+ minitest
12
+
13
+ == Configure
14
+
15
+ Create a new rails app without Test::Unit:
16
+
17
+ rails new MyApp --skip-test-unit
18
+
19
+ Add `minitest-rails` to the `:test` and `:development` groups in Isolate:
20
+
21
+ env :development, :test do
22
+ gem 'minitest-rails'
23
+ end
24
+
25
+ Or, for the unenlightened, add `minitest-rails` to the `:test` and `:development` groups in Gemfile:
26
+
27
+ group :test, :development do
28
+ gem 'minitest-rails'
29
+ end
30
+
31
+ == Usage
32
+
33
+ We aim to expose MiniTest with minimal changes for testing within Rails.
34
+ You can either create test classes that inherit from MiniTest::Unit::TestCase or you can use the MiniTest::Spec DSL.
@@ -0,0 +1,26 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.plugin :git
7
+ Hoe.plugins.delete :rubyforge
8
+
9
+ Hoe.spec 'minitest-rails' do
10
+ developer 'Mike Moore', 'mike@blowmage.com'
11
+
12
+ self.summary = 'MiniTest integration for Rails 3.1.'
13
+ self.description = 'Adds MiniTest as the default testing library in Rails. Also adds a bit of sanity with how tests are organized.'
14
+ self.url = 'http://blowmage.com/minitest-rails'
15
+
16
+ self.history_file = "CHANGELOG.rdoc"
17
+ self.readme_file = "README.rdoc"
18
+ self.testlib = :minitest
19
+
20
+ extra_deps << ['minitest', '~> 2.0']
21
+ extra_deps << ['railties', '~> 3.0']
22
+ extra_deps << ['activesupport', '~> 3.0']
23
+ extra_deps << ['actionpack', '~> 3.0']
24
+ end
25
+
26
+ # vim: syntax=ruby
@@ -0,0 +1,12 @@
1
+ require 'rails/generators/named_base'
2
+
3
+ # Blatantly stolen from rspec-rails
4
+ module MiniTest
5
+ module Generators
6
+ class Base < ::Rails::Generators::NamedBase #:nodoc:
7
+ def self.source_root
8
+ @_minitest_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'minitest', generator_name, 'templates'))
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest::Generators
4
+ class ControllerGenerator < Base
5
+ argument :actions, :type => :array, :default => [], :banner => "action action"
6
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
7
+
8
+ check_class_collision :suffix => "ControllerTest"
9
+
10
+ def create_test_files
11
+ if options[:spec]
12
+ template 'controller_spec.rb', File.join('test/controllers', class_path, "#{file_name}_controller_test.rb")
13
+ else
14
+ template 'controller_test.rb', File.join('test/controllers', class_path, "#{file_name}_controller_test.rb")
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class HelperGenerator < MiniTest::Rails::Generators::Base
6
+ check_class_collision :suffix => "HelperTest"
7
+
8
+ def create_helper_files
9
+ template 'helper_test.rb', File.join('test/unit/helpers', class_path, "#{file_name}_helper_test.rb")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>HelperTest < MiniTest::Unit::TestCase
5
+ # load_code_to_test_helper
6
+ end
7
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class IntegrationGenerator < MiniTest::Rails::Generators::Base
6
+ check_class_collision :suffix => "Test"
7
+
8
+ def create_test_files
9
+ template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < MiniTest::Unit::TestCase
4
+ load_code_to_test_integration
5
+ fixtures :all
6
+
7
+ # def test_truth
8
+ # assert true
9
+ # end
10
+ end
@@ -0,0 +1,14 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class MailerGenerator < MiniTest::Rails::Generators::Base
6
+ argument :actions, :type => :array, :default => [], :banner => "method method"
7
+ check_class_collision :suffix => "Test"
8
+
9
+ def create_test_files
10
+ template "functional_test.rb", File.join('test/functional', class_path, "#{file_name}_test.rb")
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>Test < MiniTest::Unit::TestCase
5
+ # load_code_to_test_mailer
6
+
7
+ <% actions.each do |action| -%>
8
+ def test_<%= action %>
9
+ mail = <%= class_name %>.<%= action %>
10
+ assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
11
+ assert_equal ["to@example.org"], mail.to
12
+ assert_equal ["from@example.com"], mail.from
13
+ assert_match "Hi", mail.body.encoded
14
+ end
15
+
16
+ <% end -%>
17
+ <% if actions.blank? -%>
18
+ # def test_truth
19
+ # assert true
20
+ # end
21
+ <% end -%>
22
+ end
23
+ <% end -%>
@@ -0,0 +1,24 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class ModelGenerator < Base
6
+ argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
7
+ class_option :fixture, :type => :boolean, :default => false, :desc => "Create fixture file"
8
+ class_option :spec, :type => :boolean, :default => false, :desc => "Use MiniTest::Spec DSL"
9
+
10
+ check_class_collision :suffix => "Test"
11
+
12
+ def create_test_files
13
+ if options[:spec]
14
+ template 'model_spec.rb', File.join('test/models', class_path, "#{file_name}_test.rb")
15
+ else
16
+ template 'model_test.rb', File.join('test/models', class_path, "#{file_name}_test.rb")
17
+ end
18
+ if options[:fixture]
19
+ template 'fixtures.yml', File.join('test/fixtures', class_path, "#{plural_file_name}.yml")
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/Fixtures.html
2
+
3
+ <% unless attributes.empty? -%>
4
+ one:
5
+ <% attributes.each do |attribute| -%>
6
+ <%= attribute.name %>: <%= attribute.default %>
7
+ <% end -%>
8
+
9
+ two:
10
+ <% attributes.each do |attribute| -%>
11
+ <%= attribute.name %>: <%= attribute.default %>
12
+ <% end -%>
13
+ <% else -%>
14
+ # This model initially had no columns defined. If you add columns to the
15
+ # model remove the '{}' from the fixture names and add the columns immediately
16
+ # below each fixture, per the syntax in the comments below
17
+ #
18
+ one: {}
19
+ # column: value
20
+ #
21
+ two: {}
22
+ # column: value
23
+ <% end -%>
@@ -0,0 +1,18 @@
1
+ require 'test_helper'
2
+
3
+ describe <%= class_name %> do
4
+ before do
5
+ @<%= file_name %> = <%= class_name %>.new
6
+ end
7
+
8
+ it "must be valid" do
9
+ @<%= file_name %>.valid?.must_equal true
10
+ end
11
+
12
+ # describe "when doing its thing" do
13
+ # it "must be interesting" do
14
+ # @<%= file_name %>.blow_minds!
15
+ # @<%= file_name %>.interesting?.must_equal true
16
+ # end
17
+ # end
18
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>Test < MiniTest::Unit::TestCase
5
+ load_code_to_test_model
6
+
7
+ # def test_truth
8
+ # assert true
9
+ # end
10
+ end
11
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class ObserverGenerator < MiniTest::Rails::Generators::Base
6
+ check_class_collision :suffix => "ObserverTest"
7
+
8
+ def create_test_files
9
+ template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_observer_test.rb")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>ObserverTest < MiniTest::Unit::TestCase
5
+ # load_code_to_test_observer
6
+
7
+ # def test_truth
8
+ # assert true
9
+ # end
10
+ end
11
+ <% end -%>
@@ -0,0 +1,13 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class PerformanceGenerator < MiniTest::Rails::Generators::Base
6
+ check_class_collision :suffix => "Test"
7
+
8
+ def create_test_files
9
+ template 'performance_test.rb', File.join('test/performance', class_path, "#{file_name}_test.rb")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ require 'test_helper'
2
+ require 'rails/performance_test_help'
3
+
4
+ class <%= class_name %>Test < ActionDispatch::PerformanceTest
5
+ # Refer to the documentation for all available options
6
+ # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory]
7
+ # :output => 'tmp/performance', :formats => [:flat] }
8
+
9
+ def test_homepage
10
+ get '/'
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require 'generators/minitest'
2
+
3
+ module MiniTest
4
+ module Generators
5
+ class PluginGenerator < MiniTest::Rails::Generators::Base
6
+ check_class_collision :suffix => "Test"
7
+
8
+ def create_test_files
9
+ directory '.', 'test'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < MiniTest::Unit::TestCase
4
+ # def test_truth
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'minitest'
3
+ require 'minitest-rails'
4
+ require 'active_support'
@@ -0,0 +1,17 @@
1
+ require 'generators/minitest'
2
+ require 'rails/generators/resource_helpers'
3
+
4
+ module MiniTest
5
+ module Generators
6
+ class ScaffoldGenerator < MiniTest::Rails::Generators::Base
7
+ include Rails::Generators::ResourceHelpers
8
+
9
+ check_class_collision :suffix => "ControllerTest"
10
+
11
+ def create_test_files
12
+ template 'functional_test.rb',
13
+ File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb")
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,53 @@
1
+ require 'test_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= controller_class_name %>ControllerTest < MiniTest::Unit::TestCase
5
+ load_code_to_test_controller
6
+
7
+ setup do
8
+ @<%= singular_table_name %> = <%= table_name %>(:one)
9
+ end
10
+
11
+ def test_index do
12
+ get :index
13
+ assert_response :success
14
+ assert_not_nil assigns(:<%= table_name %>)
15
+ end
16
+
17
+ def test_new
18
+ get :new
19
+ assert_response :success
20
+ end
21
+
22
+ def test_create
23
+ assert_difference('<%= class_name %>.count') do
24
+ post :create, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %>
25
+ end
26
+
27
+ assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
28
+ end
29
+
30
+ def test_show
31
+ get :show, <%= key_value :id, "@#{singular_table_name}.to_param" %>
32
+ assert_response :success
33
+ end
34
+
35
+ def test_edit
36
+ get :edit, <%= key_value :id, "@#{singular_table_name}.to_param" %>
37
+ assert_response :success
38
+ end
39
+
40
+ def test_update
41
+ put :update, <%= key_value :id, "@#{singular_table_name}.to_param" %>, <%= key_value singular_table_name, "@#{singular_table_name}.attributes" %>
42
+ assert_redirected_to <%= singular_table_name %>_path(assigns(:<%= singular_table_name %>))
43
+ end
44
+
45
+ def test_destroy
46
+ assert_difference('<%= class_name %>.count', -1) do
47
+ delete :destroy, <%= key_value :id, "@#{singular_table_name}.to_param" %>
48
+ end
49
+
50
+ assert_redirected_to <%= index_helper %>_path
51
+ end
52
+ end
53
+ <% end -%>
@@ -0,0 +1,44 @@
1
+ require 'rails/railtie'
2
+ require 'active_support/testing/setup_and_teardown'
3
+ require 'active_record/fixtures'
4
+ require 'action_controller'
5
+
6
+
7
+ require 'minitest/unit'
8
+ require 'minitest/spec'
9
+ require 'minitest/mock'
10
+
11
+ module MiniTest
12
+ module Rails
13
+ VERSION = '0.0.1'
14
+ class Railtie < ::Rails::Railtie
15
+ config.app_generators.integration_tool :minitest
16
+ config.app_generators.test_framework :minitest
17
+
18
+ rake_tasks do
19
+ load 'minitest/rails/tasks/minitest.rake'
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ # Tip of hat to tenderlove for the following
26
+ # https://gist.github.com/821572
27
+ class MiniTest::Unit::TestCase
28
+ include ActiveSupport::Testing::SetupAndTeardown
29
+
30
+ def load_code_to_test_model
31
+ include ActiveRecord::TestFixtures
32
+ self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
33
+ end
34
+
35
+ def load_code_to_test_controller
36
+ include ActionController::TestCase::Behavior
37
+ end
38
+
39
+ # Support integration tests by calling ""
40
+ end
41
+
42
+ class MiniTest::Spec
43
+ alias :method_name :__name__ if defined? :__name__
44
+ end
@@ -0,0 +1,29 @@
1
+ require 'rake/testtask'
2
+
3
+ MINITEST_TASKS = %w(models controllers views helpers integration)
4
+
5
+ desc 'Runs all tests'
6
+ task :test do
7
+ errors = MINITEST_TASKS.collect do |task|
8
+ begin
9
+ Rake::Task["test:#{task}"].invoke
10
+ nil
11
+ rescue => e
12
+ task
13
+ end
14
+ end.compact
15
+ abort "Errors running #{errors * ', '}!" if errors.any?
16
+ end
17
+
18
+ namespace :test do
19
+ task :prepare do
20
+ # Placeholder task for other Railtie and plugins to enhance. See Active Record for an example.
21
+ end
22
+
23
+ MINITEST_TASKS.each do |sub|
24
+ Rake::TestTask.new(sub => 'test:prepare') do |t|
25
+ t.libs << 'test'
26
+ t.pattern = "test/#{sub}/**/*_test.rb"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,39 @@
1
+ require "minitest/autorun"
2
+ require "minitest-rails"
3
+
4
+ require 'rails'
5
+ require 'rails/generators'
6
+
7
+ require 'generators/minitest/controller/controller_generator'
8
+
9
+ require 'fileutils'
10
+
11
+ class TestControllerGenerator < MiniTest::Unit::TestCase
12
+ Rails::Generators.no_color!
13
+
14
+ def test_controller_generator
15
+ text = capture(:stdout) do
16
+ MiniTest::Generators::ControllerGenerator.start ['user']
17
+ end
18
+ assert_equal " create test/controllers/user_controller_test.rb\n", text
19
+ assert File.exists? 'test/controllers/user_controller_test.rb'
20
+ contents = open('test/controllers/user_controller_test.rb').read
21
+ assert_match /class UserControllerTest < MiniTest::Unit::TestCase/m, contents
22
+ ensure
23
+ # TODO: Don't write the files
24
+ # I agree, it would be better to mock the file getting written
25
+ FileUtils.rm_r 'test/controllers'
26
+ end
27
+
28
+ def test_controller_generator_spec
29
+ text = capture(:stdout) do
30
+ MiniTest::Generators::ControllerGenerator.start ['user', '--spec']
31
+ end
32
+ assert_equal " create test/controllers/user_controller_test.rb\n", text
33
+ assert File.exists? 'test/controllers/user_controller_test.rb'
34
+ contents = open('test/controllers/user_controller_test.rb').read
35
+ assert_match /describe UserController do/m, contents
36
+ ensure
37
+ FileUtils.rm_r 'test/controllers'
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ require "minitest/autorun"
2
+ require "minitest-rails"
3
+
4
+ class TestMiniTest < MiniTest::Unit::TestCase
5
+ def test_sanity
6
+ assert MiniTest::Rails::VERSION
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ require "minitest/autorun"
2
+ require "minitest-rails"
3
+
4
+ require 'rails'
5
+ require 'rails/generators'
6
+
7
+ require 'generators/minitest/model/model_generator'
8
+
9
+ require 'fileutils'
10
+
11
+ class TestModelGenerator < MiniTest::Unit::TestCase
12
+ Rails::Generators.no_color!
13
+
14
+ def test_model_generator
15
+ text = capture(:stdout) do
16
+ MiniTest::Generators::ModelGenerator.start ['user']
17
+ end
18
+ assert_equal " create test/models/user_test.rb\n", text
19
+ assert File.exists? 'test/models/user_test.rb'
20
+ contents = open('test/models/user_test.rb').read
21
+ assert_match /class UserTest < MiniTest::Unit::TestCase/m, contents
22
+ ensure
23
+ # TODO: Don't write the files
24
+ # I agree, it would be better to mock the file getting written
25
+ FileUtils.rm_r 'test/models'
26
+ end
27
+
28
+ def test_model_generator_spec
29
+ text = capture(:stdout) do
30
+ MiniTest::Generators::ModelGenerator.start ['user', '--spec']
31
+ end
32
+ assert_equal " create test/models/user_test.rb\n", text
33
+ assert File.exists? 'test/models/user_test.rb'
34
+ contents = open('test/models/user_test.rb').read
35
+ assert_match /describe User do/m, contents
36
+ ensure
37
+ FileUtils.rm_r 'test/models'
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-rails
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Mike Moore
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQ0wCwYDVQQDDARtaWtl
15
+ MRgwFgYKCZImiZPyLGQBGRYIYmxvd21hZ2UxEzARBgoJkiaJk/IsZAEZFgNjb20w
16
+ HhcNMTEwNTI1MTc0NTM0WhcNMTIwNTI0MTc0NTM0WjA+MQ0wCwYDVQQDDARtaWtl
17
+ MRgwFgYKCZImiZPyLGQBGRYIYmxvd21hZ2UxEzARBgoJkiaJk/IsZAEZFgNjb20w
18
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzcrfQPtLyKWT6aQh/xe8H
19
+ kTg/7CnSbEpaS9vCSk1Sivkomd/6ZUAyuJu47qx5qEYGih8HJ4odSUUfAcnSCK4v
20
+ C5dSz2WO9GugsMT1Enmc2rNr/foH3ihTiQKYm24ksQMo9qYdQSNDTusyr6IfIm1x
21
+ 4JLYK9Nkky/KYDlnYFjLGWr92D2quBqlk5Lf8KyNYhe1ykG1tpWCeJtwY043EunL
22
+ +LBs69xeL7Mk+rkgxS4UkR+R7h1HLwkOcAgqxlDJw3lxWqFJown0T4nIawRXHLeH
23
+ hbXz+edekLA96iVJrzE3JDkY/07PHoTY7RGKZh0FJmlxK+RgVPNMzTAZK6RyFpiP
24
+ AgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFB09+3va7jnAxjJOMEGYXRbw
25
+ IZoZMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAo3zBi7vXNn5UiUnD
26
+ e1Bsmlf9H5vNPSgIffBRVL7T9YTJ8oFb+7sfOMFxM1Qfj9Csw7ti77uGA3l9GbmP
27
+ Gz8Uk64Idx5TTLFIXdLlPJzdp8u1WVV3l0EpxjBdN8X/x2O99tVc0v9Rt4YnApW8
28
+ TCnsFspoxzqwsb/FR1KLN6Od/8FbobQ3Gh5so2NowcHBS3V2o5TSvaT3WEhAS47b
29
+ 6P6VWyY3ho84Do5T6/ZkgvHlX4BsuImBES/V3bW+LXdi7zSDVjKHM7FZyg1Acw+j
30
+ zRZSumJnIayMxShpnMge5/538xI1nbpa2wr1nJVctw+q6GrOQ+AruFsBM7/NfK/M
31
+ sgxAiQ==
32
+ -----END CERTIFICATE-----
33
+
34
+ date: 2011-05-25 00:00:00 -06:00
35
+ default_executable:
36
+ dependencies:
37
+ - !ruby/object:Gem::Dependency
38
+ name: minitest
39
+ prerelease: false
40
+ requirement: &id001 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: "2.0"
46
+ type: :runtime
47
+ version_requirements: *id001
48
+ - !ruby/object:Gem::Dependency
49
+ name: railties
50
+ prerelease: false
51
+ requirement: &id002 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: "3.0"
57
+ type: :runtime
58
+ version_requirements: *id002
59
+ - !ruby/object:Gem::Dependency
60
+ name: activesupport
61
+ prerelease: false
62
+ requirement: &id003 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: "3.0"
68
+ type: :runtime
69
+ version_requirements: *id003
70
+ - !ruby/object:Gem::Dependency
71
+ name: actionpack
72
+ prerelease: false
73
+ requirement: &id004 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: "3.0"
79
+ type: :runtime
80
+ version_requirements: *id004
81
+ - !ruby/object:Gem::Dependency
82
+ name: hoe
83
+ prerelease: false
84
+ requirement: &id005 !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.9.4
90
+ type: :development
91
+ version_requirements: *id005
92
+ description: Adds MiniTest as the default testing library in Rails. Also adds a bit of sanity with how tests are organized.
93
+ email:
94
+ - mike@blowmage.com
95
+ executables: []
96
+
97
+ extensions: []
98
+
99
+ extra_rdoc_files:
100
+ - Manifest.txt
101
+ files:
102
+ - .autotest
103
+ - CHANGELOG.rdoc
104
+ - Manifest.txt
105
+ - README.rdoc
106
+ - Rakefile
107
+ - lib/generators/minitest.rb
108
+ - lib/generators/minitest/controller/controller_generator.rb
109
+ - lib/generators/minitest/helper/helper_generator.rb
110
+ - lib/generators/minitest/helper/templates/helper_test.rb
111
+ - lib/generators/minitest/integration/integration_generator.rb
112
+ - lib/generators/minitest/integration/templates/integration_test.rb
113
+ - lib/generators/minitest/mailer/mailer_generator.rb
114
+ - lib/generators/minitest/mailer/templates/functional_test.rb
115
+ - lib/generators/minitest/model/model_generator.rb
116
+ - lib/generators/minitest/model/templates/fixtures.yml
117
+ - lib/generators/minitest/model/templates/model_spec.rb
118
+ - lib/generators/minitest/model/templates/model_test.rb
119
+ - lib/generators/minitest/observer/observer_generator.rb
120
+ - lib/generators/minitest/observer/templates/unit_test.rb
121
+ - lib/generators/minitest/performance/performance_generator.rb
122
+ - lib/generators/minitest/performance/templates/performance_test.rb
123
+ - lib/generators/minitest/plugin/plugin_generator.rb
124
+ - lib/generators/minitest/plugin/templates/%file_name%_test.rb.tt
125
+ - lib/generators/minitest/plugin/templates/test_helper.rb
126
+ - lib/generators/minitest/scaffold/scaffold_generator.rb
127
+ - lib/generators/minitest/scaffold/templates/functional_test.rb
128
+ - lib/minitest-rails.rb
129
+ - lib/minitest/rails/tasks/minitest.rake
130
+ - test/test_minitest.rb
131
+ - test/test_model_generator.rb
132
+ - test/test_controller_generator.rb
133
+ - .gemtest
134
+ has_rdoc: true
135
+ homepage: http://blowmage.com/minitest-rails
136
+ licenses: []
137
+
138
+ post_install_message:
139
+ rdoc_options:
140
+ - --main
141
+ - README.rdoc
142
+ require_paths:
143
+ - lib
144
+ required_ruby_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: "0"
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: "0"
156
+ requirements: []
157
+
158
+ rubyforge_project: minitest-rails
159
+ rubygems_version: 1.6.0
160
+ signing_key:
161
+ specification_version: 3
162
+ summary: MiniTest integration for Rails 3.1.
163
+ test_files:
164
+ - test/test_controller_generator.rb
165
+ - test/test_minitest.rb
166
+ - test/test_model_generator.rb
@@ -0,0 +1,2 @@
1
+ \ Zʛ�)���~���?
2
+ ��r0_��JJ� ��)L���