jeweler 1.8.2 → 2.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.semver +5 -0
- data/.travis.yml +5 -3
- data/ChangeLog.markdown +30 -0
- data/Gemfile +32 -25
- data/Gemfile.lock +117 -46
- data/README.markdown +36 -10
- data/README.org +374 -0
- data/Rakefile +23 -28
- data/bin/jeweler +1 -0
- data/features/generator/gemfile.feature +1 -0
- data/features/generator/test.feature +2 -2
- data/features/step_definitions/debug_steps.rb +0 -1
- data/features/step_definitions/filesystem_steps.rb +2 -3
- data/features/step_definitions/generator_steps.rb +44 -66
- data/features/step_definitions/task_steps.rb +1 -2
- data/features/support/env.rb +22 -9
- data/jeweler.gemspec +64 -45
- data/lib/jeweler/commands/build_gem.rb +6 -2
- data/lib/jeweler/commands/check_dependencies.rb +3 -3
- data/lib/jeweler/commands/install_gem.rb +1 -1
- data/lib/jeweler/commands/release_gemspec.rb +17 -14
- data/lib/jeweler/commands/release_to_git.rb +20 -11
- data/lib/jeweler/commands/validate_gemspec.rb +5 -7
- data/lib/jeweler/commands/version/base.rb +8 -13
- data/lib/jeweler/commands/version/bump_major.rb +1 -3
- data/lib/jeweler/commands/version/bump_minor.rb +1 -2
- data/lib/jeweler/commands/version/bump_patch.rb +1 -4
- data/lib/jeweler/commands/write_gemspec.rb +4 -3
- data/lib/jeweler/commands.rb +6 -6
- data/lib/jeweler/gemspec_helper.rb +15 -15
- data/lib/jeweler/generator/application.rb +5 -10
- data/lib/jeweler/generator/bacon_mixin.rb +2 -4
- data/lib/jeweler/generator/github_mixin.rb +1 -10
- data/lib/jeweler/generator/micronaut_mixin.rb +3 -3
- data/lib/jeweler/generator/minitest_mixin.rb +2 -3
- data/lib/jeweler/generator/options.rb +16 -25
- data/lib/jeweler/generator/rdoc_mixin.rb +1 -1
- data/lib/jeweler/generator/riot_mixin.rb +2 -3
- data/lib/jeweler/generator/rspec_mixin.rb +2 -3
- data/lib/jeweler/generator/shindo_mixin.rb +2 -3
- data/lib/jeweler/generator/shoulda_mixin.rb +2 -3
- data/lib/jeweler/generator/testspec_mixin.rb +2 -3
- data/lib/jeweler/generator/testunit_mixin.rb +1 -3
- data/lib/jeweler/generator/yard_mixin.rb +3 -4
- data/lib/jeweler/generator.rb +52 -45
- data/lib/jeweler/rubyforge_tasks.rb +13 -13
- data/lib/jeweler/rubygems_dot_org_tasks.rb +3 -3
- data/lib/jeweler/rubygems_tasks.rb +3 -3
- data/lib/jeweler/specification.rb +22 -11
- data/lib/jeweler/tasks.rb +68 -59
- data/lib/jeweler/templates/Gemfile +1 -1
- data/lib/jeweler/templates/bacon/flunking.rb +3 -3
- data/lib/jeweler/templates/bacon/helper.rb +1 -0
- data/lib/jeweler/templates/features/support/env.rb +1 -0
- data/lib/jeweler/templates/jeweler_tasks.erb +1 -1
- data/lib/jeweler/templates/micronaut/flunking.rb +3 -3
- data/lib/jeweler/templates/micronaut/helper.rb +1 -0
- data/lib/jeweler/templates/minitest/flunking.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +4 -3
- data/lib/jeweler/templates/other_tasks.erb +4 -20
- data/lib/jeweler/templates/riot/flunking.rb +1 -1
- data/lib/jeweler/templates/riot/helper.rb +1 -0
- data/lib/jeweler/templates/rspec/flunking.rb +3 -3
- data/lib/jeweler/templates/rspec/helper.rb +3 -1
- data/lib/jeweler/templates/shindo/flunking.rb +3 -3
- data/lib/jeweler/templates/shindo/helper.rb +1 -0
- data/lib/jeweler/templates/shoulda/helper.rb +1 -0
- data/lib/jeweler/templates/simplecov.erb +16 -0
- data/lib/jeweler/templates/testspec/flunking.rb +3 -3
- data/lib/jeweler/templates/testspec/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -0
- data/lib/jeweler/version.rb +3 -3
- data/lib/jeweler/version_helper.rb +18 -15
- data/lib/jeweler.rb +23 -23
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -1
- data/test/fixtures/existing-project-with-version-constant/Rakefile +18 -20
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +2 -2
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +17 -19
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +15 -17
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +2 -2
- data/test/jeweler/commands/test_build_gem.rb +33 -27
- data/test/jeweler/commands/test_install_gem.rb +7 -7
- data/test/jeweler/commands/test_release_to_gemcutter.rb +6 -7
- data/test/jeweler/commands/test_release_to_git.rb +95 -37
- data/test/jeweler/commands/test_release_to_github.rb +161 -97
- data/test/jeweler/commands/test_validate_gemspec.rb +4 -6
- data/test/jeweler/commands/test_write_gemspec.rb +21 -24
- data/test/jeweler/commands/version/test_base.rb +26 -6
- data/test/jeweler/commands/version/test_bump_major.rb +1 -5
- data/test/jeweler/commands/version/test_bump_minor.rb +1 -2
- data/test/jeweler/commands/version/test_bump_patch.rb +1 -3
- data/test/jeweler/commands/version/test_write.rb +1 -3
- data/test/jeweler/generator/test_application.rb +22 -26
- data/test/jeweler/generator/test_options.rb +26 -38
- data/test/jeweler/test_gemspec_helper.rb +7 -7
- data/test/jeweler/test_generator.rb +31 -33
- data/test/jeweler/test_generator_initialization.rb +40 -57
- data/test/jeweler/test_generator_mixins.rb +6 -7
- data/test/jeweler/test_specification.rb +44 -43
- data/test/jeweler/test_tasks.rb +2 -3
- data/test/jeweler/test_version_helper.rb +33 -35
- data/test/shoulda_macros/jeweler_macros.rb +5 -5
- data/test/test_helper.rb +25 -31
- data/test/test_jeweler.rb +28 -29
- metadata +206 -165
@@ -4,8 +4,7 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
module Version
|
6
6
|
class TestBumpMajor < Test::Unit::TestCase
|
7
|
-
|
8
|
-
should "call bump_major on version_helper in update_version" do
|
7
|
+
should 'call bump_major on version_helper in update_version' do
|
9
8
|
mock(version_helper = Object.new).bump_major
|
10
9
|
|
11
10
|
command = Jeweler::Commands::Version::BumpMajor.new
|
@@ -14,9 +13,6 @@ class Jeweler
|
|
14
13
|
command.update_version
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
18
16
|
end
|
19
17
|
end
|
20
18
|
end
|
21
|
-
|
22
|
-
|
@@ -4,8 +4,7 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
module Version
|
6
6
|
class TestBumpMinor < Test::Unit::TestCase
|
7
|
-
|
8
|
-
should "call bump_minor on version_helper in update_version" do
|
7
|
+
should 'call bump_minor on version_helper in update_version' do
|
9
8
|
mock(version_helper = Object.new).bump_minor
|
10
9
|
|
11
10
|
command = Jeweler::Commands::Version::BumpMinor.new
|
@@ -4,8 +4,7 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
module Version
|
6
6
|
class TestBumpPatch < Test::Unit::TestCase
|
7
|
-
|
8
|
-
should "call bump_patch on version_helper in update_version" do
|
7
|
+
should 'call bump_patch on version_helper in update_version' do
|
9
8
|
mock(version_helper = Object.new).bump_patch
|
10
9
|
|
11
10
|
command = Jeweler::Commands::Version::BumpPatch.new
|
@@ -17,4 +16,3 @@ class Jeweler
|
|
17
16
|
end
|
18
17
|
end
|
19
18
|
end
|
20
|
-
|
@@ -4,8 +4,7 @@ class Jeweler
|
|
4
4
|
module Commands
|
5
5
|
module Version
|
6
6
|
class TestWrite < Test::Unit::TestCase
|
7
|
-
|
8
|
-
should "call write_version on version_helper in update_version" do
|
7
|
+
should 'call write_version on version_helper in update_version' do
|
9
8
|
mock(version_helper = Object.new).update_to 1, 2, 3, nil
|
10
9
|
|
11
10
|
command = Jeweler::Commands::Version::Write.new
|
@@ -19,4 +18,3 @@ class Jeweler
|
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
22
|
-
|
@@ -37,38 +37,36 @@ class TestApplication < Test::Unit::TestCase
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
context "when options indicate version" do
|
40
|
+
context 'when options indicate version' do
|
42
41
|
setup do
|
43
42
|
stub(Jeweler::Generator::Application).build_opts do
|
44
|
-
stub_options(:
|
43
|
+
stub_options(show_version: true)
|
45
44
|
end
|
46
45
|
|
47
|
-
stub(Jeweler::Generator).new { raise "Shouldn't have made this far"}
|
46
|
+
stub(Jeweler::Generator).new { raise "Shouldn't have made this far" }
|
48
47
|
|
49
48
|
assert_nothing_raised do
|
50
|
-
@result = run_application(
|
49
|
+
@result = run_application('-v')
|
51
50
|
end
|
52
51
|
end
|
53
|
-
|
52
|
+
|
54
53
|
should_exit_with_code 1
|
55
|
-
|
54
|
+
|
56
55
|
should 'should puts option version' do
|
57
56
|
assert_match 'Version:', @stderr
|
58
57
|
end
|
59
58
|
end
|
60
|
-
|
61
59
|
|
62
|
-
context
|
60
|
+
context 'when options indicate help usage' do
|
63
61
|
setup do
|
64
62
|
stub(Jeweler::Generator::Application).build_opts do
|
65
|
-
stub_options(:
|
63
|
+
stub_options(show_help: true)
|
66
64
|
end
|
67
65
|
|
68
|
-
stub(Jeweler::Generator).new { raise "Shouldn't have made this far"}
|
66
|
+
stub(Jeweler::Generator).new { raise "Shouldn't have made this far" }
|
69
67
|
|
70
68
|
assert_nothing_raised do
|
71
|
-
@result = run_application(
|
69
|
+
@result = run_application('-h')
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|
@@ -83,16 +81,16 @@ class TestApplication < Test::Unit::TestCase
|
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
|
-
context
|
84
|
+
context 'when options indicate an invalid argument' do
|
87
85
|
setup do
|
88
86
|
stub(Jeweler::Generator::Application).build_opts do
|
89
|
-
stub_options(:
|
87
|
+
stub_options(invalid_argument: '--invalid-argument')
|
90
88
|
end
|
91
89
|
|
92
|
-
stub(Jeweler::Generator).new { raise "Shouldn't have made this far"}
|
90
|
+
stub(Jeweler::Generator).new { raise "Shouldn't have made this far" }
|
93
91
|
|
94
92
|
assert_nothing_raised do
|
95
|
-
@result = run_application(
|
93
|
+
@result = run_application('--invalid-argument')
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
@@ -109,34 +107,32 @@ class TestApplication < Test::Unit::TestCase
|
|
109
107
|
should 'not display anything on stdout' do
|
110
108
|
assert_equal '', @stdout.squeeze.strip
|
111
109
|
end
|
112
|
-
|
113
110
|
end
|
114
111
|
|
115
|
-
context
|
112
|
+
context 'when options are good' do
|
116
113
|
setup do
|
117
|
-
@generator =
|
114
|
+
@generator = 'generator'
|
118
115
|
stub(@generator).run
|
119
116
|
stub(Jeweler::Generator).new { @generator }
|
120
117
|
|
121
|
-
@jeweler_options = stub_options :
|
118
|
+
@jeweler_options = stub_options project_name: 'zomg'
|
122
119
|
stub(Jeweler::Generator::Application).build_options do
|
123
120
|
@jeweler_options
|
124
121
|
end
|
125
122
|
|
126
123
|
assert_nothing_raised do
|
127
|
-
@result = run_application(
|
124
|
+
@result = run_application('zomg')
|
128
125
|
end
|
129
126
|
end
|
130
127
|
|
131
128
|
should_exit_with_code 0
|
132
129
|
|
133
|
-
should
|
134
|
-
assert_received(Jeweler::Generator) {|subject| subject.new(@jeweler_options) }
|
130
|
+
should 'create generator with options' do
|
131
|
+
assert_received(Jeweler::Generator) { |subject| subject.new(@jeweler_options) }
|
135
132
|
end
|
136
133
|
|
137
|
-
should
|
138
|
-
assert_received(@generator
|
134
|
+
should 'run generator' do
|
135
|
+
assert_received(@generator, &:run)
|
139
136
|
end
|
140
137
|
end
|
141
|
-
|
142
138
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class TestOptions < Test::Unit::TestCase
|
4
|
-
|
5
4
|
def setup
|
6
5
|
set_default_git_config
|
7
6
|
stub_git_config valid_git_config
|
@@ -21,17 +20,17 @@ class TestOptions < Test::Unit::TestCase
|
|
21
20
|
|
22
21
|
def setup_options(*arguments)
|
23
22
|
stub(Jeweler::Generator::Options).git_config { valid_git_config }
|
24
|
-
@options = Jeweler::Generator::Options.new([
|
23
|
+
@options = Jeweler::Generator::Options.new(['project_name'] + arguments)
|
25
24
|
end
|
26
25
|
|
27
26
|
def self.for_options(*options)
|
28
27
|
context options.join(' ') do
|
29
|
-
setup { setup_options
|
28
|
+
setup { setup_options(*options) }
|
30
29
|
yield
|
31
30
|
end
|
32
31
|
end
|
33
32
|
|
34
|
-
context
|
33
|
+
context 'default options' do
|
35
34
|
setup { setup_options }
|
36
35
|
should_have_testing_framework :shoulda
|
37
36
|
should_have_docmentation_framework :rdoc
|
@@ -40,32 +39,27 @@ class TestOptions < Test::Unit::TestCase
|
|
40
39
|
assert ! @options[:create_repo]
|
41
40
|
end
|
42
41
|
|
43
|
-
should
|
44
|
-
assert_equal
|
42
|
+
should 'have project name' do
|
43
|
+
assert_equal 'project_name', @options[:project_name]
|
45
44
|
end
|
46
45
|
|
47
|
-
should
|
46
|
+
should 'use github username from git config' do
|
48
47
|
assert_equal @github_user, @options[:github_username]
|
49
48
|
end
|
50
|
-
|
51
|
-
should "use github token from git config" do
|
52
|
-
assert_equal @github_token, @options[:github_token]
|
53
|
-
end
|
54
|
-
|
55
|
-
should "use user name from git config" do
|
49
|
+
should 'use user name from git config' do
|
56
50
|
assert_equal @git_name, @options[:user_name]
|
57
51
|
end
|
58
52
|
|
59
|
-
should
|
53
|
+
should 'use user email from git config' do
|
60
54
|
assert_equal @git_email, @options[:user_email]
|
61
55
|
end
|
62
56
|
|
63
|
-
should
|
57
|
+
should 'use bundler' do
|
64
58
|
assert @options[:use_bundler]
|
65
59
|
end
|
66
60
|
end
|
67
61
|
|
68
|
-
for_options
|
62
|
+
for_options '--bacon' do
|
69
63
|
should_have_testing_framework :bacon
|
70
64
|
end
|
71
65
|
|
@@ -85,11 +79,11 @@ class TestOptions < Test::Unit::TestCase
|
|
85
79
|
should_have_testing_framework :shoulda
|
86
80
|
end
|
87
81
|
|
88
|
-
for_options
|
82
|
+
for_options '--testunit' do
|
89
83
|
should_have_testing_framework :testunit
|
90
84
|
end
|
91
85
|
|
92
|
-
for_options
|
86
|
+
for_options '--testspec' do
|
93
87
|
should_have_testing_framework :testspec
|
94
88
|
end
|
95
89
|
|
@@ -142,13 +136,13 @@ class TestOptions < Test::Unit::TestCase
|
|
142
136
|
assert_equal 'foo', @options[:directory]
|
143
137
|
end
|
144
138
|
end
|
145
|
-
|
139
|
+
|
146
140
|
for_options '--version' do
|
147
141
|
should 'show version' do
|
148
142
|
assert @options[:show_version]
|
149
143
|
end
|
150
144
|
end
|
151
|
-
|
145
|
+
|
152
146
|
for_options '-v' do
|
153
147
|
should 'show version' do
|
154
148
|
assert @options[:show_version]
|
@@ -174,13 +168,13 @@ class TestOptions < Test::Unit::TestCase
|
|
174
168
|
end
|
175
169
|
|
176
170
|
for_options '--user-name', 'myname' do
|
177
|
-
should
|
171
|
+
should 'set user name' do
|
178
172
|
assert_equal 'myname', @options[:user_name]
|
179
173
|
end
|
180
174
|
end
|
181
175
|
|
182
176
|
for_options '--user-email', 'myname@mydomain.com' do
|
183
|
-
should
|
177
|
+
should 'set user email' do
|
184
178
|
assert_equal 'myname@mydomain.com', @options[:user_email]
|
185
179
|
end
|
186
180
|
end
|
@@ -198,40 +192,34 @@ class TestOptions < Test::Unit::TestCase
|
|
198
192
|
end
|
199
193
|
|
200
194
|
for_options '--github-username', 'mygithub' do
|
201
|
-
should
|
195
|
+
should 'set github username' do
|
202
196
|
assert_equal 'mygithub', @options[:github_username]
|
203
197
|
end
|
204
198
|
end
|
205
199
|
|
206
|
-
for_options '--github-token', 'mygithubtoken' do
|
207
|
-
should "set github token" do
|
208
|
-
assert_equal 'mygithubtoken', @options[:github_token]
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
200
|
for_options '--bundler' do
|
213
|
-
should
|
201
|
+
should 'use bundler' do
|
214
202
|
assert @options[:use_bundler]
|
215
203
|
end
|
216
204
|
end
|
217
205
|
|
218
206
|
for_options '--no-bundler' do
|
219
|
-
should
|
207
|
+
should 'not use bundler' do
|
220
208
|
assert !@options[:use_bundler]
|
221
209
|
end
|
222
210
|
end
|
223
211
|
|
224
|
-
context
|
225
|
-
should
|
226
|
-
options = Jeweler::Generator::Options.new([
|
227
|
-
|
212
|
+
context 'merging options' do
|
213
|
+
should 'take options from each' do
|
214
|
+
options = Jeweler::Generator::Options.new(['--rspec'])
|
215
|
+
.merge Jeweler::Generator::Options.new(['--create-repo'])
|
228
216
|
assert_equal :rspec, options[:testing_framework]
|
229
217
|
assert options[:create_repo]
|
230
218
|
end
|
231
219
|
|
232
|
-
should
|
233
|
-
options = Jeweler::Generator::Options.new([
|
234
|
-
|
220
|
+
should 'shadow options' do
|
221
|
+
options = Jeweler::Generator::Options.new(['--bacon'])
|
222
|
+
.merge Jeweler::Generator::Options.new(['--rspec'])
|
235
223
|
assert_equal :rspec, options[:testing_framework]
|
236
224
|
end
|
237
225
|
end
|
@@ -2,10 +2,10 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TestGemspecHelper < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
Rake.application.instance_variable_set(:@rakefile,
|
5
|
+
Rake.application.instance_variable_set(:@rakefile, 'Rakefile')
|
6
6
|
end
|
7
7
|
|
8
|
-
context
|
8
|
+
context 'given a gemspec' do
|
9
9
|
setup do
|
10
10
|
@spec = build_spec
|
11
11
|
@helper = Jeweler::GemSpecHelper.new(@spec, File.dirname(__FILE__))
|
@@ -16,7 +16,7 @@ class TestGemspecHelper < Test::Unit::TestCase
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
context
|
19
|
+
context '#write' do
|
20
20
|
setup do
|
21
21
|
@spec = build_spec
|
22
22
|
@helper = Jeweler::GemSpecHelper.new(@spec, File.dirname(__FILE__))
|
@@ -29,15 +29,15 @@ class TestGemspecHelper < Test::Unit::TestCase
|
|
29
29
|
FileUtils.rm_f(@helper.path)
|
30
30
|
end
|
31
31
|
|
32
|
-
should
|
33
|
-
assert File.
|
32
|
+
should 'create gemspec file' do
|
33
|
+
assert File.exist?(@helper.path)
|
34
34
|
end
|
35
35
|
|
36
|
-
should
|
36
|
+
should 'make valid spec' do
|
37
37
|
assert @helper.valid?
|
38
38
|
end
|
39
39
|
|
40
|
-
should
|
40
|
+
should 'parse' do
|
41
41
|
@helper.parse
|
42
42
|
end
|
43
43
|
end
|
@@ -3,49 +3,48 @@ require 'test_helper'
|
|
3
3
|
class TestGenerator < Test::Unit::TestCase
|
4
4
|
def build_generator(testing_framework = :shoulda, options = {})
|
5
5
|
options = {
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:documentation_framework => :rdoc
|
6
|
+
project_name: 'the-perfect-gem',
|
7
|
+
user_name: 'John Doe',
|
8
|
+
user_email: 'john@example.com',
|
9
|
+
github_username: 'johndoe',
|
10
|
+
documentation_framework: :rdoc
|
12
11
|
}.merge(options)
|
13
12
|
|
14
13
|
options[:testing_framework] = testing_framework
|
15
14
|
Jeweler::Generator.new(options)
|
16
15
|
end
|
17
16
|
|
18
|
-
should
|
19
|
-
assert_equal
|
17
|
+
should 'have the correct constant name' do
|
18
|
+
assert_equal 'ThePerfectGem', build_generator.constant_name
|
20
19
|
end
|
21
20
|
|
22
|
-
should
|
23
|
-
assert_equal
|
21
|
+
should 'have the correct file name prefix' do
|
22
|
+
assert_equal 'the_perfect_gem', build_generator.file_name_prefix
|
24
23
|
end
|
25
24
|
|
26
|
-
should
|
27
|
-
assert_equal
|
25
|
+
should 'have the correct require name' do
|
26
|
+
assert_equal 'the-perfect-gem', build_generator.require_name
|
28
27
|
end
|
29
28
|
|
30
|
-
should
|
31
|
-
assert_equal
|
29
|
+
should 'have the correct lib file name' do
|
30
|
+
assert_equal 'the-perfect-gem.rb', build_generator.lib_filename
|
32
31
|
end
|
33
|
-
|
34
|
-
should
|
35
|
-
assert_equal 'user@host:/path/to/repo', build_generator(:shoulda,
|
36
|
-
assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote
|
32
|
+
|
33
|
+
should 'have the correct git-remote' do
|
34
|
+
assert_equal 'user@host:/path/to/repo', build_generator(:shoulda, git_remote: 'user@host:/path/to/repo').git_remote
|
35
|
+
assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote
|
37
36
|
end
|
38
37
|
|
39
|
-
should
|
40
|
-
assert_equal
|
38
|
+
should 'extract project name from absolut path' do
|
39
|
+
assert_equal 'my-project', build_generator(:shoulda, project_name: '/tmp/my-project').project_name
|
41
40
|
end
|
42
41
|
|
43
|
-
should
|
44
|
-
assert_equal
|
42
|
+
should 'extract project name from relative path' do
|
43
|
+
assert_equal 'my-project', build_generator(:shoulda, project_name: '../my-project').project_name
|
45
44
|
end
|
46
45
|
|
47
|
-
should
|
48
|
-
assert_equal
|
46
|
+
should 'extract project name from direct path' do
|
47
|
+
assert_equal 'my-project', build_generator(:shoulda, project_name: 'my-project').project_name
|
49
48
|
end
|
50
49
|
|
51
50
|
def self.should_have_generator_attribute(attribute, value)
|
@@ -54,7 +53,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
context
|
56
|
+
context 'shoulda' do
|
58
57
|
setup { @framework = :shoulda }
|
59
58
|
should_have_generator_attribute :test_task, 'test'
|
60
59
|
should_have_generator_attribute :test_dir, 'test'
|
@@ -66,7 +65,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
66
65
|
should_have_generator_attribute :test_helper_filename, 'helper.rb'
|
67
66
|
end
|
68
67
|
|
69
|
-
context
|
68
|
+
context 'testunit' do
|
70
69
|
setup { @framework = :testunit }
|
71
70
|
should_have_generator_attribute :test_task, 'test'
|
72
71
|
should_have_generator_attribute :test_dir, 'test'
|
@@ -78,7 +77,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
78
77
|
should_have_generator_attribute :test_helper_filename, 'helper.rb'
|
79
78
|
end
|
80
79
|
|
81
|
-
context
|
80
|
+
context 'minitest' do
|
82
81
|
setup { @framework = :minitest }
|
83
82
|
should_have_generator_attribute :test_task, 'test'
|
84
83
|
should_have_generator_attribute :test_dir, 'test'
|
@@ -90,7 +89,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
90
89
|
should_have_generator_attribute :test_helper_filename, 'helper.rb'
|
91
90
|
end
|
92
91
|
|
93
|
-
context
|
92
|
+
context 'bacon' do
|
94
93
|
setup { @framework = :bacon }
|
95
94
|
should_have_generator_attribute :test_task, 'spec'
|
96
95
|
should_have_generator_attribute :test_dir, 'spec'
|
@@ -102,7 +101,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
102
101
|
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
103
102
|
end
|
104
103
|
|
105
|
-
context
|
104
|
+
context 'rspec' do
|
106
105
|
setup { @framework = :rspec }
|
107
106
|
should_have_generator_attribute :test_task, 'spec'
|
108
107
|
should_have_generator_attribute :test_dir, 'spec'
|
@@ -114,7 +113,7 @@ class TestGenerator < Test::Unit::TestCase
|
|
114
113
|
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
115
114
|
end
|
116
115
|
|
117
|
-
context
|
116
|
+
context 'micronaut' do
|
118
117
|
setup { @framework = :micronaut }
|
119
118
|
should_have_generator_attribute :test_task, 'examples'
|
120
119
|
should_have_generator_attribute :test_dir, 'examples'
|
@@ -125,8 +124,8 @@ class TestGenerator < Test::Unit::TestCase
|
|
125
124
|
should_have_generator_attribute :test_filename, 'the-perfect-gem_example.rb'
|
126
125
|
should_have_generator_attribute :test_helper_filename, 'example_helper.rb'
|
127
126
|
end
|
128
|
-
|
129
|
-
context
|
127
|
+
|
128
|
+
context 'testspec' do
|
130
129
|
setup { @framework = :testspec }
|
131
130
|
should_have_generator_attribute :test_task, 'test'
|
132
131
|
should_have_generator_attribute :test_dir, 'test'
|
@@ -137,5 +136,4 @@ class TestGenerator < Test::Unit::TestCase
|
|
137
136
|
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
138
137
|
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
139
138
|
end
|
140
|
-
|
141
139
|
end
|