Sha256: d849793f3be72e8b5e0dccddd22b93471824323e3beab78ff3466a4f47bfc64a

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 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").last_value >= 2').should have_exactly(2).items
  end

  it 'searches projects by complex criteria' do
    subject.projects('property("length").last_value == 2 || property("length").last_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

6 entries across 6 versions & 1 rubygems

Version Path
techcor-0.0.10 spec/lib/project_catalog_spec.rb
techcor-0.0.9 spec/lib/project_catalog_spec.rb
techcor-0.0.8 spec/lib/project_catalog_spec.rb
techcor-0.0.7 spec/lib/project_catalog_spec.rb
techcor-0.0.6 spec/lib/project_catalog_spec.rb
techcor-0.0.5 spec/lib/project_catalog_spec.rb