require 'spec_helper' require 'support/heredoc_helper' RSpec.describe NullSLOCCount do subject(:null_sloccount) { NullSLOCCount.new } describe ".total" do subject { null_sloccount.total } it { is_expected.to eq 0 } end end RSpec.describe SLOCCount do describe "#total" do it "returns the total sloccount shown in the sloccount output file" do sloccount = SLOCCount.new(SLOCCOUNT_OUTPUT_RUBY_785) expect(sloccount.total).to eq 785 end end SLOCCOUNT_OUTPUT_RUBY_785 = <<-EOS.heredoc_unindent Have a non-directory at the top, so creating directory top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./CHANGELOG.md to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./Gemfile to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./Gemfile.lock to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./README.md to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./TODO.md to top_dir Creating filelist for bin Creating filelist for coverage Creating filelist for lib Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./pluginscan-0.1.1.gem to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./pluginscan-0.1.2.gem to top_dir Adding /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/./pluginscan.gemspec to top_dir Creating filelist for spec Creating filelist for tmp Categorizing files. WARNING! File /Users/dxwduncan/Dev/Ruby_and_rails/pluginscan/bin/pluginscan has unknown start: #!/usr/bin/env ruby Finding a working MD5 command.... Found a working MD5 command. Computing results. SLOC Directory SLOC-by-Language (Sorted) 412 spec ruby=412 373 lib ruby=373 0 bin (none) 0 coverage (none) 0 tmp (none) 0 top_dir (none) Totals grouped by language (dominant language first): ruby: 785 (100.00%) Total Physical Source Lines of Code (SLOC) = 785 Development Effort Estimate, Person-Years (Person-Months) = 0.16 (1.86) (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05)) Schedule Estimate, Years (Months) = 0.26 (3.17) (Basic COCOMO model, Months = 2.5 * (person-months**0.38)) Estimated Average Number of Developers (Effort/Schedule) = 0.59 Total Estimated Cost to Develop = $ 20,953 (average salary = $56,286/year, overhead = 2.40). SLOCCount, Copyright (C) 2001-2004 David A. Wheeler SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL. SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to redistribute it under certain conditions as specified by the GNU GPL license; see the documentation for details. Please credit this data as "generated using David A. Wheeler's 'SLOCCount'." EOS end