Sha256: 3034ff216dca8d60805d2cb4b66ca1292af9174072710fc21fc8f8de0444f90d

Contents?: true

Size: 654 Bytes

Versions: 7

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true
require 'test_helper'
require 'rubycritic/generators/html/turbulence'

describe RubyCritic::Turbulence do
  describe '::data' do
    it 'returns json data that maps pathname, churn and complexity to name, x and y' do
      files = [AnalysedModuleDouble.new(name: 'Foo', churn: 1, complexity: 2)]
      turbulence_data = RubyCritic::Turbulence.data(files)
      instance_parsed_json = JSON.parse(turbulence_data).first
      instance_parsed_json['name'].must_equal 'Foo'
      instance_parsed_json['x'].must_equal 1
      instance_parsed_json['y'].must_equal 2
    end
  end
end

class AnalysedModuleDouble < OpenStruct; end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubycritic-3.2.0 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-3.1.3 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-3.1.2 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-3.1.1 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-3.1.0 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-3.0.0 test/lib/rubycritic/generators/turbulence_test.rb
rubycritic-2.9.4 test/lib/rubycritic/generators/turbulence_test.rb