Sha256: 44ed335135859115358989f7fdd660caaf6aa18e338253abcc0bc2408d11171b

Contents?: true

Size: 954 Bytes

Versions: 8

Compression:

Stored size: 954 Bytes

Contents

require "test_helper" 

require "sup/horizontal_selector"

describe Redwood::HorizontalSelector do
  let(:values) { %w[foo@example.com bar@example.com] }
  let(:strange_value) { "strange@example.com" }

  before do
    @selector = Redwood::HorizontalSelector.new(
      'Acc:', values, [])
  end

  it "init w/ the first value selected" do
    first_value = values.first
    @selector.val.must_equal first_value
  end

  it "stores value for selection" do
    second_value = values[1]
    @selector.set_to second_value
    @selector.val.must_equal second_value
  end

  describe "for unknown value" do
    it "cannot select unknown value" do
      @selector.wont_be :can_set_to?, strange_value
    end

    it "refuses selecting unknown value" do
      old_value = @selector.val

      assert_raises Redwood::HorizontalSelector::UnknownValue do
        @selector.set_to strange_value
      end

      @selector.val.must_equal old_value
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sup-1.0 test/unit/test_horizontal_selector.rb
sup-0.23 test/unit/test_horizontal_selector.rb
sup-0.22.1 test/unit/test_horizontal_selector.rb
sup-0.22.0 test/unit/test_horizontal_selector.rb
sup-0.21.0 test/unit/test_horizontal_selector.rb
sup-0.20.0 test/unit/test_horizontal_selector.rb
sup-0.19.0 test/unit/test_horizontal_selector.rb
sup-0.18.0 test/unit/test_horizontal_selector.rb