quick_shoulda 0.0.2 → 0.0.3
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.
- data/README.rdoc +59 -0
- data/lib/quick_shoulda/version.rb +1 -1
- data/quick_shoulda.gemspec +3 -2
- metadata +6 -4
- data/README.md +0 -29
data/README.rdoc
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
= QuickShoulda
|
2
|
+
|
3
|
+
A Rails generator which automatically generates Shoulda test cases ,
|
4
|
+
|
5
|
+
Just by specifying path to your model file , a bunch of Shoulda test cases will be generated for you in the correspondent spec file
|
6
|
+
|
7
|
+
== Examples :
|
8
|
+
|
9
|
+
app/models/user.rb
|
10
|
+
|
11
|
+
class User < ActiveRecord::Base
|
12
|
+
validates :username , :presence => true
|
13
|
+
validates :email, :format => EmailRegex, :uniqueness => true
|
14
|
+
|
15
|
+
has_many :posts
|
16
|
+
has_many :comments, :through => :posts
|
17
|
+
end
|
18
|
+
|
19
|
+
Rails generate quick_shoulda:generate app/models/user.rb
|
20
|
+
|
21
|
+
This will add these bellow contents to spec/models/user_spec.rb with ( QuickShoulda will automatically create this file if not yet created )
|
22
|
+
|
23
|
+
describe 'User' do
|
24
|
+
describe '#Validations' do
|
25
|
+
it { should validate_presence_of(:username) }
|
26
|
+
it { should validate_uniqueness_of(:email) }
|
27
|
+
it { should allow_value('us@gmail.com').for(:email) }
|
28
|
+
it { should allow_value('us.vn@gmail.com').for(:email) }
|
29
|
+
it { should allow_value('us_vn@gmail.com').for(:email) }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#Associations' do
|
33
|
+
it { should have_many(:posts) }
|
34
|
+
it { should have_many(:comments).through(:posts) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
== Installation
|
39
|
+
gem install 'quick_shoulda'
|
40
|
+
|
41
|
+
or add to Gemfile:
|
42
|
+
group :development do
|
43
|
+
gem 'quick_shoulda'
|
44
|
+
end
|
45
|
+
|
46
|
+
== Usage
|
47
|
+
Rails generate quick_shoulda:generate app/models/user.rb
|
48
|
+
|
49
|
+
== Contributing
|
50
|
+
|
51
|
+
1. Fork it
|
52
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
53
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
54
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
55
|
+
5. Create new Pull Request
|
56
|
+
|
57
|
+
== Copyright
|
58
|
+
|
59
|
+
Copyright (c) 2013 nqtien310@gmail.com.
|
data/quick_shoulda.gemspec
CHANGED
@@ -8,8 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = QuickShoulda::VERSION
|
9
9
|
spec.authors = ["Tien Nguyen"]
|
10
10
|
spec.email = ["nqtien310@gmail.com"]
|
11
|
-
spec.description = %q{
|
12
|
-
|
11
|
+
spec.description = %q{Read model file to extract the validations/associations
|
12
|
+
and then utilize Rails generator to write correspondent shoulda test cases to your correspondent spec file }
|
13
|
+
spec.summary = %q{read through your model file and generate Shoulda test cases }
|
13
14
|
spec.homepage = ""
|
14
15
|
spec.license = "MIT"
|
15
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quick_shoulda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -43,7 +43,9 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
-
description:
|
46
|
+
description: ! "Read model file to extract the validations/associations\n and
|
47
|
+
then utilize Rails generator to write correspondent shoulda test cases to your correspondent
|
48
|
+
spec file "
|
47
49
|
email:
|
48
50
|
- nqtien310@gmail.com
|
49
51
|
executables: []
|
@@ -56,7 +58,7 @@ files:
|
|
56
58
|
- .rvmrc
|
57
59
|
- Gemfile
|
58
60
|
- LICENSE.txt
|
59
|
-
- README.
|
61
|
+
- README.rdoc
|
60
62
|
- Rakefile
|
61
63
|
- data/stored_strings.yml
|
62
64
|
- lib/generators/quick_shoulda/generate/generate_generator.rb
|
@@ -110,7 +112,7 @@ rubyforge_project:
|
|
110
112
|
rubygems_version: 1.8.25
|
111
113
|
signing_key:
|
112
114
|
specification_version: 3
|
113
|
-
summary:
|
115
|
+
summary: read through your model file and generate Shoulda test cases
|
114
116
|
test_files:
|
115
117
|
- spec/file_writer_spec.rb
|
116
118
|
- spec/fixtures/user_spec.rb
|
data/README.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# QuickShoulda
|
2
|
-
|
3
|
-
TODO: Write a gem description
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'quick_shoulda'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
|
-
$ gem install quick_shoulda
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
TODO: Write usage instructions here
|
22
|
-
|
23
|
-
## Contributing
|
24
|
-
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|