Sha256: 243539bc00bbabc88fa19117af1e8c0577d7d13041af9a5333c41beec60e8de3

Contents?: true

Size: 869 Bytes

Versions: 4

Compression:

Stored size: 869 Bytes

Contents

require 'spec_helper'

describe ProjectCatalog do

  subject {
    ProjectCatalog.new.
        add_project(Project.new(name: '1').add_metric(NumberMetric.new(name: 'length')).edit_property('length', 3, stub)).
        add_project(Project.new(name: '3').add_metric(NumberMetric.new(name: 'length')).edit_property('length', 2, stub)).
        add_project(Project.new(name: '2').add_metric(NumberMetric.new(name: 'length')).edit_property('length', 1, stub))
  }

  it 'searches projects by simple criteria' do
    subject.projects('property("length").value >= 2').should have_exactly(2).items
  end

  it 'searches projects by complex criteria' do
    subject.projects('property("length").value == 2 || property("length").value == 3').should have_exactly(2).items
  end

  it 'orders projects by name' do
    subject.projects.collect(&:name).should == %w(1 2 3)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
techcor-0.0.4 spec/lib/project_catalog_spec.rb
techcor-0.0.3 spec/lib/project_catalog_spec.rb
techcor-0.0.2 spec/lib/project_catalog_spec.rb
techcor-0.0.1 spec/lib/project_catalog_spec.rb