requirer 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/requirer.rb +3 -3
- data/lib/requirer/version.rb +1 -1
- data/spec/requirer_spec.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb3a02ffae64a6c0e5cbc641c2e1b0a01d8c2d1e
|
4
|
+
data.tar.gz: 63e600c6c5b35a9cd137f6cd19d67e2ed486def3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 339112bb76cbeb951b2674c99d96b0cb6105fabd42a97d2073485d7a2e9796cf5d785f0afa923340896523c9fce96e939f664c07813c89930d7d17b6c061bdbf
|
7
|
+
data.tar.gz: 950a0570b94340255c9cb8a6994c965e91f04b1af49825b083350be5d156d81dee243952330e5c445367bd9375dab16944d8379919ba7ca9c8e091a80cf60c4f
|
data/.travis.yml
CHANGED
data/lib/requirer.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class DirUtilsException < StandardError ; end
|
1
|
+
require_relative "requirer/version"
|
4
2
|
|
5
3
|
module Requirer
|
4
|
+
class DirUtilsException < StandardError ; end
|
5
|
+
|
6
6
|
def dir_tree(path)
|
7
7
|
# "dir_tree #{path}".logit
|
8
8
|
path = find_dir_with(path, $LOAD_PATH)
|
data/lib/requirer/version.rb
CHANGED
data/spec/requirer_spec.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
warn 'in requirer_spec'
|
2
1
|
require 'spec_helper'
|
3
2
|
|
3
|
+
# add directory to load_path where test files to load exist
|
4
4
|
$LOAD_PATH.unshift 'spec/dirs_to_require'
|
5
5
|
|
6
6
|
describe Requirer do
|
7
7
|
before { $bucket = [] }
|
8
8
|
|
9
9
|
describe 'require directory with depth 1' do
|
10
|
-
it 'is loaded' do
|
10
|
+
it 'file is loaded' do
|
11
11
|
dir_tree 'dir_depth_1'
|
12
12
|
expect($bucket).to eq(['depth_one'])
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'is loaded only once even though required twice' do
|
15
|
+
it 'file is loaded only once even though required twice' do
|
16
16
|
dir_tree 'dir_depth_1_only'
|
17
17
|
dir_tree 'dir_depth_1_only'
|
18
18
|
expect($bucket).to eq(['depth_one'])
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe '
|
22
|
+
describe 'files in each level of directory tree is loaded' do
|
23
23
|
it 'is breadth first' do
|
24
24
|
dir_tree 'dir_depth_3'
|
25
25
|
expect($bucket).to eq(['depth_one(2)', 'depth_two', 'depth_three'])
|
@@ -27,7 +27,7 @@ describe Requirer do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe 'require non-existent directory' do
|
30
|
-
it '
|
30
|
+
it 'raises an error' do
|
31
31
|
expect{ dir_tree('nobody-is-home') }.to raise_error(DirUtilsException)
|
32
32
|
end
|
33
33
|
end
|