Guest User

Untitled

a guest
Jun 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. require File.dirname(__FILE__) + '/../spec_helper'
  2. require 'task'
  3.  
  4. describe Task do
  5.  
  6. before(:each) do
  7. @task = Task.new valid_task_hash
  8.  
  9. @root = mock_model(Task)
  10. @root.stub!(:parent_id).and_return(nil)
  11. @root.stub!(:id).and_return(1)
  12.  
  13. @sub = mock_model(Task)
  14. @sub.stub!(:id).and_return(2)
  15. @sub.stub!(:parent_id).and_return(1)
  16.  
  17. end
  18.  
  19. it "should require a name" do
  20. @task.name = ''
  21. @task.should_not be_valid
  22. end
  23.  
  24. it "should have all tasks as children which have the current task id as parent_id"
  25.  
  26.  
  27.  
  28. def valid_task_hash
  29. {:name => 'task name'}
  30. end
  31. end
Add Comment
Please, Sign In to add comment