jumpstart 0.3.6 → 0.3.7

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.
@@ -1,15 +1,15 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestJumpstart < Test::Unit::TestCase
4
-
4
+
5
5
  should "be able to find jumpstart_setup.yml" do
6
6
  assert(File.exists?("#{JumpStart::CONFIG_PATH}/jumpstart_setup.yml"))
7
7
  end
8
-
8
+
9
9
  should "be able to find jumpstart_version.yml" do
10
10
  assert(File.exists?("#{JumpStart::CONFIG_PATH}/jumpstart_version.yml"))
11
11
  end
12
-
12
+
13
13
  context "Test for JumpStart.version class instance method" do
14
14
  should "return 1.1.1" do
15
15
  JumpStart.version_major = 1
@@ -18,9 +18,9 @@ class TestJumpstart < Test::Unit::TestCase
18
18
  assert_equal "1.1.1", JumpStart.version
19
19
  end
20
20
  end
21
-
21
+
22
22
  context "Tests for the JumpStart::Base#templates_path class method" do
23
-
23
+
24
24
  should "return default path if @templates_path is nil when called" do
25
25
  JumpStart.module_eval {@templates_path = nil}
26
26
  assert_equal "#{JumpStart::ROOT_PATH}/jumpstart_templates", JumpStart.templates_path
@@ -30,31 +30,33 @@ class TestJumpstart < Test::Unit::TestCase
30
30
  JumpStart.module_eval {@templates_path = ""}
31
31
  assert_equal "#{JumpStart::ROOT_PATH}/jumpstart_templates", JumpStart.templates_path
32
32
  end
33
-
33
+
34
34
  should "return the path set" do
35
35
  JumpStart.module_eval {@templates_path = "a/path/for/templates"}
36
- assert_equal "a/path/for/templates", JumpStart.templates_path
36
+ assert_equal "a/path/for/templates", JumpStart.templates_path
37
37
  end
38
-
38
+
39
39
  end
40
-
40
+
41
41
  context "Tests for the JumpStart#existing_projects class method. \n" do
42
-
43
- setup do
44
- JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
45
- end
46
-
42
+
47
43
  teardown do
48
44
  JumpStart.templates_path = nil
49
45
  end
50
-
46
+
51
47
  should "run existing_projects method and return an array of existing templates" do
48
+ JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/test_jumpstart_templates"
52
49
  assert_equal %w[test_template_1 test_template_2 test_template_3], JumpStart.existing_templates
53
50
  end
54
-
51
+
52
+ should "run existing_projects method and return an empty array if no templates are found" do
53
+ JumpStart.templates_path = "#{JumpStart::ROOT_PATH}/test/jumpstart"
54
+ assert_equal [], JumpStart.existing_templates
55
+ end
56
+
55
57
  end
56
-
57
- context "Tests for the JumpStart#dump_jumpstart_setup_yaml class method." do
58
+
59
+ context "Tests for the JumpStart#dump_jumpstart_setup_yaml class method." do
58
60
  should "call File.open and Yaml.dump for jumpstart_setup.yml" do
59
61
  YAML.stubs(:dump)
60
62
  File.stubs(:open)
@@ -63,7 +65,7 @@ class TestJumpstart < Test::Unit::TestCase
63
65
  end
64
66
  end
65
67
 
66
- context "Tests for the JumpStart#dump_jumpstart_version_yaml class method." do
68
+ context "Tests for the JumpStart#dump_jumpstart_version_yaml class method." do
67
69
  should "call File.open and Yaml.dump for jumpstart_version.yml" do
68
70
  YAML.stubs(:dump)
69
71
  File.stubs(:open)
@@ -73,11 +75,11 @@ class TestJumpstart < Test::Unit::TestCase
73
75
  end
74
76
 
75
77
  context "Tests for the JumpStart#bump class method." do
76
-
78
+
77
79
  setup do
78
80
  JumpStart.stubs(:dump_jumpstart_version_yaml)
79
81
  end
80
-
82
+
81
83
  should "add 1 to @version_major class instance variable, set @version_minor and @version_patch to 0 and call dump_jumpstart_version_yaml" do
82
84
  JumpStart.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
83
85
  JumpStart.expects(:dump_jumpstart_version_yaml).once
@@ -86,7 +88,7 @@ class TestJumpstart < Test::Unit::TestCase
86
88
  assert_equal 0, JumpStart.version_minor
87
89
  assert_equal 0, JumpStart.version_patch
88
90
  end
89
-
91
+
90
92
  should "add 1 to @version_minor class instance variable, set @version_patch to 0 and call dump_jumpstart_version_yaml" do
91
93
  JumpStart.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
92
94
  JumpStart.expects(:dump_jumpstart_version_yaml).once
@@ -96,7 +98,7 @@ class TestJumpstart < Test::Unit::TestCase
96
98
  assert_equal 0, JumpStart.version_patch
97
99
 
98
100
  end
99
-
101
+
100
102
  should "add 1 to @version_patch class instance variable and call dump_jumpstart_version_yaml" do
101
103
  JumpStart.module_eval {@version_major = 1; @version_minor = 1; @version_patch = 1 }
102
104
  JumpStart.expects(:dump_jumpstart_version_yaml).once
@@ -106,16 +108,34 @@ class TestJumpstart < Test::Unit::TestCase
106
108
  assert_equal 2, JumpStart.version_patch
107
109
 
108
110
  end
109
-
111
+
110
112
  end
111
-
113
+
114
+ context "Tests for the JumpStart#const_missing class method." do
115
+
116
+ setup do
117
+ JumpStart.stubs(:version)
118
+ end
119
+
120
+ should "return the value of JumpStart Version if JumpStart::VERSION is called" do
121
+ JumpStart.expects(:version).once
122
+ JumpStart::VERSION
123
+ end
124
+
125
+ should "return to super if an unknown constant is called" do
126
+ assert_raises(NameError) {JumpStart::VERSIONS}
127
+ assert_raises(NameError) {JumpStart::AVERSION}
128
+ end
129
+
130
+ end
131
+
112
132
  context "Tests for the JumpStart#method_missing class method." do
113
-
133
+
114
134
  setup do
115
135
  JumpStart.stubs(:bump).returns(:result)
116
136
  JumpStart.stubs(:dump_jumpstart_version_yaml)
117
137
  end
118
-
138
+
119
139
  should "recognise JumpStart#bump_version_major class instance method calls and forward them to JumpStart#bump to set @version_major." do
120
140
  JumpStart.expects(:bump).with("version_major").once
121
141
  JumpStart.bump_version_major
@@ -134,7 +154,7 @@ class TestJumpstart < Test::Unit::TestCase
134
154
  should "return method_missing to super as normal if method name is not recognised." do
135
155
  assert_raises(NoMethodError) {JumpStart.bump_version_blarg}
136
156
  end
137
-
157
+
138
158
  end
139
-
140
- end
159
+
160
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ian Alexander Wood (i0n)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-31 00:00:00 +01:00
17
+ date: 2010-06-01 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency