<commit_before>require "#{File.dirname(__FILE__)}/support/ms_spec_helper.rb"
require 'rubygems'
require 'lebowski'


describe "MySystem" do
  before(:all) do
    start_testing_servers
    @test = new_test
    @canvas = @test['canvas']
    @node_0 = @canvas.nodes[0]
    @node_1 = @canvas.nodes[1]
    @node_2 = @canvas.nodes[2]
    @palette = @test['palette']
    @add_bulb = @palette.addBulb
  end

  after(:all) do
    stop_testing_servers
  end

  # This seems to prove that we have the chrome, but I think it just proves
  # that there are views in the appropriate places in the view stack
  it "will have two chrome views supporting the canvas" do
    @canvas.parentView.childViews[0].should_not be nil
    @canvas.parentView.childViews.count.should be 3 # StoryView, divider, Canvas
    @canvas.parentView.childViews[0].layout.top.should be 0 # StoryView at the top
    @canvas.parentView.childViews[0].layout.left.should be 0
    @canvas.parentView.parentView.childViews[0].should_not be nil
    @canvas.parentView.parentView.childViews.count.should be 3 # Palette, divider, story-and-canvas
    @canvas.parentView.parentView.childViews[0].layout.top.should be 0
    @canvas.parentView.parentView.childViews[0].layout.left.should be 0
  end
  
  it "will have at least one add-node button in the palette" do
    @palette.childViews.count.should be >1 # Label view at top shouldn't count
  end

  it "will have at least 3 nodes loaded from the fixtures" do
    @canvas.should_not be_empty
    @canvas.nodes.count.should be 3
  end
      
  it "will verify that there are 3 nodes on the canvas" do
    @node_0.should be_a_kind_of NodeView
    @node_0.should have_node_item_view_support
  end
  
  it "will click each of the nodes, one by one" do
    @canvas.nodes.each do |node|
      node.click
      node.should be_selected
    end
  end

  it "will drag the first node to coordinates (400, 150)" do
    @node_0.drag_in_canvas(400, 150)
  end
  
  it "will drag the second node below the first node (by the index)" do 
    @node_1.drag_below 0
    @node_1.should be_positioned_below 0
  end

  it "will drag the third node to the right of the second node (by index)" do
    @node_2.drag_right_of 1
    @node_2.should be_positioned_right_of 1
  end

  # tricky & brittle! relies on fixture state
  # as of 17 August 2010
  it "some nodes loaded from fixtures should be linked" do
    @node_0.should be_linked_to 1
    @node_1.should be_linked_to 0
    
    @node_0.should be_linked_to 2
    @node_2.should be_linked_to 0

    @node_1.should_not be_linked_to 2
    @node_2.should_not be_linked_to 1
  end

  it "will link node_1 to node_2" do      
    @node_2.terminal_by_name('a').link_to @node_1.terminal_by_name('a'), 8, 8 
    @node_2.should be_linked_to 1
  end

  it "will create a new node" do
    @add_bulb.drag_in_canvas(300, 200)
    @canvas.nodes.count.should be 4
  end

end

<commit_msg>Adding stub tests to finish Lebowski coverage; position adjustment check works, others don't or are stubs.<commit_after>require "#{File.dirname(__FILE__)}/support/ms_spec_helper.rb"
require 'rubygems'
require 'lebowski'


describe "MySystem" do
  before(:all) do
    start_testing_servers
    @test = new_test
    @canvas = @test['canvas']
    @node_0 = @canvas.nodes[0]
    @node_1 = @canvas.nodes[1]
    @node_2 = @canvas.nodes[2]
    @palette = @test['palette']
    @add_bulb = @palette.addBulb
  end

  after(:all) do
    stop_testing_servers
  end

  # This seems to prove that we have the chrome, but I think it just proves
  # that there are views in the appropriate places in the view stack
  it "will have two chrome views supporting the canvas" do
    @canvas.parentView.childViews[0].should_not be nil
    @canvas.parentView.childViews.count.should be 3 # StoryView, divider, Canvas
    @canvas.parentView.childViews[0].layout.top.should be 0 # StoryView at the top
    @canvas.parentView.childViews[0].layout.left.should be 0
    @canvas.parentView.parentView.childViews[0].should_not be nil
    @canvas.parentView.parentView.childViews.count.should be 3 # Palette, divider, story-and-canvas
    @canvas.parentView.parentView.childViews[0].layout.top.should be 0
    @canvas.parentView.parentView.childViews[0].layout.left.should be 0
  end
  
  it "will have at least one add-node button in the palette" do
    @palette.childViews.count.should be >1 # Label view at top shouldn't count
  end

  it "will have at least 3 nodes loaded from the fixtures" do
    @canvas.should_not be_empty
    @canvas.nodes.count.should be 3
  end
      
  it "will verify that there are 3 nodes on the canvas" do
    @node_0.should be_a_kind_of NodeView
    @node_0.should have_node_item_view_support
  end
  
  it "will click each of the nodes, one by one" do
    @canvas.nodes.each do |node|
      node.click
      node.should be_selected
    end
  end

  it "will drag the first node to coordinates (400, 150)" do
    @node_0.drag_in_canvas(400, 150)
  end
  
  it "will drag the second node below the first node (by the index)" do 
    @node_1.drag_below 0
    @node_1.should be_positioned_below 0
  end

  it "will drag the third node to the right of the second node (by index)" do
    @node_2.drag_right_of 1
    @node_2.should be_positioned_right_of 1
  end

  # tricky & brittle! relies on fixture state
  # as of 17 August 2010
  it "some nodes loaded from fixtures should be linked" do
    @node_0.should be_linked_to 1
    @node_1.should be_linked_to 0
    
    @node_0.should be_linked_to 2
    @node_2.should be_linked_to 0

    @node_1.should_not be_linked_to 2
    @node_2.should_not be_linked_to 1
  end
  
  it "will click each link, one by one" do
    @canvas.links.each do |link|
      link.click
      link.should be_selected
    end
  end

  it "will link node_1 to node_2" do      
    @node_2.terminal_by_name('a').link_to @node_1.terminal_by_name('a'), 8, 8 
    @node_2.should be_linked_to 1
  end

  it "will delete the newly-created link" do
    # Count links
    # Click the link to select it
    # Delete the selected link
    # Count of links should be reduced by one
  end

  it "will create a new node" do
    @add_bulb.drag_in_canvas(300, 200)
    @canvas.nodes.count.should be 4
  end

  it "will appropriately adjust the location of the new node" do
    @canvas.nodes[3].layout.top.should be 73 # 200 minus the 127 of the story view
    @canvas.nodes[3].layout.left.should be 173 # 300 minus the 127 of the palette view
  end
end


{'fraction_non_alphanumeric': 0.08149064481212309, 'fraction_numerical': 0.02706046080098964, 'mean_word_length': 3.2580645161290325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3703877', 'n_tokens_mistral': 2319, 'n_tokens_neox': 2158, 'n_words': 704}