Sha256: a37109b1ad3a99e3d40cc782ffcb884d2f2a17cedd2b639d5d9f6c84d780ba1a

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 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",
      }
    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.1.2 spec/entity/apk_info_spec.rb
danger-apkstats-0.1.1.pre.1 spec/entity/apk_info_spec.rb
danger-apkstats-0.1.0 spec/entity/apk_info_spec.rb