Sha256: 45cc755933f0cdc113b298e50405521c0e77973242ab3ab3dcb968160bd6a2b5

Contents?: true

Size: 852 Bytes

Versions: 2

Compression:

Stored size: 852 Bytes

Contents

require 'test_helper'

class TestToriDefine < Test::Unit::TestCase
  class Dammy
    extend Tori::Define
    tori :test_image
    bird = "piyo"
    tori :def_image do |model|
      "foo/#{__tori__}/bar/#{bird}"
    end
  end

  class Uploader
  end

  test "#tori" do
    assert_respond_to Dammy.new, :test_image
    assert_respond_to Dammy.new, :test_image=
    assert_respond_to Dammy.new, :def_image
    assert_respond_to Dammy.new, :def_image=
  end

  test "defined methods" do
    dammy = Dammy.new
    assert_instance_of Tori::File, dammy.test_image
    assert_instance_of Uploader, dammy.test_image = Uploader.new
    assert_instance_of Tori::File, dammy.test_image
  end

  test "define name" do
    dammy = Dammy.new
    assert_instance_of Tori::File, dammy.def_image
    assert { "foo/def_image/bar/piyo" == dammy.def_image.name }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tori-0.4.1 test/test_tori_define.rb
tori-0.4.0 test/test_tori_define.rb