File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed
Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 11module Bashly
22 class Library
3- include AssetHelper
43 attr_reader :path , :config
54 attr_accessor :args
65
Original file line number Diff line number Diff line change @@ -7,11 +7,7 @@ def initialize(path = nil)
77 end
88
99 def config
10- @config ||= YAML . properly_load_file config_path
11- end
12-
13- def config_path
14- @config_path ||= "#{ path } /libraries.yml"
10+ @config ||= YAML . properly_load_file ( "#{ path } /libraries.yml" )
1511 end
1612
1713 def libraries
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe LibrarySource do
4+ describe '#config' do
5+ it 'returns the contents of the libraries.yml file' do
6+ expect ( subject . config ) . to be_a Hash
7+ expect ( subject . config . keys . first ) . to eq 'colors'
8+ end
9+ end
10+
11+ describe '#libraries' do
12+ it 'returns a hash' do
13+ expect ( subject . libraries ) . to be_a Hash
14+ end
15+
16+ it 'returns all libraries as keys' do
17+ expect ( subject . libraries . keys ) . to match_array %i[
18+ colors completions completions_script completions_yaml config
19+ help lib settings strings test validations yaml
20+ ]
21+ end
22+
23+ it 'returns Library objects as values' do
24+ expect ( subject . libraries . values . map { |a | a . class } . uniq ) . to eq [ Library ]
25+ end
26+ end
27+ end
Original file line number Diff line number Diff line change 5858 end
5959 end
6060 end
61+
62+ describe '#find_file' do
63+ let ( :path ) { "#{ Settings . target_dir } /src/lib/colors.sh" }
64+
65+ it 'returns a file from the library' do
66+ expect ( subject . find_file path ) . to be_a Hash
67+ end
68+ end
6169end
You can’t perform that action at this time.
0 commit comments