From 54a0c15b46406ac5e3e97bf5a042eda28732083f Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 20:41:48 -0500 Subject: [PATCH 01/14] Solve warnings related to Ruby 3.x --- lib/rails_stats/app_statistics.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/rails_stats/app_statistics.rb b/lib/rails_stats/app_statistics.rb index ca51422..05eaf80 100644 --- a/lib/rails_stats/app_statistics.rb +++ b/lib/rails_stats/app_statistics.rb @@ -3,10 +3,11 @@ class AppStatistics attr_reader :statistics, :total, :test def initialize(directory) + @directories = [] @test = false - @directory = directory - @statistics = calculate_statistics - @total = calculate_total + @directory = directory + @statistics = calculate_statistics + @total = calculate_total end def key_concepts @@ -28,15 +29,15 @@ def calculate_statistics end def directories - return @directories if @directories - out = [] + return @directories if @directories.any? + Dir.foreach(@directory) do |file_name| path = File.join(@directory, file_name) next unless File.directory?(path) next if (/^\./ =~ file_name) next if file_name == "assets" # doing separately next if file_name == "views" # TODO - out << path + @directories << path end assets = File.join(@directory, "assets") @@ -48,13 +49,13 @@ def directories case file_name when "javascripts" - out << path + @directories << path # TODO when "css" end end end - out + @directories end end From 30165d70af0295ef760c963e9bf3afc71bd8b05a Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 20:44:10 -0500 Subject: [PATCH 02/14] Added call to Bundler::Stats::CLI --- lib/rails_stats/console_formatter.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rails_stats/console_formatter.rb b/lib/rails_stats/console_formatter.rb index 60e7a31..6adbc0b 100644 --- a/lib/rails_stats/console_formatter.rb +++ b/lib/rails_stats/console_formatter.rb @@ -1,6 +1,10 @@ +require "bundler/stats/cli" + module RailsStats class ConsoleFormatter < StatsFormatter def to_s + Bundler::Stats::CLI.start + print_header sorted_keys = @statistics.keys.sort sorted_keys.each { |key| print_line(key, @statistics[key]) } From caf90c11597249db1eec3ca444d14a3feec97c0b Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 20:44:39 -0500 Subject: [PATCH 03/14] Add dependency to bundler-stats to output dependencies --- rails_stats.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/rails_stats.gemspec b/rails_stats.gemspec index 31d32f8..cebd232 100644 --- a/rails_stats.gemspec +++ b/rails_stats.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "rake" + spec.add_dependency "bundler-stats", ">= 2.0" spec.add_development_dependency "bundler", ">= 1.6", "< 3.0" spec.add_development_dependency "byebug" spec.add_development_dependency "codecov" From ff682efe3fa84ca0595ca303a27933a725ba8e72 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 20:45:48 -0500 Subject: [PATCH 04/14] Change expectation for rake stats --- test/lib/rails_stats/code_statistics_test.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/test/lib/rails_stats/code_statistics_test.rb b/test/lib/rails_stats/code_statistics_test.rb index 1c26531..5c9c07c 100644 --- a/test/lib/rails_stats/code_statistics_test.rb +++ b/test/lib/rails_stats/code_statistics_test.rb @@ -5,7 +5,20 @@ describe RailsStats::CodeStatistics do describe "#to_s" do TABLE = <<~EOS -+----------------------+---------+---------+---------+---------+-----+-------+ ++-----------------------|------------|----------------+ +| Name | Total Deps | 1st Level Deps | ++-----------------------|------------|----------------+ +| simplecov-console | 7 | 3 | +| codecov | 4 | 1 | +| rails_stats | 4 | 2 | +| simplecov | 3 | 3 | +| minitest-around | 1 | 1 | +| minitest | 0 | 0 | +| bundler | 0 | 0 | +| byebug | 0 | 0 | +| minitest-spec-context | 0 | 0 | ++-----------------------|------------|----------------+ + \n Declared Gems 9 \n Total Gems 17 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+---------+---------+---------+---------+-----+-------+ | Channels | 8 | 8 | 2 | 0 | 0 | 0 | @@ -28,9 +41,11 @@ it "outputs useful stats for a Rails project" do root_directory = File.expand_path('../../../test/dummy', File.dirname(__FILE__)) - assert_output(TABLE) do + out, err = capture_io do RailsStats::CodeStatistics.new(root_directory).to_s end + + assert_equal TABLE, out end end end From a22e33b78f77a233ddb2c8a5cee23e7d61f9abae Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 20:46:06 -0500 Subject: [PATCH 05/14] Ignore .byebug_history and .ruby-version --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 31cafb5..3c5f04f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ +.byebug_history *.gem *.rbc .bundle .config +.ruby-version .yardoc Gemfile.lock InstalledFiles From b4522e87dad475bcb58b5abc073e68a7baa094b0 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Sun, 21 Nov 2021 21:07:57 -0500 Subject: [PATCH 06/14] Add more configuration for secrets --- .github/workflows/test.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f892ef6..e20843d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,9 +8,6 @@ on: pull_request: branches: - main -env: - COVERAGE: true - CODECOV_TOKEN: d7028c0e-97c5-485f-85e5-f63daabeef63 jobs: test-ruby-2-4-x: runs-on: ubuntu-latest @@ -23,6 +20,9 @@ jobs: ruby-version: 2.4 bundler-cache: true - name: Build and run tests + env: + COVERAGE: true + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler bundle install --jobs 4 --retry 3 @@ -38,6 +38,9 @@ jobs: ruby-version: 2.5 bundler-cache: true - name: Build and run tests + env: + COVERAGE: true + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler bundle install --jobs 4 --retry 3 @@ -53,6 +56,9 @@ jobs: ruby-version: 2.6 bundler-cache: true - name: Build and run tests + env: + COVERAGE: true + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler bundle install --jobs 4 --retry 3 @@ -68,6 +74,9 @@ jobs: ruby-version: 2.7 bundler-cache: true - name: Build and run tests + env: + COVERAGE: true + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler bundle install --jobs 4 --retry 3 @@ -83,6 +92,9 @@ jobs: ruby-version: 3.0 bundler-cache: true - name: Build and run tests + env: + COVERAGE: true + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler bundle install --jobs 4 --retry 3 From b052dc95f46d86c250394139dc9ce000b1e0a2ac Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 24 Nov 2021 20:28:37 -0500 Subject: [PATCH 07/14] Add TERM to the environment to get around https://github.com/jmmastey/bundler-stats/issues/18 --- .github/workflows/test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e20843d..38b8336 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler @@ -40,6 +41,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler @@ -58,6 +60,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler @@ -76,6 +79,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler @@ -94,6 +98,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | gem install bundler From 4c14732d2d4d6ff20f520c3d1e7507ee461b9303 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Tue, 30 Nov 2021 10:59:00 -0500 Subject: [PATCH 08/14] Depend on bundler-stats v2.1 or higher --- rails_stats.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails_stats.gemspec b/rails_stats.gemspec index cebd232..7c80e3f 100644 --- a/rails_stats.gemspec +++ b/rails_stats.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "rake" - spec.add_dependency "bundler-stats", ">= 2.0" + spec.add_dependency "bundler-stats", ">= 2.1" spec.add_development_dependency "bundler", ">= 1.6", "< 3.0" spec.add_development_dependency "byebug" spec.add_development_dependency "codecov" From e77f13e01966a2a59b5584d3db8378b703ebd7f4 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Tue, 30 Nov 2021 10:59:14 -0500 Subject: [PATCH 09/14] Change expectation based on new sorting for bundler-stats Now sorting is alphabetically for gems with the same number of Total Deps --- test/lib/rails_stats/code_statistics_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/lib/rails_stats/code_statistics_test.rb b/test/lib/rails_stats/code_statistics_test.rb index 5c9c07c..fd4ce3a 100644 --- a/test/lib/rails_stats/code_statistics_test.rb +++ b/test/lib/rails_stats/code_statistics_test.rb @@ -13,9 +13,9 @@ | rails_stats | 4 | 2 | | simplecov | 3 | 3 | | minitest-around | 1 | 1 | -| minitest | 0 | 0 | | bundler | 0 | 0 | | byebug | 0 | 0 | +| minitest | 0 | 0 | | minitest-spec-context | 0 | 0 | +-----------------------|------------|----------------+ \n Declared Gems 9 \n Total Gems 17 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ From 0d60a45841669a1a55a3dde48606f2f39de8bc9e Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 1 Dec 2021 11:29:03 -0500 Subject: [PATCH 10/14] Move development dependencies to Gemfile --- Gemfile | 14 ++++++++++++-- rails_stats.gemspec | 8 -------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 4cbcf1c..7928524 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,14 @@ -source 'https://rubygems.org' +source "https://rubygems.org" -# Specify your gem's dependencies in rails_stats.gemspec gemspec + +group :development, :test do + gem "bundler", ">= 1.6", "< 3.0" + gem "byebug" + gem "codecov" + gem "minitest" + gem "minitest-around" + gem "minitest-spec-context" + gem "simplecov" + gem "simplecov-console" +end diff --git a/rails_stats.gemspec b/rails_stats.gemspec index 7c80e3f..100b543 100644 --- a/rails_stats.gemspec +++ b/rails_stats.gemspec @@ -20,12 +20,4 @@ Gem::Specification.new do |spec| spec.add_dependency "rake" spec.add_dependency "bundler-stats", ">= 2.1" - spec.add_development_dependency "bundler", ">= 1.6", "< 3.0" - spec.add_development_dependency "byebug" - spec.add_development_dependency "codecov" - spec.add_development_dependency "minitest" - spec.add_development_dependency "minitest-around" - spec.add_development_dependency "minitest-spec-context" - spec.add_development_dependency "simplecov" - spec.add_development_dependency "simplecov-console" end From 9a9c55f9331d629bb0dc74efc3f785eed596ae5d Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 1 Dec 2021 11:29:15 -0500 Subject: [PATCH 11/14] Correct number of dependencies in the expectations table --- test/lib/rails_stats/code_statistics_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/lib/rails_stats/code_statistics_test.rb b/test/lib/rails_stats/code_statistics_test.rb index fd4ce3a..b51c3f8 100644 --- a/test/lib/rails_stats/code_statistics_test.rb +++ b/test/lib/rails_stats/code_statistics_test.rb @@ -8,17 +8,17 @@ +-----------------------|------------|----------------+ | Name | Total Deps | 1st Level Deps | +-----------------------|------------|----------------+ -| simplecov-console | 7 | 3 | -| codecov | 4 | 1 | +| simplecov-console | 6 | 3 | | rails_stats | 4 | 2 | -| simplecov | 3 | 3 | +| codecov | 3 | 1 | +| simplecov | 2 | 2 | | minitest-around | 1 | 1 | | bundler | 0 | 0 | | byebug | 0 | 0 | | minitest | 0 | 0 | | minitest-spec-context | 0 | 0 | +-----------------------|------------|----------------+ - \n Declared Gems 9 \n Total Gems 17 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ + \n Declared Gems 9 \n Total Gems 16 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ | Name | Lines | LOC | Classes | Methods | M/C | LOC/M | +----------------------+---------+---------+---------+---------+-----+-------+ | Channels | 8 | 8 | 2 | 0 | 0 | 0 | @@ -36,7 +36,7 @@ +----------------------+---------+---------+---------+---------+-----+-------+ Code LOC: 144 Test LOC: 0 Code to Test Ratio: 1:0.0 - EOS +EOS it "outputs useful stats for a Rails project" do root_directory = File.expand_path('../../../test/dummy', File.dirname(__FILE__)) From 3b29cebc9d45f1c3ad57e25e3770dfcf93fdedbc Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 1 Dec 2021 11:50:27 -0500 Subject: [PATCH 12/14] Use a different expectation for Ruby 2.4? --- test/lib/rails_stats/code_statistics_test.rb | 42 +++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/test/lib/rails_stats/code_statistics_test.rb b/test/lib/rails_stats/code_statistics_test.rb index b51c3f8..f9f38ab 100644 --- a/test/lib/rails_stats/code_statistics_test.rb +++ b/test/lib/rails_stats/code_statistics_test.rb @@ -8,6 +8,40 @@ +-----------------------|------------|----------------+ | Name | Total Deps | 1st Level Deps | +-----------------------|------------|----------------+ +| simplecov-console | 7 | 3 | +| codecov | 4 | 1 | +| rails_stats | 4 | 2 | +| simplecov | 3 | 3 | +| minitest-around | 1 | 1 | +| bundler | 0 | 0 | +| byebug | 0 | 0 | +| minitest | 0 | 0 | +| minitest-spec-context | 0 | 0 | ++-----------------------|------------|----------------+ + \n Declared Gems 9 \n Total Gems 17 \n Unpinned Versions 8 \n Github Refs 0 \n \n+----------------------+---------+---------+---------+---------+-----+-------+ +| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | ++----------------------+---------+---------+---------+---------+-----+-------+ +| Channels | 8 | 8 | 2 | 0 | 0 | 0 | +| Configuration | 417 | 111 | 1 | 0 | 0 | 0 | +| Controllers | 7 | 6 | 1 | 1 | 1 | 4 | +| Helpers | 3 | 3 | 0 | 0 | 0 | 0 | +| Javascripts | 27 | 7 | 0 | 0 | 0 | 0 | +| Jobs | 7 | 2 | 1 | 0 | 0 | 0 | +| Mailers | 4 | 4 | 1 | 0 | 0 | 0 | +| Models | 3 | 3 | 1 | 0 | 0 | 0 | ++----------------------+---------+---------+---------+---------+-----+-------+ +| Code | 476 | 144 | 7 | 1 | 0 | 142 | +| Tests | 0 | 0 | 0 | 0 | 0 | 0 | +| Total | 476 | 144 | 7 | 1 | 0 | 142 | ++----------------------+---------+---------+---------+---------+-----+-------+ + Code LOC: 144 Test LOC: 0 Code to Test Ratio: 1:0.0 + + EOS + + TABLE_RUBY_2_4 = <<~EOS ++-----------------------|------------|----------------+ +| Name | Total Deps | 1st Level Deps | ++-----------------------|------------|----------------+ | simplecov-console | 6 | 3 | | rails_stats | 4 | 2 | | codecov | 3 | 1 | @@ -45,7 +79,13 @@ RailsStats::CodeStatistics.new(root_directory).to_s end - assert_equal TABLE, out + expectation = if RUBY_VERSION < "2.5.0" + TABLE_RUBY_2_4 + else + TABLE + end + + assert_equal expectation, out end end end From 6ba23b4eaf0390b5e40c4cbf388e8606cbb6c9b0 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 1 Dec 2021 13:30:07 -0500 Subject: [PATCH 13/14] Add more files so that more of the library code is exercised --- test/dummy/lib/monkeypatches.rb | 1 + test/dummy/spec/models/user_spec.rb | 3 +++ test/dummy/spec/support/support_file.rb | 1 + test/dummy/test/models/user_test.rb | 2 ++ test/dummy/test/support/test_helper.rb | 1 + 5 files changed, 8 insertions(+) create mode 100644 test/dummy/lib/monkeypatches.rb create mode 100644 test/dummy/spec/models/user_spec.rb create mode 100644 test/dummy/spec/support/support_file.rb create mode 100644 test/dummy/test/models/user_test.rb create mode 100644 test/dummy/test/support/test_helper.rb diff --git a/test/dummy/lib/monkeypatches.rb b/test/dummy/lib/monkeypatches.rb new file mode 100644 index 0000000..d257d33 --- /dev/null +++ b/test/dummy/lib/monkeypatches.rb @@ -0,0 +1 @@ +puts "Monkeypatches go here" \ No newline at end of file diff --git a/test/dummy/spec/models/user_spec.rb b/test/dummy/spec/models/user_spec.rb new file mode 100644 index 0000000..4f19dbc --- /dev/null +++ b/test/dummy/spec/models/user_spec.rb @@ -0,0 +1,3 @@ +class FooBar + +end \ No newline at end of file diff --git a/test/dummy/spec/support/support_file.rb b/test/dummy/spec/support/support_file.rb new file mode 100644 index 0000000..e57d168 --- /dev/null +++ b/test/dummy/spec/support/support_file.rb @@ -0,0 +1 @@ +puts "This is a spec support file" \ No newline at end of file diff --git a/test/dummy/test/models/user_test.rb b/test/dummy/test/models/user_test.rb new file mode 100644 index 0000000..d3877b5 --- /dev/null +++ b/test/dummy/test/models/user_test.rb @@ -0,0 +1,2 @@ +class UserTest +end \ No newline at end of file diff --git a/test/dummy/test/support/test_helper.rb b/test/dummy/test/support/test_helper.rb new file mode 100644 index 0000000..44cc233 --- /dev/null +++ b/test/dummy/test/support/test_helper.rb @@ -0,0 +1 @@ +puts "This is a test support file" \ No newline at end of file From 601594d7fb768e110298a30f26c0291be32ac6b8 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Wed, 1 Dec 2021 13:46:04 -0500 Subject: [PATCH 14/14] Corrected stats for test/dummy --- test/lib/rails_stats/code_statistics_test.rb | 24 ++++++++---- test/lib/rails_stats/json_formatter_test.rb | 40 ++++++++++++++++++-- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/test/lib/rails_stats/code_statistics_test.rb b/test/lib/rails_stats/code_statistics_test.rb index f9f38ab..a44b49e 100644 --- a/test/lib/rails_stats/code_statistics_test.rb +++ b/test/lib/rails_stats/code_statistics_test.rb @@ -27,14 +27,18 @@ | Helpers | 3 | 3 | 0 | 0 | 0 | 0 | | Javascripts | 27 | 7 | 0 | 0 | 0 | 0 | | Jobs | 7 | 2 | 1 | 0 | 0 | 0 | +| Libraries | 1 | 1 | 0 | 0 | 0 | 0 | | Mailers | 4 | 4 | 1 | 0 | 0 | 0 | +| Model Tests | 5 | 4 | 2 | 0 | 0 | 0 | | Models | 3 | 3 | 1 | 0 | 0 | 0 | +| Spec Support | 1 | 1 | 0 | 0 | 0 | 0 | +| Test Support | 1 | 1 | 0 | 0 | 0 | 0 | +----------------------+---------+---------+---------+---------+-----+-------+ -| Code | 476 | 144 | 7 | 1 | 0 | 142 | -| Tests | 0 | 0 | 0 | 0 | 0 | 0 | -| Total | 476 | 144 | 7 | 1 | 0 | 142 | +| Code | 477 | 145 | 7 | 1 | 0 | 143 | +| Tests | 7 | 6 | 2 | 0 | 0 | 0 | +| Total | 484 | 151 | 9 | 1 | 0 | 149 | +----------------------+---------+---------+---------+---------+-----+-------+ - Code LOC: 144 Test LOC: 0 Code to Test Ratio: 1:0.0 + Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 EOS @@ -61,14 +65,18 @@ | Helpers | 3 | 3 | 0 | 0 | 0 | 0 | | Javascripts | 27 | 7 | 0 | 0 | 0 | 0 | | Jobs | 7 | 2 | 1 | 0 | 0 | 0 | +| Libraries | 1 | 1 | 0 | 0 | 0 | 0 | | Mailers | 4 | 4 | 1 | 0 | 0 | 0 | +| Model Tests | 5 | 4 | 2 | 0 | 0 | 0 | | Models | 3 | 3 | 1 | 0 | 0 | 0 | +| Spec Support | 1 | 1 | 0 | 0 | 0 | 0 | +| Test Support | 1 | 1 | 0 | 0 | 0 | 0 | +----------------------+---------+---------+---------+---------+-----+-------+ -| Code | 476 | 144 | 7 | 1 | 0 | 142 | -| Tests | 0 | 0 | 0 | 0 | 0 | 0 | -| Total | 476 | 144 | 7 | 1 | 0 | 142 | +| Code | 477 | 145 | 7 | 1 | 0 | 143 | +| Tests | 7 | 6 | 2 | 0 | 0 | 0 | +| Total | 484 | 151 | 9 | 1 | 0 | 149 | +----------------------+---------+---------+---------+---------+-----+-------+ - Code LOC: 144 Test LOC: 0 Code to Test Ratio: 1:0.0 + Code LOC: 145 Test LOC: 6 Code to Test Ratio: 1:0.0 EOS diff --git a/test/lib/rails_stats/json_formatter_test.rb b/test/lib/rails_stats/json_formatter_test.rb index f358e18..74a153d 100644 --- a/test/lib/rails_stats/json_formatter_test.rb +++ b/test/lib/rails_stats/json_formatter_test.rb @@ -6,6 +6,14 @@ describe "#result" do JSON_STRING = <<~EOS [{ + "name": "Libraries", + "lines": "1", + "loc": "1", + "classes": "0", + "methods": "0", + "m_over_c": "0", + "loc_over_m": "0" + }, { "name": "Mailers", "lines": "4", "loc": "4", @@ -13,6 +21,14 @@ "methods": "0", "m_over_c": "0", "loc_over_m": "0" + }, { + "name": "Model Tests", + "lines": "5", + "loc": "4", + "classes": "2", + "methods": "0", + "m_over_c": "0", + "loc_over_m": "0" }, { "name": "Models", "lines": "3", @@ -69,14 +85,30 @@ "methods": "0", "m_over_c": "0", "loc_over_m": "0" + }, { + "name": "Spec Support", + "lines": "1", + "loc": "1", + "classes": "0", + "methods": "0", + "m_over_c": "0", + "loc_over_m": "0" + }, { + "name": "Test Support", + "lines": "1", + "loc": "1", + "classes": "0", + "methods": "0", + "m_over_c": "0", + "loc_over_m": "0" }, { "name": "Total", - "lines": "476", - "loc": "144", - "classes": "7", + "lines": "484", + "loc": "151", + "classes": "9", "methods": "1", "m_over_c": "0", - "loc_over_m": "142", + "loc_over_m": "149", "code_to_test_ratio": "0.0", "total": true }]