spec/awestruct/cli/options_spec.rb in awestruct-0.5.7.RC2 vs spec/awestruct/cli/options_spec.rb in awestruct-0.5.7
- old
+ new
@@ -26,11 +26,11 @@
options.output_dir == File.join( __FILE__, '..', '_site' )
options.source_dir == File.join( __FILE__, '..' )
end
- describe 'parsing' do
+ context 'parsing' do
def parse!(*args)
Awestruct::CLI::Options.parse! args
end
it 'should parse server-related args' do
@@ -105,9 +105,30 @@
it 'by default, output_dir should be "_site" under source_dir' do
result = Awestruct::CLI::Options.parse!(%w(--source-dir /tmp))
result.source_dir.should eql '/tmp'
result.output_dir.should eql '/tmp/_site'
+ end
+
+ it 'by default, perf logging should be disabled' do
+ result = Awestruct::CLI::Options.parse!(%w(--source-dir /tmp))
+ result.perf_log.should eql false
+ end
+
+ it '--perf should enable perf logging' do
+ result = Awestruct::CLI::Options.parse!(%w(--source-dir /tmp --perf))
+ result.perf_log.should eql true
+ end
+
+ context 'source dir should not override output dir' do
+ context 'source dir first' do
+ result = Awestruct::CLI::Options.parse!(%w(--source-dir /tmp --output-dir /tmp/output))
+ it { expect(result.output_dir).to eq '/tmp/output' }
+ end
+ context 'output dir first' do
+ result = Awestruct::CLI::Options.parse!(%w(--output-dir /tmp/output --source-dir /tmp))
+ it { expect(result.output_dir).to eq '/tmp/output' }
+ end
end
end
end