Sha256: 2b9f2bf5f20ce4f93873b65c0a0d688455694e8fcd167b74de7b51969c614769

Contents?: true

Size: 1.11 KB

Versions: 25

Compression:

Stored size: 1.11 KB

Contents

module WatirSpec
  class Guard

    attr_accessor :type, :browsers, :data
  
    def initialize(type, browsers, data={})
      self.type, self.browsers, self.data = type, browsers, data
      WatirSpec.guards << self
    end
  
    def guarded?(browser)
      WatirSpec.guarded? || browsers.include?(browser.name)
    end
  
    module Helpers
      def deviates_on(*browsers)
        guard = WatirSpec::Guard.new :deviation, browsers, :file => caller.first
        yield unless guard.guarded?(OperaWatir::Helper.browser)
      end

      def not_compliant_on(*browsers)
        guard = WatirSpec::Guard.new :non_compliance, browsers, :file => caller.first
        yield unless guard.guarded?(OperaWatir::Helper.browser)
      end

      def compliant_on(*browsers)
        guard = WatirSpec::Guard.new :compliance, browsers, :file => caller.first
        yield unless guard.guarded?(OperaWatir::Helper.browser)
      end

      def bug(url, *browsers)
        guard = WatirSpec::Guard.new :bug, browsers, :file => caller.first, :url => url
        yield unless guard.guarded?(OperaWatir::Helper.browser)
      end
    end
    
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
operawatir-0.7.pre4-jruby spec/watir2/guards.rb
operawatir-0.7.pre3-jruby spec/watir2/guards.rb
operawatir-0.7.pre2-jruby spec/watir2/guards.rb
operawatir-0.7.pre1-jruby spec/watir2/guards.rb
operawatir-0.6.pre1-jruby spec/watir2/guards.rb
operawatir-0.5.1-jruby spec/watir2/guards.rb
operawatir-0.5-jruby spec/watir2/guards.rb
operawatir-0.5.pre3-jruby spec/watir2/guards.rb
operawatir-0.5.pre2-jruby spec/watir2/guards.rb
operawatir-0.5.pre1-jruby spec/watir2/guards.rb
operawatir-0.4.3.pre1-jruby spec/watir2/guards.rb
operawatir-0.4.2-jruby spec/watir2/guards.rb
operawatir-0.4.1-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre7-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre6-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre5-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre4-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre3-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre2-jruby spec/watir2/guards.rb
operawatir-0.4.1.pre1-jruby spec/watir2/guards.rb