Sha256: 59cc1af78d50319b7bf60d7c867ed5899c442dcdd0a46fbef0a1379d82b3533d

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

# This code is free software; you can redistribute it and/or modify it under
# the terms of the new BSD License.
#
# Copyright (c) 2010, Sebastian Staudt

require 'test_parameter'

class TestFlag < Test::Unit::TestCase

  include TestParameter

  context 'A Rubikon flag' do

    should 'be a Parameter' do
      assert Flag.included_modules.include?(Parameter)
      assert Flag.new(@app, :test).is_a?(Parameter)
    end

    should 'call its code block if it is activated' do
      block_run = false
      flag = Flag.new @app, :flag do
        block_run = true
      end
      flag.send :active!
      assert flag.active?
      assert block_run
    end

    should 'not allow any arguments' do
      flag = Flag.new @app, :test
      assert_raise ExtraArgumentError do
        flag.send(:<<, 'argument')
      end

      assert flag.send(:args_full?)
      assert !flag.send(:more_args?)
      assert !flag.respond_to?(:args)
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubikon-0.6.0 test/test_flag.rb
rubikon-0.5.3 test/test_flag.rb
rubikon-0.5.2 test/test_flag.rb
rubikon-0.5.1 test/test_flag.rb
rubikon-0.5.0 test/test_flag.rb