Sha256: 113e773d64efa1eafb0f36334fb3386ba6241ac8d78baa6b625eaa78a53a12f1

Contents?: true

Size: 1.65 KB

Versions: 3

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

require_relative "../spec_helper"

module Apkstats::Entity
  describe Apkstats::Entity::ApkInfo do
    let(:command_values) do
      {
          file_size: 100,
          download_size: 150,
          required_features: Features.new([
                                            Feature.new("feature1"),
                                            Feature.new("feature2"),
                                          ]),
          non_required_features: Features.new([
                                                Feature.new("feature3", not_required: true),
                                                Feature.new("feature4", not_required: true),
                                              ]),
          permissions: Permissions.new([
                                         Permission.new("permission1"),
                                         Permission.new("permission2", max_sdk: "23"),
                                       ]),
          min_sdk: "16",
          target_sdk: "26",
          method_reference_count: 20_000,
          dex_count: 1,
      }
    end

    let(:command) { Apkstats::Stub::Command.new(command_values) }

    it "precondition for this spec" do
      expect(command_values).to include(*ApkInfo::KEYS)
    end

    it "read values of a command" do
      apk_info = ApkInfo.new(command, "apk filepath")

      ApkInfo::KEYS.each do |key|
        expect(apk_info.send(key)).to eq(command_values[key])
        expect(apk_info[key]).to eq(command_values[key])
      end
    end

    it "to_h" do
      apk_info = ApkInfo.new(command, "apk filepath")

      expect(apk_info.to_h).to include(command_values)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
danger-apkstats-0.3.1 spec/entity/apk_info_spec.rb
danger-apkstats-0.3.0 spec/entity/apk_info_spec.rb
danger-apkstats-0.2.0 spec/entity/apk_info_spec.rb