tschmidt-jplug 0.2.4 → 0.2.5
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/VERSION +1 -1
- data/jplug.gemspec +1 -1
- data/test/jplug_test.rb +86 -3
- data/test/test_helper.rb +2 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.5
|
data/jplug.gemspec
CHANGED
data/test/jplug_test.rb
CHANGED
@@ -1,7 +1,90 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
3
|
class JplugTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
context "jPlug Creation" do
|
6
|
+
setup do
|
7
|
+
@dir = File.join(File.dirname(__FILE__), 'assets')
|
8
|
+
FileUtils.mkdir_p(@dir)
|
9
|
+
end
|
10
|
+
|
11
|
+
teardown do
|
12
|
+
FileUtils.rm_rf(@dir)
|
13
|
+
end
|
14
|
+
|
15
|
+
should "display help if there is no plugin name given" do
|
16
|
+
assert_equal `jplug`, `jplug --help`
|
17
|
+
end
|
18
|
+
|
19
|
+
should "create a new jQuery Plugin if a name is given" do
|
20
|
+
`jplug -d #{@dir} AwesomePlugin`
|
21
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin'))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "jPlug with --no-extras flag set" do
|
26
|
+
setup do
|
27
|
+
@dir = File.join(File.dirname(__FILE__), 'assets')
|
28
|
+
FileUtils.mkdir_p(@dir)
|
29
|
+
`jplug -d #{@dir} --no-extras AwesomePlugin`
|
30
|
+
end
|
31
|
+
|
32
|
+
teardown do
|
33
|
+
FileUtils.rm_rf(@dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
should "not find any extra jquery files" do
|
37
|
+
%w( jquery.easing-1.3.js jquery.ekko-0.1.js jquery.form-2.28.js ).each do |extra_js|
|
38
|
+
assert_equal false, File.exist?(File.join(@dir, 'awesome_plugin/html/javascripts', extra_js))
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "jPlug with extras flag set" do
|
44
|
+
setup do
|
45
|
+
@dir = File.join(File.dirname(__FILE__), 'assets')
|
46
|
+
FileUtils.mkdir_p(@dir)
|
47
|
+
`jplug -d #{@dir} --extras AwesomePlugin`
|
48
|
+
end
|
49
|
+
|
50
|
+
teardown do
|
51
|
+
FileUtils.rm_rf(@dir)
|
52
|
+
end
|
53
|
+
|
54
|
+
should "find extra jquery files" do
|
55
|
+
%w( jquery.easing-1.3.js jquery.ekko-0.1.js jquery.form-2.28.js ).each do |extra_js|
|
56
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin/html/javascripts', extra_js))
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context "jplug directory structure" do
|
62
|
+
setup do
|
63
|
+
@dir = File.join(File.dirname(__FILE__), 'assets')
|
64
|
+
FileUtils.mkdir_p(@dir)
|
65
|
+
`jplug -d #{@dir} --extras AwesomePlugin`
|
66
|
+
end
|
67
|
+
|
68
|
+
teardown do
|
69
|
+
FileUtils.rm_rf(@dir)
|
70
|
+
end
|
71
|
+
|
72
|
+
should "have html dir" do
|
73
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin', 'html'))
|
74
|
+
end
|
75
|
+
|
76
|
+
should "have html/stylesheets dir" do
|
77
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin', 'html', 'stylesheets'))
|
78
|
+
end
|
79
|
+
|
80
|
+
should "have html/javascripts dir" do
|
81
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin', 'html', 'javascripts'))
|
82
|
+
end
|
83
|
+
|
84
|
+
should "have lib dir" do
|
85
|
+
assert File.exist?(File.join(@dir, 'awesome_plugin', 'lib'))
|
86
|
+
end
|
6
87
|
end
|
7
|
-
|
88
|
+
|
89
|
+
|
90
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'test/unit'
|
3
3
|
require 'shoulda'
|
4
|
+
require 'fileutils'
|
4
5
|
|
5
6
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
-
require '
|
8
|
+
require 'jquery'
|
8
9
|
|
9
10
|
class Test::Unit::TestCase
|
10
11
|
end
|