hobofields 0.7.5 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,65 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ require 'rails_generator'
4
+
5
+ class TestHobofieldModelGenerator < Test::Unit::TestCase
6
+ include RubiGen::GeneratorTestHelper
7
+
8
+ def setup
9
+ bare_setup
10
+ end
11
+
12
+ def teardown
13
+ bare_teardown
14
+ end
15
+
16
+ # Some generator-related assertions:
17
+ # assert_generated_file(name, &block) # block passed the file contents
18
+ # assert_directory_exists(name)
19
+ # assert_generated_class(name, &block)
20
+ # assert_generated_module(name, &block)
21
+ # assert_generated_test_for(name, &block)
22
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
23
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
24
+ #
25
+ # Other helper methods are:
26
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
27
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
28
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
29
+
30
+ def test_generator_underscore_name
31
+ name = "my_model"
32
+ run_generator('hobofield_model', [name], sources)
33
+ assert_generated_file("app/models/my_model.rb")
34
+ assert_generated_class("app/models/my_model") do |body|
35
+ end
36
+
37
+ assert_generated_file("test/unit/my_model_test.rb")
38
+ assert_generated_class("test/unit/my_model_test") do |body|
39
+ assert_has_method "test_truth"
40
+ end
41
+ end
42
+
43
+ def test_generator_camelcase
44
+ name = "MyModel"
45
+ run_generator('hobofield_model', [name], sources)
46
+ assert_generated_file("app/models/my_model.rb")
47
+ assert_generated_class("app/models/my_model") do |body|
48
+ end
49
+
50
+ assert_generated_file("test/unit/my_model_test.rb")
51
+ assert_generated_class("test/unit/my_model_test") do |body|
52
+ assert_has_method "test_truth"
53
+ end
54
+ end
55
+
56
+ private
57
+ def sources
58
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
59
+ ]
60
+ end
61
+
62
+ def generator_path
63
+ "rails_generators"
64
+ end
65
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobofields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: "0.8"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Locke
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-18 00:00:00 +01:00
12
+ date: 2008-09-03 00:00:00 +01:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hobosupport
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0.8"
24
+ version:
16
25
  description: Rich field types and migration generator for Rails
17
26
  email: tom@tomlocke.com
18
27
  executables: []
@@ -38,8 +47,6 @@ extra_rdoc_files:
38
47
  - README.txt
39
48
  files:
40
49
  - CHANGES.txt
41
- - generators/hobo_migration/hobo_migration_generator.rb
42
- - generators/hobo_migration/templates/migration.rb
43
50
  - init.rb
44
51
  - lib/hobo_fields/email_address.rb
45
52
  - lib/hobo_fields/enum_string.rb
@@ -56,12 +63,23 @@ files:
56
63
  - lib/hobo_fields.rb
57
64
  - lib/hobofields.rb
58
65
  - LICENSE.txt
66
+ - Manifest
67
+ - rails_generators/hobo_migration/hobo_migration_generator.rb
68
+ - rails_generators/hobo_migration/templates/migration.rb
69
+ - rails_generators/hobofield_model/hobofield_model_generator.rb
70
+ - rails_generators/hobofield_model/templates/fixtures.yml.erb
71
+ - rails_generators/hobofield_model/templates/model.rb.erb
72
+ - rails_generators/hobofield_model/templates/test.rb.erb
73
+ - rails_generators/hobofield_model/USAGE
59
74
  - README.txt
75
+ - script/destroy
76
+ - script/generate
60
77
  - test/hobofields.rdoctest
61
78
  - test/hobofields_api.rdoctest
62
79
  - test/migration_generator.rdoctest
63
80
  - test/rich_types.rdoctest
64
- - Manifest
81
+ - test/test_generator_helper.rb
82
+ - test/test_hobofield_model_generator.rb
65
83
  - hobofields.gemspec
66
84
  has_rdoc: true
67
85
  homepage: http://hobocentral.net/hobofields
@@ -90,9 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
108
  requirements: []
91
109
 
92
110
  rubyforge_project: hobo
93
- rubygems_version: 1.0.1
111
+ rubygems_version: 1.2.0
94
112
  signing_key:
95
113
  specification_version: 2
96
114
  summary: Rich field types and migration generator for Rails
97
- test_files: []
98
-
115
+ test_files:
116
+ - test/test_generator_helper.rb
117
+ - test/test_hobofield_model_generator.rb