spec/base/configuration_spec.rb in jscruggs-metric_fu-1.1.1 vs spec/base/configuration_spec.rb in jscruggs-metric_fu-1.1.2

- old
+ new

@@ -126,11 +126,11 @@ 'to @base_directory' do output_dir = File.join(base_directory, 'output') output_directory.should == output_dir end - it 'should set @template_class to StandardTemplate' do + it 'should set @template_class to AwesomeTemplate' do template_class.should == AwesomeTemplate end it 'should set @flay to {:dirs_to_flay => @code_dirs}' do @config.instance_variable_get(:@flay). @@ -189,19 +189,50 @@ :filter_cyclo => "0", :warn_cyclo => "5", :error_cyclo => "7", :formater => "text" }' do @config.instance_variable_get(:@saikuro). - should == { :output_directory => 'tmp/metric_fu/scratch/saikuro', + should == { :output_directory => "#{scratch_directory}/saikuro", :input_directory => ['lib'], :cyclo => "", :filter_cyclo => "0", :warn_cyclo => "5", :error_cyclo => "7", :formater => "text"} end - + + it 'should set @graph_theme to { + :colors => %w(orange purple green white red blue pink yellow), + :marker_color => "blue", + :background_colors => %w(white white)}' do + @config.instance_variable_get(:@graph_theme). + should == { :colors => %w(orange purple green white red blue pink yellow), + :marker_color => "blue", + :background_colors => %w(white white) } + end + + it 'should set @graph_font to the path to the font directory' do + @config.instance_variable_get(:@graph_font). + should include(File.join('vendor', '_fonts', 'monaco.ttf')) + end + + it 'should set @graph_title_font_size to 12' do + @config.instance_variable_get(:@graph_title_font_size).should eql(12) + end + + it 'should set @graph_legend_box_size to 12' do + @config.instance_variable_get(:@graph_legend_box_size).should eql(12) + end + + it 'should set @graph_legend_box_size to 10' do + @config.instance_variable_get(:@graph_legend_font_size).should eql(10) + end + + it 'should set @graph_marker_font_size to 10' do + @config.instance_variable_get(:@graph_marker_font_size).should eql(10) + end + describe 'if #rails? is true ' do before(:each) do @config.stub!(:rails?).and_return(true) end @@ -211,10 +242,17 @@ @config.instance_variable_get(:@metrics). should == MetricFu::AVAILABLE_METRICS << [:stats] end end + describe '#set_graphs ' do + it 'should set the @graphs instance var to AVAILABLE_GRAPHS' do + @config.instance_variable_get(:@graphs). + should == MetricFu::AVAILABLE_GRAPHS + end + end + describe '#set_code_dirs ' do it 'should set the @code_dirs instance var to ["app", "lib"]' do # This is hard to spec properly because the @code_dirs variable # is set during the reset process. #@config.instance_variable_get(:@code_dirs). @@ -262,10 +300,16 @@ before(:each) { get_new_config } MetricFu::AVAILABLE_METRICS.each do |metric| it "should add a #{metric} class method to the MetricFu module " do - MetricFu.respond_to?(metric).should be_true + MetricFu.should respond_to(metric) + end + end + + MetricFu::AVAILABLE_GRAPHS.each do |graph| + it "should add a #{graph} class metrhod to the MetricFu module" do + MetricFu.should respond_to(graph) end end end describe '#platform' do