Sha256: 6274ce1eba36e3c39dbd9c0169581545aa74704ed626b075164e580f999ecc3c

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 Bytes

Contents

module Bbq
  class TestUser
    module Within
      METHODS_USING_WITHIN = [
        :see?, :not_see?,
        :attach_file, :check, :choose, :click_link_or_button, :click_button,
        :click_link, :click_on, :fill_in, :select, :uncheck, :unselect
      ]

      METHODS_USING_WITHIN.each do |method_name|
        class_eval <<-RUBY
          def #{method_name}(*args)
            using_within(args) { super }
          end
        RUBY
      end

      def using_within(args)
        options = args.extract_options!
        locator = options.delete(:within)
        args.push(options) unless options.empty?

        if locator
          within(locator) { yield }
        else
          yield
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bbq-0.2.1 lib/bbq/test_user/within.rb
bbq-0.2.0 lib/bbq/test_user/within.rb
bbq-0.1.0 lib/bbq/test_user/within.rb
bbq-0.0.4 lib/bbq/test_user/within.rb
bbq-0.0.3 lib/bbq/test_user/within.rb