Sha256: 5adddec2c928bff58c700916ab451d779a6a27994daa37ceb8013790300705cc

Contents?: true

Size: 852 Bytes

Versions: 27

Compression:

Stored size: 852 Bytes

Contents

require File.join(File.dirname(__FILE__), '../test_helper')

describe HammerCLI::Output::FieldFilter do

  let(:fields) { [
    Fields::Field.new(:label => "field"),
    Fields::Collection.new(:label => "collection"),
    Fields::Id.new(:label => "id")
  ] }
  let(:field_labels) { fields.map(&:label).sort }

  it "lets all fields go by default" do
    f = HammerCLI::Output::FieldFilter.new
    f.filter(fields).map(&:label).sort.must_equal ["field", "collection", "id"].sort
  end

  it "filters fields by class" do
    f = HammerCLI::Output::FieldFilter.new([Fields::Id])
    f.filter(fields).map(&:label).sort.must_equal ["field", "collection"].sort
  end

  it "filters fields by superclass" do
    f = HammerCLI::Output::FieldFilter.new([Fields::ContainerField])
    f.filter(fields).map(&:label).sort.must_equal ["field", "id"].sort
  end

end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
hammer_cli-0.17.1 test/unit/output/field_filter_test.rb
hammer_cli-0.17.0 test/unit/output/field_filter_test.rb
hammer_cli-0.16.0 test/unit/output/field_filter_test.rb
hammer_cli-0.15.1 test/unit/output/field_filter_test.rb
hammer_cli-0.15.0 test/unit/output/field_filter_test.rb
hammer_cli-0.14.0 test/unit/output/field_filter_test.rb
hammer_cli-0.13.1 test/unit/output/field_filter_test.rb
hammer_cli-0.13.0 test/unit/output/field_filter_test.rb
hammer_cli-0.12.0 test/unit/output/field_filter_test.rb
hammer_cli-0.11.0 test/unit/output/field_filter_test.rb
hammer_cli-0.10.2 test/unit/output/field_filter_test.rb
hammer_cli-0.10.1 test/unit/output/field_filter_test.rb
hammer_cli-0.10.0 test/unit/output/field_filter_test.rb
hammer_cli-0.9.0 test/unit/options/field_filter_test.rb
hammer_cli-0.8.0 test/unit/options/field_filter_test.rb
hammer_cli-0.7.0 test/unit/options/field_filter_test.rb
hammer_cli-0.6.1 test/unit/options/field_filter_test.rb
hammer_cli-0.6.0 test/unit/options/field_filter_test.rb
hammer_cli-0.5.1 test/unit/options/field_filter_test.rb
hammer_cli-0.4.0 test/unit/options/field_filter_test.rb