tamebou 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5337b218ea600e88c40e704f23deb25db2cbadf2
4
- data.tar.gz: 48ed59e0a1af78163e35d98680ace6d8d3c85156
3
+ metadata.gz: 545cadc85fbfe8c8c2308c37ec56fb65f994935a
4
+ data.tar.gz: d4e6987aa32bdb4eb6e72fb419d5aa401057c9be
5
5
  SHA512:
6
- metadata.gz: 36573d5eb886f06c203324da2664f808cb0d6f1fd5cb289a515a42e0aa5f89ff02fd11ece1c1bca2c56a553941a54eb41d6929f5c1aaa1bb7c08b52fe206654b
7
- data.tar.gz: 3485e4b85bb7f6a6419196239c2a1f364b4154c27a023d44a4a5bdef89f3ef3277a60762edcd8a8d9e0b77286e52134676a44c4575a412d32a52319aa3658919
6
+ metadata.gz: 90762b35fccc3d225004da5e233bda8a8c86dcba06acbf41fecdc677fa33567e2f25a4ae0ac66b59707e1061eeb05e9a7864757786c66db9e309b65782b5d170
7
+ data.tar.gz: 19f1cdd9b1d9cfcf882607d9d88630581c7a2eb6d19d0f6dd36ab1e9307466d50ed9ee9c4eae5f35eb2a8cd64314349acd79dd65b27a7da2505d92d84e5f5819
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
data/README.md CHANGED
@@ -1,39 +1,142 @@
1
1
  # Tamebou
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tamebou`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ## Simple validation test generator for rails.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Tamebou generates a simple test for validation of rails.
6
6
 
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
7
+ It read single-line `validates` methods and write test code according to templates. the default fomart is prepared for minitest and rspec.
10
8
 
11
- ```ruby
12
- gem 'tamebou'
13
- ```
9
+ ## cover validation options
14
10
 
15
- And then execute:
11
+ - `exclusion`
12
+ - `inclusion`
13
+ - `length`
14
+ - `numericality`
15
+ - `presence`
16
16
 
17
- $ bundle
17
+ For other validation options, Tamebou generates a template with placeholders.
18
18
 
19
- Or install it yourself as:
19
+ ## Installation
20
20
 
21
- $ gem install tamebou
21
+ ```
22
+ $ gem install tamebou
23
+ ```
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
27
+ ```rb
28
+ class Sample < ActiveRecord::Base
29
+ validates :name, length: { maximum: 32, minimum: 6 }, presence: true
30
+ validates :id, numericality: { only_integer: true, greater_than: 0 }
31
+
32
+ # ...
33
+ end
34
+ ```
26
35
 
27
- ## Development
36
+ ```rb
37
+ irb(main):001:0> Tamebou::Writer.new("../path/to/model/sample.rb").write
38
+ =============================================
39
+ class TestSample < MiniTest::Unit::TestCase
40
+ def setup
41
+ @sample = build(:sample)
42
+ end
43
+
44
+ def teardown
45
+ # you can some clean up code in this method
46
+ end
47
+
48
+ def test_valid_name_values_in_terms_of_length
49
+ expected_values = ["aaaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
50
+ expected_values.each do |expected_value|
51
+ @sample.name = expected_value
52
+ assert @sample.valid?
53
+ end
54
+ end
55
+
56
+ def test_invalid_name_values_in_terms_of_length
57
+ invalid_values = ["aaaaaa", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
58
+ invalid_values.each do |invalid_value|
59
+ @sample.name = invalid_value
60
+ assert_not @sample.valid?
61
+ end
62
+ end
63
+ end
64
+ =============================================
65
+ =============================================
66
+ class TestSample < MiniTest::Unit::TestCase
67
+ def setup
68
+ @sample = build(:sample)
69
+ end
70
+
71
+ def teardown
72
+ # you can some clean up code in this method
73
+ end
74
+
75
+ def test_valid_name_values_in_terms_of_presence
76
+ expected_values = ["presence"]
77
+ expected_values.each do |expected_value|
78
+ @sample.name = expected_value
79
+ assert @sample.valid?
80
+ end
81
+ end
82
+
83
+ def test_invalid_name_values_in_terms_of_presence
84
+ invalid_values = [nil]
85
+ invalid_values.each do |invalid_value|
86
+ @sample.name = invalid_value
87
+ assert_not @sample.valid?
88
+ end
89
+ end
90
+ end
91
+ =============================================
92
+ =============================================
93
+ class TestSample < MiniTest::Unit::TestCase
94
+ def setup
95
+ @sample = build(:sample)
96
+ end
97
+
98
+ def teardown
99
+ # you can some clean up code in this method
100
+ end
101
+
102
+ def test_valid_id_values_in_terms_of_numericality
103
+ expected_values = [2, 1]
104
+ expected_values.each do |expected_value|
105
+ @sample.id = expected_value
106
+ assert @sample.valid?
107
+ end
108
+ end
109
+
110
+ def test_invalid_id_values_in_terms_of_numericality
111
+ invalid_values = ["1.1", 2.0, 0]
112
+ invalid_values.each do |invalid_value|
113
+ @sample.id = invalid_value
114
+ assert_not @sample.valid?
115
+ end
116
+ end
117
+ end
118
+ =============================================
119
+ => #<File:../path/to/model/sample.rb (closed)>
120
+ ```
28
121
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
122
+ if you want to use template for RSpec:
30
123
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
124
+ ```rb
125
+ Tamebou::Writer.new("../path/to/model/sample.rb", Tamebou::Writer::DefaultTemplate::RSPEC).write
126
+ ```
32
127
 
33
- ## Contributing
128
+ if you want to use custom template:
34
129
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/Nozomi Yoshida/tamebou. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
130
+ ```rb
131
+ Tamebou::Writer.new("../path/to/model/sample.rb", "/path/to/your_template").write
132
+ ```
133
+
134
+ ## Contributing
36
135
 
136
+ 1. Create your feature branch (`git checkout -b my-new-feature`)
137
+ 2. Commit your changes (`git commit -am 'Add some feature'`)
138
+ 3. Push to the branch (`git push origin my-new-feature`)
139
+ 4. Create a new Pull Request
37
140
 
38
141
  ## License
39
142
 
@@ -1,3 +1,3 @@
1
1
  module Tamebou
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/tamebou.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["bibro.pcg@gmail.com"]
11
11
 
12
12
  spec.summary = %q{simple validation test generator for rails}
13
- spec.description = %q{tamebou generates a simple test for validation of rails. it read single-line validates methods and write test code regarding to format. the fomart is prepared for minitest and rspec.}
13
+ spec.description = %q{it read single-line `validates` methods and write test code according to templates. the default fomart is prepared for minitest and rspec.}
14
14
  spec.homepage = "https://github.com/woshidan/tamebou"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tamebou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - woshidan
@@ -52,9 +52,8 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
- description: tamebou generates a simple test for validation of rails. it read single-line
56
- validates methods and write test code regarding to format. the fomart is prepared
57
- for minitest and rspec.
55
+ description: it read single-line `validates` methods and write test code according
56
+ to templates. the default fomart is prepared for minitest and rspec.
58
57
  email:
59
58
  - bibro.pcg@gmail.com
60
59
  executables: []
@@ -82,7 +81,6 @@ files:
82
81
  - lib/tamebou/writer.rb
83
82
  - lib/templates/minitest.txt.erb
84
83
  - lib/templates/rspec.txt.erb
85
- - tamebou-0.0.1.gem
86
84
  - tamebou.gemspec
87
85
  homepage: https://github.com/woshidan/tamebou
88
86
  licenses:
data/tamebou-0.0.1.gem DELETED
Binary file