technicalpickles-jeweler 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/test/generators/initialization_test.rb +146 -0
- data/test/tasks_test.rb +37 -0
- metadata +5 -2
data/VERSION.yml
CHANGED
@@ -0,0 +1,146 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class JewelerGeneratorInitializerTest < Test::Unit::TestCase
|
4
|
+
context "given a nil github repo name" do
|
5
|
+
setup do
|
6
|
+
@block = lambda { Jeweler::Generator.new(nil) }
|
7
|
+
end
|
8
|
+
|
9
|
+
should "raise an error" do
|
10
|
+
assert_raise Jeweler::NoGitHubRepoNameGiven do
|
11
|
+
@block.call
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "without git user's name set" do
|
17
|
+
setup do
|
18
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).returns({'user.email' => 'bar@example.com'})
|
19
|
+
end
|
20
|
+
|
21
|
+
context "instantiating new generator" do
|
22
|
+
setup do
|
23
|
+
@block = lambda { Jeweler::Generator.new('the-perfect-gem')}
|
24
|
+
end
|
25
|
+
|
26
|
+
should "raise no git user name exception" do
|
27
|
+
assert_raise Jeweler::NoGitUserName do
|
28
|
+
@block.call
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "without git user's email set" do
|
35
|
+
setup do
|
36
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).returns({'user.name' => 'foo'})
|
37
|
+
end
|
38
|
+
|
39
|
+
context "instantiating new generator" do
|
40
|
+
setup do
|
41
|
+
@block = lambda { Jeweler::Generator.new('the-perfect-gem')}
|
42
|
+
end
|
43
|
+
|
44
|
+
should "raise no git user name exception" do
|
45
|
+
assert_raise Jeweler::NoGitUserEmail do
|
46
|
+
@block.call
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "without github username set" do
|
53
|
+
setup do
|
54
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).
|
55
|
+
returns({'user.email' => 'bar@example.com', 'user.name' => 'foo'})
|
56
|
+
end
|
57
|
+
|
58
|
+
context "instantiating new generator" do
|
59
|
+
setup do
|
60
|
+
@block = lambda { Jeweler::Generator.new('the-perfect-gem')}
|
61
|
+
end
|
62
|
+
|
63
|
+
should "raise no github user exception" do
|
64
|
+
assert_raise Jeweler::NoGitHubUser do
|
65
|
+
@block.call
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "without github username set" do
|
72
|
+
setup do
|
73
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).
|
74
|
+
returns({'user.email' => 'bar@example.com', 'user.name' => 'foo', 'github.user' => 'technicalpickles'})
|
75
|
+
end
|
76
|
+
|
77
|
+
context "instantiating new generator" do
|
78
|
+
setup do
|
79
|
+
@block = lambda { Jeweler::Generator.new('the-perfect-gem')}
|
80
|
+
end
|
81
|
+
|
82
|
+
should "raise no github user exception" do
|
83
|
+
assert_raise Jeweler::NoGitHubToken do
|
84
|
+
@block.call
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
context "with valid git user configuration" do
|
91
|
+
setup do
|
92
|
+
Jeweler::Generator.any_instance.stubs(:read_git_config).
|
93
|
+
returns({'user.name' => 'foo', 'user.email' => 'bar@example.com', 'github.user' => 'technicalpickles', 'github.token' => 'zomgtoken'})
|
94
|
+
end
|
95
|
+
|
96
|
+
context "for technicalpickle's the-perfect-gem repository" do
|
97
|
+
setup do
|
98
|
+
@generator = Jeweler::Generator.new('the-perfect-gem')
|
99
|
+
end
|
100
|
+
|
101
|
+
should "assign 'foo' to user's name" do
|
102
|
+
assert_equal 'foo', @generator.user_name
|
103
|
+
end
|
104
|
+
|
105
|
+
should "assign 'bar@example.com to user's email" do
|
106
|
+
assert_equal 'bar@example.com', @generator.user_email
|
107
|
+
end
|
108
|
+
|
109
|
+
should "assign github remote" do
|
110
|
+
assert_equal 'git@github.com:technicalpickles/the-perfect-gem.git', @generator.github_remote
|
111
|
+
end
|
112
|
+
|
113
|
+
should "determine github username as technicalpickles" do
|
114
|
+
assert_equal 'technicalpickles', @generator.github_username
|
115
|
+
end
|
116
|
+
|
117
|
+
should "determine github repository name as the-perfect-gem" do
|
118
|
+
assert_equal 'the-perfect-gem', @generator.github_repo_name
|
119
|
+
end
|
120
|
+
|
121
|
+
should "determine github url as http://github.com/technicalpickles/the-perfect-gem" do
|
122
|
+
assert_equal 'http://github.com/technicalpickles/the-perfect-gem', @generator.github_url
|
123
|
+
end
|
124
|
+
|
125
|
+
should "determine target directory as the same as the github repository name" do
|
126
|
+
assert_equal @generator.github_repo_name, @generator.target_dir
|
127
|
+
end
|
128
|
+
|
129
|
+
should "determine lib directory as being inside the target directory" do
|
130
|
+
assert_equal File.join(@generator.target_dir, 'lib'), @generator.lib_dir
|
131
|
+
end
|
132
|
+
|
133
|
+
should "determine test directory as being inside the target directory" do
|
134
|
+
assert_equal File.join(@generator.target_dir, 'test'), @generator.test_dir
|
135
|
+
end
|
136
|
+
|
137
|
+
should "determine constant name as ThePerfectGem" do
|
138
|
+
assert_equal 'ThePerfectGem', @generator.constant_name
|
139
|
+
end
|
140
|
+
|
141
|
+
should "determine file name prefix as the_perfect_gem" do
|
142
|
+
assert_equal 'the_perfect_gem', @generator.file_name_prefix
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/test/tasks_test.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
require 'rake'
|
4
|
+
class TasksTest < Test::Unit::TestCase
|
5
|
+
include Rake
|
6
|
+
|
7
|
+
context 'instantiating Jeweler::Tasks' do
|
8
|
+
setup do
|
9
|
+
Task.clear
|
10
|
+
|
11
|
+
@jt = Jeweler::Tasks.new do |s|
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
should 'assign @gemspec' do
|
17
|
+
assert_not_nil @jt.gemspec
|
18
|
+
end
|
19
|
+
|
20
|
+
should 'assign @jeweler' do
|
21
|
+
assert_not_nil @jt.jeweler
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'define tasks' do
|
25
|
+
assert Task.task_defined?(:gemspec)
|
26
|
+
assert Task.task_defined?(:'gemspec:validate')
|
27
|
+
assert Task.task_defined?(:'gemspec:generate')
|
28
|
+
assert Task.task_defined?(:version)
|
29
|
+
assert Task.task_defined?(:'version:write')
|
30
|
+
assert Task.task_defined?(:'version:display')
|
31
|
+
assert Task.task_defined?(:'version:bump:major')
|
32
|
+
assert Task.task_defined?(:'version:bump:minor')
|
33
|
+
assert Task.task_defined?(:'version:bump:patch')
|
34
|
+
assert Task.task_defined?(:'release')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: technicalpickles-jeweler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Nichols
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-16 00:00:00 -08:00
|
13
13
|
default_executable: jeweler
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -57,10 +57,13 @@ files:
|
|
57
57
|
- test/fixtures
|
58
58
|
- test/fixtures/bar
|
59
59
|
- test/fixtures/bar/VERSION.yml
|
60
|
+
- test/generators
|
61
|
+
- test/generators/initialization_test.rb
|
60
62
|
- test/jeweler_generator_test.rb
|
61
63
|
- test/jeweler_test.rb
|
62
64
|
- test/shoulda_macros
|
63
65
|
- test/shoulda_macros/jeweler_macros.rb
|
66
|
+
- test/tasks_test.rb
|
64
67
|
- test/test_helper.rb
|
65
68
|
- lib/jeweler/templates/.gitignore
|
66
69
|
has_rdoc: false
|