Sha256: 75046a763065b84aacd72402fa84f363cba40f2d069a4303d4c5d210b39dd9de
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
require 'spec_helper' require 'natives/catalog/selector' describe Natives::Catalog::Selector do describe "#value_for" do let(:selector) do Natives::Catalog::Selector.new({ apt: { default: 'apt-default', ubuntu: { '12.10' => 'ubuntu-12.10', %w(10.10 10.10.1 10.10.2) => %w(ubuntu-10.10s), 'default' => %w(ubuntu-default1 ubuntu-default2) } }, homebrew: { mac_os_x: { '10' => 'foo' } } }) end it "returns values for a specific platform version" do expect(selector.values_for(:apt, :ubuntu, :'12.10')).to eq( ['ubuntu-12.10']) end it "returns a value for a specific platform version in version group" do expect(selector.values_for(:apt, :ubuntu, :'10.10.1')).to eq( ['ubuntu-10.10s']) end it "returns default version values when no matching platform version" do expect(selector.values_for('apt', 'ubuntu', '13')).to eq( ['ubuntu-default1', 'ubuntu-default2']) end it "returns default value when not matching platform" do expect(selector.values_for(:apt, :foo, :'13')).to eq( ['apt-default']) end it "returns empty list if there is no matching package provider" do expect(selector.values_for(:notfound, :ubuntu, '10')).to eq([]) end it "returns nil if there is no default and no matching platform" do expect(selector.values_for(:homebrew, :notfound, 1)).to eq([]) end it "returns nil if there is no default and no matching platform version" do expect(selector.values_for(:homebrew, :mac_os_x, '999')).to eq([]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
natives-0.6.0 | spec/natives/catalog/selector_spec.rb |