first loader spec

arnaud sellenet committed Jun 03, 2014
commit 555582ff89e1dcfd6f0c061533f46a8d90548719
Showing 2 changed files with 21 additions and 1 deletions
locomotive/steam/loaders/yml/pages_loader.rb b/lib/locomotive/steam/loaders/yml/pages_loader.rb +1 -1
@@ @@ -63,7 +63,7 @@ module Locomotive
[].tap do |page_records|
position, last_dirname = nil, nil
- Dir.glob(File.join(@root_path, '**/*')).sort.each do |filepath|
+ Dir.glob(File.join(root_dir, '**/*')).sort.each do |filepath|
next unless File.directory?(filepath) || filepath =~ /\.(#{Locomotive::Steam::TEMPLATE_EXTENSIONS.join('|')})$/
if last_dirname != File.dirname(filepath)
spec/unit/loaders/pages_loader_spec.rb +20 -0
@@ @@ -0,0 +1,20 @@
+ require 'spec_helper'
+
+ describe Locomotive::Steam::Loader::Yml::PagesLoader do
+
+
+ let(:path) { default_fixture_site_path }
+ subject { Locomotive::Steam::Loader::Yml::PagesLoader.new path, mapper }
+
+ describe '#initialize' do
+ it { should be_kind_of Object }
+ end
+
+ describe '#load!' do
+ before { subject.load! }
+ it 'loads pages in the pages Repository' do
+ Locomotive::Models[:pages].all(:en).size.should > 0
+ end
+ end
+
+ end