dima-jeweler 0.9.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/ChangeLog.markdown +54 -1
- data/README.markdown +89 -20
- data/ROADMAP +12 -0
- data/Rakefile +52 -12
- data/VERSION.yml +3 -3
- data/features/generator/cucumber.feature +83 -0
- data/features/generator/directory_layout.feature +76 -0
- data/features/generator/dotdocument.feature +14 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/git.feature +94 -0
- data/features/generator/license.feature +11 -0
- data/features/generator/rakefile.feature +151 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +41 -0
- data/features/generator/test_helper.feature +49 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +68 -0
- data/features/step_definitions/generator_steps.rb +284 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +29 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +24 -0
- data/features/tasks/version_bumping.feature +33 -0
- data/jeweler.gemspec +225 -0
- data/lib/jeweler.rb +39 -52
- data/lib/jeweler/commands.rb +2 -0
- data/lib/jeweler/commands/build_gem.rb +9 -0
- data/lib/jeweler/commands/check_dependencies.rb +52 -0
- data/lib/jeweler/commands/install_gem.rb +23 -2
- data/lib/jeweler/commands/release.rb +52 -12
- data/lib/jeweler/commands/release_to_rubyforge.rb +32 -9
- data/lib/jeweler/commands/setup_rubyforge.rb +57 -0
- data/lib/jeweler/commands/validate_gemspec.rb +9 -0
- data/lib/jeweler/commands/version/base.rb +13 -2
- data/lib/jeweler/commands/write_gemspec.rb +13 -0
- data/lib/jeweler/errors.rb +13 -1
- data/lib/jeweler/gemspec_helper.rb +31 -3
- data/lib/jeweler/generator.rb +80 -120
- data/lib/jeweler/generator/application.rb +12 -3
- data/lib/jeweler/generator/bacon_mixin.rb +43 -0
- data/lib/jeweler/generator/micronaut_mixin.rb +41 -0
- data/lib/jeweler/generator/minitest_mixin.rb +42 -0
- data/lib/jeweler/generator/options.rb +37 -3
- data/lib/jeweler/generator/rdoc_mixin.rb +9 -0
- data/lib/jeweler/generator/rspec_mixin.rb +42 -0
- data/lib/jeweler/generator/shoulda_mixin.rb +42 -0
- data/lib/jeweler/generator/testunit_mixin.rb +39 -0
- data/lib/jeweler/generator/yard_mixin.rb +14 -0
- data/lib/jeweler/rubyforge_tasks.rb +98 -0
- data/lib/jeweler/specification.rb +66 -0
- data/lib/jeweler/tasks.rb +72 -39
- data/lib/jeweler/templates/.document +5 -0
- data/lib/jeweler/templates/README.rdoc +12 -1
- data/lib/jeweler/templates/Rakefile +83 -49
- data/lib/jeweler/templates/bacon/helper.rb +1 -1
- data/lib/jeweler/templates/features/support/env.rb +4 -7
- data/lib/jeweler/templates/micronaut/helper.rb +1 -1
- data/lib/jeweler/templates/minitest/helper.rb +1 -1
- data/lib/jeweler/templates/rspec/flunking.rb +1 -1
- data/lib/jeweler/templates/rspec/helper.rb +4 -3
- data/lib/jeweler/templates/shoulda/helper.rb +1 -1
- data/lib/jeweler/templates/testunit/helper.rb +1 -1
- data/lib/jeweler/version_helper.rb +78 -33
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +82 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/jeweler/commands/test_build_gem.rb +20 -1
- data/test/jeweler/commands/test_install_gem.rb +74 -0
- data/test/jeweler/commands/test_release.rb +289 -77
- data/test/jeweler/commands/test_release_to_rubyforge.rb +66 -50
- data/test/jeweler/commands/test_setup_rubyforge.rb +182 -0
- data/test/jeweler/commands/test_validate_gemspec.rb +27 -0
- data/test/jeweler/commands/test_write_gemspec.rb +34 -0
- data/test/jeweler/commands/version/test_base.rb +32 -0
- data/test/jeweler/commands/version/test_bump_major.rb +1 -0
- data/test/test_application.rb +31 -1
- data/test/test_gemspec_helper.rb +4 -0
- data/test/test_generator.rb +101 -114
- data/test/test_generator_initialization.rb +156 -0
- data/test/test_generator_mixins.rb +18 -0
- data/test/test_helper.rb +104 -16
- data/test/test_jeweler.rb +134 -96
- data/test/test_options.rb +59 -0
- data/test/test_specification.rb +61 -0
- data/test/test_tasks.rb +13 -18
- data/test/test_version_helper.rb +47 -9
- metadata +174 -43
- data/TODO +0 -11
- data/test/generators/initialization_test.rb +0 -146
data/test/test_application.rb
CHANGED
@@ -48,6 +48,10 @@ class TestApplication < Test::Unit::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def build_generator(name = 'zomg', options = {:testing_framework => :shoulda})
|
51
|
+
stub(Git).global_config() do
|
52
|
+
{'user.name' => 'John Doe', 'user.email' => 'john@example.com', 'github.user' => 'johndoe', 'github.token' => 'yyz'}
|
53
|
+
end
|
54
|
+
|
51
55
|
Jeweler::Generator.new(name, options)
|
52
56
|
end
|
53
57
|
|
@@ -73,9 +77,35 @@ class TestApplication < Test::Unit::TestCase
|
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
80
|
+
context "called with --invalid-argument" do
|
81
|
+
setup do
|
82
|
+
@generator = build_generator
|
83
|
+
stub(@generator).run
|
84
|
+
stub(Jeweler::Generator).new { raise "Shouldn't have made this far"}
|
85
|
+
|
86
|
+
assert_nothing_raised do
|
87
|
+
@result = run_application("--invalid-argument")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
should_exit_with_code 1
|
92
|
+
|
93
|
+
should 'display invalid argument' do
|
94
|
+
assert_match '--invalid-argument', @stderr
|
95
|
+
end
|
96
|
+
|
97
|
+
should 'display usage on stderr' do
|
98
|
+
assert_match 'Usage:', @stderr
|
99
|
+
end
|
100
|
+
|
101
|
+
should 'not display anything on stdout' do
|
102
|
+
assert_equal '', @stdout.squeeze.strip
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
76
106
|
context "when called with repo name" do
|
77
107
|
setup do
|
78
|
-
@options = {:testing_framework => :shoulda}
|
108
|
+
@options = {:testing_framework => :shoulda, :documentation_framework => :rdoc}
|
79
109
|
@generator = build_generator('zomg', @options)
|
80
110
|
|
81
111
|
stub(@generator).run
|
data/test/test_gemspec_helper.rb
CHANGED
data/test/test_generator.rb
CHANGED
@@ -2,6 +2,10 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class TestGenerator < Test::Unit::TestCase
|
4
4
|
def build_generator(testing_framework = nil, options = {})
|
5
|
+
stub(Git).global_config() do
|
6
|
+
{'user.name' => 'John Doe', 'user.email' => 'john@example.com', 'github.user' => 'johndoe', 'github.token' => 'yyz'}
|
7
|
+
end
|
8
|
+
|
5
9
|
options[:testing_framework] = testing_framework
|
6
10
|
Jeweler::Generator.new('the-perfect-gem', options)
|
7
11
|
end
|
@@ -27,8 +31,12 @@ class TestGenerator < Test::Unit::TestCase
|
|
27
31
|
assert_equal 'the-perfect-gem', build_generator.target_dir
|
28
32
|
end
|
29
33
|
|
30
|
-
should "have
|
31
|
-
assert_equal "TODO", build_generator.summary
|
34
|
+
should "have default summary" do
|
35
|
+
assert_equal "TODO: one-line summary of your gem", build_generator.summary
|
36
|
+
end
|
37
|
+
|
38
|
+
should "have default description" do
|
39
|
+
assert_equal "TODO: longer description of your gem", build_generator.description
|
32
40
|
end
|
33
41
|
|
34
42
|
should "not create repo by default" do
|
@@ -39,6 +47,14 @@ class TestGenerator < Test::Unit::TestCase
|
|
39
47
|
assert ! build_generator.should_use_cucumber
|
40
48
|
end
|
41
49
|
|
50
|
+
should "not use reek by default" do
|
51
|
+
assert ! build_generator.should_use_reek
|
52
|
+
end
|
53
|
+
|
54
|
+
should "not use roodi by default" do
|
55
|
+
assert ! build_generator.should_use_roodi
|
56
|
+
end
|
57
|
+
|
42
58
|
should "raise error for invalid testing frameworks" do
|
43
59
|
assert_raise ArgumentError do
|
44
60
|
build_generator(:zomg_invalid)
|
@@ -46,134 +62,105 @@ class TestGenerator < Test::Unit::TestCase
|
|
46
62
|
end
|
47
63
|
end
|
48
64
|
|
49
|
-
|
50
|
-
|
51
|
-
assert_equal 'test', build_generator(:shoulda).test_or_spec
|
52
|
-
end
|
53
|
-
|
54
|
-
should "be test for testunit" do
|
55
|
-
assert_equal 'test', build_generator(:testunit).test_or_spec
|
56
|
-
end
|
57
|
-
|
58
|
-
should "be test for minitest" do
|
59
|
-
assert_equal 'test', build_generator(:minitest).test_or_spec
|
60
|
-
end
|
61
|
-
|
62
|
-
should "be spec for bacon" do
|
63
|
-
assert_equal 'spec', build_generator(:bacon).test_or_spec
|
64
|
-
end
|
65
|
-
|
66
|
-
should "be spec for rspec" do
|
67
|
-
assert_equal 'spec', build_generator(:rspec).test_or_spec
|
68
|
-
end
|
69
|
-
|
70
|
-
should "be example for micronaut" do
|
71
|
-
assert_equal 'example', build_generator(:micronaut).test_or_spec
|
72
|
-
end
|
65
|
+
should "have the correct git remote" do
|
66
|
+
assert_equal 'git@github.com:johndoe/the-perfect-gem.git', build_generator.git_remote
|
73
67
|
end
|
74
68
|
|
75
|
-
|
76
|
-
|
77
|
-
assert_equal 'test', build_generator(:shoulda).test_dir
|
78
|
-
end
|
79
|
-
|
80
|
-
should "be test for testunit" do
|
81
|
-
assert_equal 'test', build_generator(:testunit).test_dir
|
82
|
-
end
|
83
|
-
|
84
|
-
should "be test for minitest" do
|
85
|
-
assert_equal 'test', build_generator(:minitest).test_dir
|
86
|
-
end
|
87
|
-
|
88
|
-
should "be spec for bacon" do
|
89
|
-
assert_equal 'spec', build_generator(:bacon).test_dir
|
90
|
-
end
|
91
|
-
|
92
|
-
should "be spec for rspec" do
|
93
|
-
assert_equal 'spec', build_generator(:rspec).test_dir
|
94
|
-
end
|
95
|
-
|
96
|
-
should "be examples for micronaut" do
|
97
|
-
assert_equal 'examples', build_generator(:micronaut).test_dir
|
98
|
-
end
|
69
|
+
should "have the correct project homepage" do
|
70
|
+
assert_equal 'http://github.com/johndoe/the-perfect-gem', build_generator.project_homepage
|
99
71
|
end
|
100
72
|
|
101
|
-
|
102
|
-
|
103
|
-
assert_equal 'test', build_generator(:shoulda).default_task
|
104
|
-
end
|
105
|
-
|
106
|
-
should "be test for testunit" do
|
107
|
-
assert_equal 'test', build_generator(:testunit).default_task
|
108
|
-
end
|
109
|
-
|
110
|
-
should "be test for minitest" do
|
111
|
-
assert_equal 'test', build_generator(:minitest).default_task
|
112
|
-
end
|
113
|
-
|
114
|
-
should "be spec for bacon" do
|
115
|
-
assert_equal 'spec', build_generator(:bacon).default_task
|
116
|
-
end
|
117
|
-
|
118
|
-
should "be spec for rspec" do
|
119
|
-
assert_equal 'spec', build_generator(:rspec).default_task
|
120
|
-
end
|
121
|
-
|
122
|
-
should "be examples for micronaut" do
|
123
|
-
assert_equal 'examples', build_generator(:micronaut).default_task
|
124
|
-
end
|
73
|
+
should "have the correct constant name" do
|
74
|
+
assert_equal "ThePerfectGem", build_generator.constant_name
|
125
75
|
end
|
126
76
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
should "be test/unit/assertions for testunit" do
|
133
|
-
assert_equal 'test/unit/assertions', build_generator(:testunit).feature_support_require
|
134
|
-
end
|
135
|
-
|
136
|
-
should "be mini/test for minitest" do
|
137
|
-
assert_equal 'mini/test', build_generator(:minitest).feature_support_require
|
138
|
-
end
|
139
|
-
|
140
|
-
should "be test/unit/assertions for bacon" do
|
141
|
-
assert_equal 'test/unit/assertions', build_generator(:bacon).feature_support_require
|
142
|
-
end
|
77
|
+
should "have the correct file name prefix" do
|
78
|
+
assert_equal "the_perfect_gem", build_generator.file_name_prefix
|
79
|
+
end
|
143
80
|
|
144
|
-
|
145
|
-
|
146
|
-
|
81
|
+
should "have the correct require name" do
|
82
|
+
assert_equal "the-perfect-gem", build_generator.require_name
|
83
|
+
end
|
147
84
|
|
148
|
-
|
149
|
-
|
150
|
-
end
|
85
|
+
should "have the correct lib file name" do
|
86
|
+
assert_equal "the-perfect-gem.rb", build_generator.lib_filename
|
151
87
|
end
|
152
88
|
|
153
|
-
|
154
|
-
should "
|
155
|
-
assert_equal
|
89
|
+
def self.should_have_generator_attribute(attribute, value)
|
90
|
+
should "have #{value} for #{attribute}" do
|
91
|
+
assert_equal value, build_generator(@framework).send(attribute)
|
156
92
|
end
|
93
|
+
end
|
157
94
|
|
158
|
-
|
159
|
-
|
160
|
-
|
95
|
+
context "shoulda" do
|
96
|
+
setup { @framework = :shoulda }
|
97
|
+
should_have_generator_attribute :test_task, 'test'
|
98
|
+
should_have_generator_attribute :test_dir, 'test'
|
99
|
+
should_have_generator_attribute :default_task, 'test'
|
100
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
101
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
102
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
103
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
104
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
105
|
+
end
|
161
106
|
|
162
|
-
|
163
|
-
|
164
|
-
|
107
|
+
context "testunit" do
|
108
|
+
setup { @framework = :testunit }
|
109
|
+
should_have_generator_attribute :test_task, 'test'
|
110
|
+
should_have_generator_attribute :test_dir, 'test'
|
111
|
+
should_have_generator_attribute :default_task, 'test'
|
112
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
113
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
114
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
115
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
116
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
117
|
+
end
|
165
118
|
|
166
|
-
|
167
|
-
|
168
|
-
|
119
|
+
context "minitest" do
|
120
|
+
setup { @framework = :minitest }
|
121
|
+
should_have_generator_attribute :test_task, 'test'
|
122
|
+
should_have_generator_attribute :test_dir, 'test'
|
123
|
+
should_have_generator_attribute :default_task, 'test'
|
124
|
+
should_have_generator_attribute :feature_support_require, 'mini/test'
|
125
|
+
should_have_generator_attribute :feature_support_extend, 'Mini::Test::Assertions'
|
126
|
+
should_have_generator_attribute :test_pattern, 'test/**/*_test.rb'
|
127
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_test.rb'
|
128
|
+
should_have_generator_attribute :test_helper_filename, 'test_helper.rb'
|
129
|
+
end
|
169
130
|
|
170
|
-
|
171
|
-
|
172
|
-
|
131
|
+
context "bacon" do
|
132
|
+
setup { @framework = :bacon }
|
133
|
+
should_have_generator_attribute :test_task, 'spec'
|
134
|
+
should_have_generator_attribute :test_dir, 'spec'
|
135
|
+
should_have_generator_attribute :default_task, 'spec'
|
136
|
+
should_have_generator_attribute :feature_support_require, 'test/unit/assertions'
|
137
|
+
should_have_generator_attribute :feature_support_extend, 'Test::Unit::Assertions'
|
138
|
+
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
139
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb'
|
140
|
+
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
141
|
+
end
|
173
142
|
|
174
|
-
|
175
|
-
|
176
|
-
|
143
|
+
context "rspec" do
|
144
|
+
setup { @framework = :rspec }
|
145
|
+
should_have_generator_attribute :test_task, 'spec'
|
146
|
+
should_have_generator_attribute :test_dir, 'spec'
|
147
|
+
should_have_generator_attribute :default_task, 'spec'
|
148
|
+
should_have_generator_attribute :feature_support_require, 'spec/expectations'
|
149
|
+
should_have_generator_attribute :feature_support_extend, nil
|
150
|
+
should_have_generator_attribute :test_pattern, 'spec/**/*_spec.rb'
|
151
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_spec.rb'
|
152
|
+
should_have_generator_attribute :test_helper_filename, 'spec_helper.rb'
|
177
153
|
end
|
178
154
|
|
155
|
+
context "micronaut" do
|
156
|
+
setup { @framework = :micronaut }
|
157
|
+
should_have_generator_attribute :test_task, 'examples'
|
158
|
+
should_have_generator_attribute :test_dir, 'examples'
|
159
|
+
should_have_generator_attribute :default_task, 'examples'
|
160
|
+
should_have_generator_attribute :feature_support_require, 'micronaut/expectations'
|
161
|
+
should_have_generator_attribute :feature_support_extend, 'Micronaut::Matchers'
|
162
|
+
should_have_generator_attribute :test_pattern, 'examples/**/*_example.rb'
|
163
|
+
should_have_generator_attribute :test_filename, 'the-perfect-gem_example.rb'
|
164
|
+
should_have_generator_attribute :test_helper_filename, 'example_helper.rb'
|
165
|
+
end
|
179
166
|
end
|
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestGeneratorInitialization < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@project_name = 'the-perfect-gem'
|
6
|
+
@git_name = 'foo'
|
7
|
+
@git_email = 'bar@example.com'
|
8
|
+
@github_user = 'technicalpickles'
|
9
|
+
@github_token = 'zomgtoken'
|
10
|
+
end
|
11
|
+
|
12
|
+
def stub_git_config(options = {})
|
13
|
+
stub(Git).global_config() { options }
|
14
|
+
end
|
15
|
+
|
16
|
+
def valid_git_config
|
17
|
+
{ 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user, 'github.token' => @github_token }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "given a nil github repo name" do
|
21
|
+
setup do
|
22
|
+
stub_git_config
|
23
|
+
|
24
|
+
@block = lambda { }
|
25
|
+
end
|
26
|
+
|
27
|
+
should 'raise NoGithubRepoNameGiven' do
|
28
|
+
assert_raise Jeweler::NoGitHubRepoNameGiven do
|
29
|
+
Jeweler::Generator.new(nil)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "without git user's name set" do
|
35
|
+
setup do
|
36
|
+
stub_git_config 'user.email' => @git_email
|
37
|
+
end
|
38
|
+
|
39
|
+
should 'raise an NoGitUserName' do
|
40
|
+
assert_raise Jeweler::NoGitUserName do
|
41
|
+
Jeweler::Generator.new(@project_name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "without git user's email set" do
|
47
|
+
setup do
|
48
|
+
stub_git_config 'user.name' => @git_name
|
49
|
+
end
|
50
|
+
|
51
|
+
should 'raise NoGitUserName' do
|
52
|
+
assert_raise Jeweler::NoGitUserEmail do
|
53
|
+
Jeweler::Generator.new(@project_name)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "without github username set" do
|
59
|
+
setup do
|
60
|
+
stub_git_config 'user.email' => @git_email, 'user.name' => @git_name
|
61
|
+
end
|
62
|
+
|
63
|
+
should 'raise NotGitHubUser' do
|
64
|
+
assert_raise Jeweler::NoGitHubUser do
|
65
|
+
Jeweler::Generator.new(@project_name)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "without github token set" do
|
71
|
+
setup do
|
72
|
+
stub_git_config 'user.name' => @git_name, 'user.email' => @git_email, 'github.user' => @github_user
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'raise NoGitHubToken if creating repo' do
|
76
|
+
assert_raise Jeweler::NoGitHubToken do
|
77
|
+
Jeweler::Generator.new(@project_name, :create_repo => true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context "default configuration" do
|
83
|
+
setup do
|
84
|
+
stub_git_config valid_git_config
|
85
|
+
@generator = Jeweler::Generator.new(@project_name)
|
86
|
+
end
|
87
|
+
|
88
|
+
should "use shoulda for testing" do
|
89
|
+
assert_equal :shoulda, @generator.testing_framework
|
90
|
+
end
|
91
|
+
|
92
|
+
should "use rdoc for documentation" do
|
93
|
+
assert_equal :rdoc, @generator.documentation_framework
|
94
|
+
end
|
95
|
+
|
96
|
+
should "set todo in summary" do
|
97
|
+
assert_match /todo/i, @generator.summary
|
98
|
+
end
|
99
|
+
|
100
|
+
should "set todo in description" do
|
101
|
+
assert_match /todo/i, @generator.description
|
102
|
+
end
|
103
|
+
|
104
|
+
should "set target directory to the project name" do
|
105
|
+
assert_equal @project_name, @generator.target_dir
|
106
|
+
end
|
107
|
+
|
108
|
+
should "set user's name from git config" do
|
109
|
+
assert_equal @git_name, @generator.user_name
|
110
|
+
end
|
111
|
+
|
112
|
+
should "set email from git config" do
|
113
|
+
assert_equal @git_email, @generator.user_email
|
114
|
+
end
|
115
|
+
|
116
|
+
should "set a github remote based on username and project name" do
|
117
|
+
assert_equal "git@github.com:#{@github_user}/#{@project_name}.git", @generator.git_remote
|
118
|
+
end
|
119
|
+
|
120
|
+
should "set github username from git config" do
|
121
|
+
assert_equal @github_user, @generator.github_username
|
122
|
+
end
|
123
|
+
|
124
|
+
should "set project name as the-perfect-gem" do
|
125
|
+
assert_equal @project_name, @generator.project_name
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
context "using yard" do
|
130
|
+
setup do
|
131
|
+
@generator = Jeweler::Generator.new(@project_name, :documentation_framework => :yard)
|
132
|
+
end
|
133
|
+
|
134
|
+
should "set the doc_task to yardoc" do
|
135
|
+
assert_equal "yardoc", @generator.doc_task
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
context "using yard" do
|
141
|
+
setup do
|
142
|
+
@generator = Jeweler::Generator.new(@project_name, :documentation_framework => :rdoc)
|
143
|
+
end
|
144
|
+
|
145
|
+
should "set the doc_task to rdoc" do
|
146
|
+
assert_equal "rdoc", @generator.doc_task
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context "using options" do
|
151
|
+
should "set documentation" do
|
152
|
+
generator = Jeweler::Generator.new(@project_name, :documentation_framework => :yard)
|
153
|
+
assert_equal :yard, generator.documentation_framework
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|