piano 0.10.4 → 0.10.6

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/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in piano.gemspec
4
- gemspec
@@ -1,90 +0,0 @@
1
- require "piano/controllerloader"
2
-
3
- describe Piano::ControllerLoader do
4
- context "there are some files in the folder" do
5
- before :all do
6
- if Dir.exist? "controllers"
7
- puts "#{File.expand_path('controllers')} should not exist for this to run"
8
- Process.exit!
9
- end
10
-
11
- FileUtils.mkdir "controllers"
12
- File.open "controllers/demo.controller", "w" do |file|
13
- file.write <<-HOLA
14
- def Piano.demo_was_loaded; true; end
15
- HOLA
16
- end
17
-
18
- File.open "controllers/another.rb", "w" do |file|
19
- file.write <<-HOLA2
20
- def Piano.wrong!; true; end
21
- HOLA2
22
- end
23
-
24
- FileUtils.mkdir "controllers/recursive"
25
- FileUtils.mkdir "controllers/recursive/very"
26
- File.open "controllers/recursive/very/demo2.controller", "w" do
27
- |file|
28
- file.write <<-HOLA3
29
- def Piano.another_was_loaded; true; end
30
- HOLA3
31
- end
32
- end
33
-
34
- describe ".folder" do
35
- context "files" do
36
- before :all do
37
- Piano::ControllerLoader.folder "controllers"
38
- end
39
-
40
- it "should include the demo file" do
41
- Piano.demo_was_loaded.should be
42
- end
43
-
44
- it "should not include the .rb file" do
45
- expect { Piano.wrong!
46
- }.to raise_error(NoMethodError)
47
- end
48
-
49
- it "should include the in-folder file" do
50
- Piano.another_was_loaded.should be
51
- end
52
- end
53
-
54
- it "should not change $LOAD_PATH" do
55
- expect { Piano::ControllerLoader.folder "controllers"
56
- }.to change{ $LOAD_PATH.length }.by(1)
57
- end
58
- end
59
-
60
- describe ".recursive" do
61
- it "should contain the path to the demo file" do
62
- flag = false
63
- Piano::ControllerLoader.recursive "controllers" do |item|
64
- flag = true if item == "controllers/demo"
65
- end
66
- flag.should be_true
67
- end
68
-
69
- it "should not contain the path to the .rb file" do
70
- flag = false
71
- Piano::ControllerLoader.recursive "controllers" do |item|
72
- flag = true if item == "controllers/another"
73
- end
74
- flag.should_not be_true
75
- end
76
-
77
- it "should contain the path to the indented demo file" do
78
- flag = false
79
- Piano::ControllerLoader.recursive "controllers" do |item|
80
- flag = true if item == "controllers/recursive/very/demo2"
81
- end
82
- flag.should be_true
83
- end
84
- end
85
-
86
- after :all do
87
- FileUtils.rm_r "controllers"
88
- end
89
- end
90
- end