| 1 |
|
| 2 |
|
| 3 |
class Plugin |
| 4 |
module GUI; end end |
| 5 |
|
| 6 |
require 'test/unit' |
| 7 |
require File.expand_path(__dir__ + '/../../../lib/test_unit_extensions') |
| 8 |
require File.expand_path(__dir__ + '/../cuscadable') |
| 9 |
require File.expand_path(__dir__ + '/../../../utils') |
| 10 |
|
| 11 |
class TC_PluginGUICuscadable < Test::Unit::TestCase |
| 12 |
|
| 13 |
def setup |
| 14 |
@klass = Class.new{ |
| 15 |
include Plugin::GUI::Cuscadable |
| 16 |
} |
| 17 |
end |
| 18 |
|
| 19 |
must "can read name and slug" do |
| 20 |
cuscadable = @klass.instance(:slug, "name") |
| 21 |
assert_equal(:slug, cuscadable.slug) |
| 22 |
assert_equal("name", cuscadable.name) |
| 23 |
end |
| 24 |
|
| 25 |
must "cannot create class via new method" do |
| 26 |
assert_raise(NoMethodError){@klass.new(:slug, "name")} |
| 27 |
end |
| 28 |
|
| 29 |
must "can get next item" do |
| 30 |
first = @klass.instance(:first, "tab 1") |
| 31 |
second = @klass.instance(:second, "tab 2") |
| 32 |
third = @klass.instance(:third, "tab 3") |
| 33 |
assert_equal(true, first.next == second) |
| 34 |
assert_equal(true, second.next == third) |
| 35 |
assert_equal(true, third.next == first) |
| 36 |
end |
| 37 |
|
| 38 |
must "can get prev item" do |
| 39 |
first = @klass.instance(:first, "tab 1") |
| 40 |
second = @klass.instance(:second, "tab 2") |
| 41 |
third = @klass.instance(:third, "tab 3") |
| 42 |
assert_equal(true, first.prev == third) |
| 43 |
assert_equal(true, second.prev == first) |
| 44 |
assert_equal(true, third.prev == second) |
| 45 |
end |
| 46 |
|
| 47 |
end |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|