Sha256: 78b769e9309156eb4e1c6f39ae80c806b2703ee86664ef4582beb54af7cabeb5

Contents?: true

Size: 1.22 KB

Versions: 59

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/xruby'
      )

      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

59 entries across 59 versions & 1 rubygems

Version Path
trackler-2.2.1.20 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.19 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.18 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.17 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.16 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.15 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.14 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.13 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.12 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.11 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.10 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.9 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.8 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.7 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.6 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.5 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.4 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.3 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.2 tracks/ruby/test/generator/files/metadata_files_test.rb
trackler-2.2.1.1 tracks/ruby/test/generator/files/metadata_files_test.rb