Sha256: ed2d772111b564cff45beb8b11fa9f6473c049439acb24c86ca12fe464ab3fc5

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

require 'test_helper'

class NodeRecordTest < Test::Unit::TestCase

  context "A NodeRecord" do
        
    setup do
      @node = CloudCrowd::NodeRecord.make!
    end
    
    subject { @node }
    
    should have_many :work_units
    
    [:host, :ip_address, :port, :enabled_actions].each do |field|
      should validate_presence_of(field)
    end
    
    should "be available" do
      assert NodeRecord.available.map(&:id).include? @node.id
    end
    
    should "know its enabled actions" do
      assert @node.actions.include? 'graphics_magick'
      assert @node.actions.include? 'word_count'
    end
    
    should "know if the node is busy" do
      assert !@node.busy?
      assert @node.display_status == 'available'
      (@node.max_workers + 1).times { WorkUnit.make!(:node_record => @node) }
      assert @node.busy?
      assert @node.display_status == 'busy'
      @node.release_work_units
      assert !@node.busy?
    end
    
    should "be reachable at a URL" do
      assert !!URI.parse(@node.url)
    end
    
  end
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cloud-crowd-0.7.2 test/unit/test_node_record.rb
cloud-crowd-0.7.2.beta test/unit/test_node_record.rb
cloud-crowd-0.7.2.pre3 test/unit/test_node_record.rb
cloud-crowd-0.7.2.pre2 test/unit/test_node_record.rb
cloud-crowd-0.7.2.pre test/unit/test_node_record.rb
cloud-crowd-0.7.1 test/unit/test_node_record.rb
cloud-crowd-0.7.0 test/unit/test_node_record.rb
cloud-crowd-0.7.0.pre test/unit/test_node_record.rb