PageRenderTime 36ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/jruby-1.1.6RC1/lib/ruby/gems/1.8/gems/rspec-1.1.11/stories/resources/test/spec_and_test_together.rb

https://bitbucket.org/nicksieger/advent-jruby
Ruby | 57 lines | 44 code | 12 blank | 1 comment | 6 complexity | 5e682a588103a52521329863f059808b MD5 | raw file
Possible License(s): CPL-1.0, AGPL-1.0, LGPL-2.1, JSON
  1. $:.push File.join(File.dirname(__FILE__), *%w[.. .. .. lib])
  2. require 'spec'
  3. # TODO - this should not be necessary, ay?
  4. require 'spec/interop/test'
  5. describe "An Example" do
  6. it "should pass with assert" do
  7. assert true
  8. end
  9. it "should fail with assert" do
  10. assert false
  11. end
  12. it "should pass with should" do
  13. 1.should == 1
  14. end
  15. it "should fail with should" do
  16. 1.should == 2
  17. end
  18. end
  19. class ATest < Test::Unit::TestCase
  20. def test_should_pass_with_assert
  21. assert true
  22. end
  23. def test_should_fail_with_assert
  24. assert false
  25. end
  26. def test_should_pass_with_should
  27. 1.should == 1
  28. end
  29. def test_should_fail_with_should
  30. 1.should == 2
  31. end
  32. def setup
  33. @from_setup ||= 3
  34. @from_setup += 1
  35. end
  36. def test_should_fail_with_setup_method_variable
  37. @from_setup.should == 40
  38. end
  39. before do
  40. @from_before = @from_setup + 1
  41. end
  42. def test_should_fail_with_before_block_variable
  43. @from_before.should == 50
  44. end
  45. end