Module: FedoraLens::LensTests
- Defined in:
- lib/fedora_lens/lens_tests.rb
Instance Method Summary collapse
-
#test_lens(lens, source, value) {|converter| ... } ⇒ Object
See page 6 of the manual for the Harmony language for a description on how lenses work www.seas.upenn.edu/~harmony/manual.pdf.
- #test_lens_create_get(lens, value) ⇒ Object
- #test_lens_get_put(lens, source) ⇒ Object
- #test_lens_put_get(lens, source, value) ⇒ Object
Instance Method Details
#test_lens(lens, source, value) {|converter| ... } ⇒ Object
See page 6 of the manual for the Harmony language for a description on how lenses work www.seas.upenn.edu/~harmony/manual.pdf
21 22 23 24 25 |
# File 'lib/fedora_lens/lens_tests.rb', line 21 def test_lens(lens, source, value, &block) test_lens_get_put(lens, source, &block) test_lens_put_get(lens, source, value, &block) test_lens_create_get(lens, value, &block) end |
#test_lens_create_get(lens, value) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/fedora_lens/lens_tests.rb', line 49 def test_lens_create_get(lens, value) it "is well-behaved (CreateGet: get(create(value)) == value)" do created = lens.get(lens.create(value)) if block_given? yield(created).should eq yield(value) else created.should eq value end end end |
#test_lens_get_put(lens, source) ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fedora_lens/lens_tests.rb', line 27 def test_lens_get_put(lens, source) it "is well-behaved (GetPut: put(source, get(source)) == source)" do converted = lens.put(source, lens.get(source)) if block_given? yield(converted).should eq yield(source) else converted.should eq source end end end |
#test_lens_put_get(lens, source, value) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fedora_lens/lens_tests.rb', line 38 def test_lens_put_get(lens, source, value) it "is well-behaved (PutGet: get(put(source, value)) == value)" do converted = lens.get(lens.put(source, value)) if block_given? yield(converted).should eq yield(value) else converted.should eq value end end end |