Sha256: e9fb368d3407a3ae18f342b440e8df8a521ce69bbaf0f81edaffc3cc211b8f2c

Contents?: true

Size: 1.22 KB

Versions: 116

Compression:

Stored size: 1.22 KB

Contents

require_relative '../../test_helper.rb'
module Generator
  module Files
    class MetadataFilesTest < Minitest::Test
      FixturePaths = Paths.new(
        metadata: 'test/fixtures/metadata',
        track: 'test/fixtures/ruby'
      )

      class TestMetadataFiles
        def initialize
          @paths = FixturePaths
          @slug = 'alpha'
        end
        attr_reader :paths, :slug
        include MetadataFiles
      end

      def test_canonical_data
        subject = TestMetadataFiles.new
        assert_instance_of CanonicalDataFile, subject.canonical_data
      end
    end

    class CanonicalDataFileTest < Minitest::Test
      def test_version_for_file_that_does_not_exist
        subject = CanonicalDataFile.new(filename: 'nonexistant')
        assert_nil subject.version
      end

      def test_version
        subject = CanonicalDataFile.new(filename: 'has version key')
        Files.stub(:read, '{"version": "1.2.3"}' ) do
          assert_equal "1.2.3", subject.version
        end
      end

      def test_version_not_present
        subject = CanonicalDataFile.new(filename: 'no version key')
        Files.stub(:read, '{ "json": true }' ) do
          assert_nil subject.version
        end
      end
    end
  end
end

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
trackler-2.2.1.137 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.136 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.135 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.134 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.133 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.132 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.131 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.130 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.129 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.128 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.127 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.126 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.125 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.124 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.123 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.122 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.121 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.120 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.119 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.118 tracks/ruby/test/generator/files/metadata_files_test.rb