Sha256: 2b11f8f1f701d7767649dff62f941ba9b220da997aff47c7bbc2a9245a9f4a3f

Contents?: true

Size: 1012 Bytes

Versions: 25

Compression:

Stored size: 1012 Bytes

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
    
    should_validate_presence_of :host, :ip_address, :port, :enabled_actions
    
    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

25 entries across 25 versions & 3 rubygems

Version Path
documentcloud-cloud-crowd-0.2.1 test/unit/test_node_record.rb
documentcloud-cloud-crowd-0.2.2 test/unit/test_node_record.rb
documentcloud-cloud-crowd-0.2.3 test/unit/test_node_record.rb
cloud-crowd-0.6.2 test/unit/test_node_record.rb
cloud-crowd-0.6.1 test/unit/test_node_record.rb
cloud-crowd-0.6.0 test/unit/test_node_record.rb
cloud-crowd-0.5.2 test/unit/test_node_record.rb
cloud-crowd-0.5.0 test/unit/test_node_record.rb
cloud-crowd-0.4.1 test/unit/test_node_record.rb
cloud-crowd-0.4.0 test/unit/test_node_record.rb
mooktakim-cloud-crowd-0.3.5 test/unit/test_node_record.rb
mooktakim-cloud-crowd-0.3.4 test/unit/test_node_record.rb
cloud-crowd-0.3.3 test/unit/test_node_record.rb
cloud-crowd-0.3.2 test/unit/test_node_record.rb
cloud-crowd-0.3.1 test/unit/test_node_record.rb
cloud-crowd-0.3.0 test/unit/test_node_record.rb
cloud-crowd-0.2.9 test/unit/test_node_record.rb
cloud-crowd-0.2.8 test/unit/test_node_record.rb
cloud-crowd-0.2.7 test/unit/test_node_record.rb
cloud-crowd-0.2.6 test/unit/test_node_record.rb