Guest User

Untitled

a guest
Feb 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. require 'test_helper'
  2.  
  3. class OperationTest < ActiveSupport::TestCase
  4.  
  5. context "A valid operation" do
  6.  
  7. setup do
  8. @operation = Factory(:operation_one)
  9. end
  10.  
  11. should_require_attributes :description, :value
  12.  
  13. should "return its value" do
  14. assert_equal 5000, @operation.value
  15. end
  16.  
  17. should "return its category" do
  18. assert_equal 'Proventos', @operation.category
  19. end
  20.  
  21. context "with value greater than zero" do
  22. should "be income" do
  23. operation = Factory(:operation_one)
  24. assert operation.income?
  25. end
  26. end
  27.  
  28. context "with value less than zero" do
  29. should "be expense" do
  30. operation = Factory(:operation_two)
  31. assert operation.expense?
  32. end
  33. end
  34.  
  35. end
  36.  
  37. end
Add Comment
Please, Sign In to add comment