autotest-rails-fix 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 77107dc961d93f9d9a1a42da568b95c9447e4b91
4
+ data.tar.gz: 0d33e69d92977b6674ff24f7392e8d5db31e85a8
5
+ SHA512:
6
+ metadata.gz: 37a933b43af9b15af1600bea4cbb80b19ed7b746e6f915a88ab1002f9385f02ab4fa5a31094748cd188d9229d77bb829c7f70dca1605d02702b90f5853c47e18
7
+ data.tar.gz: eeba691b26e465d8606d7cd5fdd5c4ede911e16b665a8255e894578373e3c330cf538185df2f379e78a6adef941083a0f4279138a9a9b5b36d3c5863f5d513e8
@@ -0,0 +1,5 @@
1
+ Autotest.add_discovery do
2
+ style = []
3
+ style << "rails" if File.exist? 'config/environment.rb'
4
+ style
5
+ end
@@ -0,0 +1,12 @@
1
+ # -*- ruby -*-
2
+
3
+ # This is an example of how to change the mappings of file that
4
+ # changed to tests to run for a project.
5
+
6
+ module Autotest::Fixtures
7
+ Autotest.add_hook :initialize do |at|
8
+ at.test_mappings['^test/fixtures/(.*)s.yml'] = proc { |filename, matches|
9
+ at.files_matching(/test\/\w+\/#{matches[1]}(_\w+)?.*_test.rb$/)
10
+ }
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ # -*- ruby -*-
2
+
3
+ module Autotest::Migrate
4
+ Autotest.add_hook(:run) do |autotest|
5
+ system "rake db:migrate" if autotest.class.to_s == "RailsAutotest"
6
+ end
7
+ end
@@ -0,0 +1,82 @@
1
+ require 'autotest'
2
+
3
+ class Autotest::Rails < Autotest
4
+ VERSION = '4.1.2'
5
+
6
+ def initialize # :nodoc:
7
+ super
8
+
9
+ add_exception %r%^\./(?:db|doc|log|public|script|tmp|vendor)%
10
+
11
+ clear_mappings
12
+
13
+ self.add_mapping(/^lib\/.*\.rb$/) do |filename, _|
14
+ impl = File.basename(filename, '.rb')
15
+ files_matching %r%^test/unit/#{impl}_test.rb$%
16
+ # TODO: (unit|functional|integration) maybe?
17
+ end
18
+
19
+ add_mapping %r%^test/fixtures/(.*)s.yml% do |_, m|
20
+ ["test/unit/#{m[1]}_test.rb",
21
+ "test/controllers/#{m[1]}_controller_test.rb",
22
+ "test/views/#{m[1]}_view_test.rb",
23
+ "test/functional/#{m[1]}_controller_test.rb"]
24
+ end
25
+
26
+ add_mapping %r%^test/(unit|integration|controllers|models|views|functional)/.*rb$% do |filename, _|
27
+ filename
28
+ end
29
+
30
+ add_mapping %r%^app/models/(.*)\.rb$% do |_, m|
31
+ "test/unit/#{m[1]}_test.rb"
32
+ end
33
+
34
+ add_mapping %r%^app/helpers/application_helper.rb% do
35
+ files_matching %r%^test/(views|functional)/.*_test\.rb$%
36
+ end
37
+
38
+ add_mapping %r%^app/helpers/(.*)_helper.rb% do |_, m|
39
+ if m[1] == "application" then
40
+ files_matching %r%^test/(views|functional)/.*_test\.rb$%
41
+ else
42
+ ["test/views/#{m[1]}_view_test.rb",
43
+ "test/functional/#{m[1]}_controller_test.rb"]
44
+ end
45
+ end
46
+
47
+ add_mapping %r%^app/views/(.*)/% do |_, m|
48
+ ["test/views/#{m[1]}_view_test.rb",
49
+ "test/functional/#{m[1]}_controller_test.rb"]
50
+ end
51
+
52
+ add_mapping %r%^app/controllers/(.*)\.rb$% do |_, m|
53
+ if m[1] == "application" then
54
+ files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
55
+ else
56
+ ["test/controllers/#{m[1]}_test.rb",
57
+ "test/functional/#{m[1]}_test.rb"]
58
+ end
59
+ end
60
+
61
+ add_mapping %r%^app/views/layouts/% do
62
+ "test/views/layouts_view_test.rb"
63
+ end
64
+
65
+ add_mapping %r%^config/routes.rb$% do # FIX:
66
+ files_matching %r%^test/(controllers|views|functional)/.*_test\.rb$%
67
+ end
68
+
69
+ add_mapping %r%^test/test_helper.rb|config/((boot|environment(s/test)?).rb|database.yml)% do
70
+ files_matching %r%^test/(unit|controllers|views|functional)/.*_test\.rb$%
71
+ end
72
+ end
73
+
74
+ # Convert the pathname s to the name of class.
75
+ def path_to_classname(s)
76
+ sep = File::SEPARATOR
77
+ f = s.sub(/^test#{sep}((\w+)#{sep})?/, '').sub(/\.rb$/, '').split(sep)
78
+ f = f.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }
79
+ f = f.map { |path| path =~ /Test$/ ? path : "#{path}Test" }
80
+ f.join('::')
81
+ end
82
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autotest-rails-fix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Kennedy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: autotest supporting model tests
14
+ email: cspheregreen@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/autotest/discover.rb
20
+ - lib/autotest/fixtures.rb
21
+ - lib/autotest/migrate.rb
22
+ - lib/autotest/rails.rb
23
+ homepage: https://rubygems.org/gems/rubhub
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.0.3
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Fork of autotest supporting model tests
47
+ test_files: []