upr.git  about / heads / tags
Upload Progress for Rack
blob d62d8696e812b29f9ba7f5eacb0d6924a3c5dcdd 941 bytes (raw)
$ git show HEAD:examples/rails_app-2.3.4/test/unit/upr_status_test.rb	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
require 'test_helper'

class UprStatusTest < ActiveSupport::TestCase
  # Replace this with your real tests.
  test "start with length" do
    assert_kind_of UprStatus, UprStatus.start('abcde', 5)
  end

  test "start without length" do
    assert_kind_of UprStatus, UprStatus.start('abcde', nil)
  end

  test "incr from start" do
    assert_nothing_raised { UprStatus.incr('two', 2) }
    assert_equal 2, UprStatus.read('two').seen
  end

  test "errored" do
    assert UprStatus.read('errored').error?
  end

  test "errored incr no-op" do
    assert UprStatus.incr('errored', 6)
    assert UprStatus.read('errored').error?
  end

  test "finish" do
    assert_kind_of UprStatus, UprStatus.finish('two')
    assert UprStatus.read('two').done?
  end

  test "done?" do
    assert UprStatus.read('done').done?
  end

  test "error!" do
    assert_kind_of UprStatus, UprStatus.error!('two')
    assert UprStatus.read('two').error?
  end

end

git clone https://yhbt.net/upr.git