module Spectre
Constants
- VERSION
Attributes
file_log[R]
logger[R]
Public Class Methods
configure(config)
click to toggle source
# File lib/spectre.rb, line 404 def configure config @@modules.each do |block| block.call(config) end end
delegate(*method_names, to: nil)
click to toggle source
# File lib/spectre.rb, line 394 def delegate *method_names, to: nil Spectre::Delegator.delegate *method_names, to end
describe(desc, &block)
click to toggle source
Global Functions
# File lib/spectre.rb, line 416 def describe desc, &block subject = @@subjects.find { |x| x.desc == desc } if !subject subject = Subject.new(desc) @@subjects << subject end ctx = SpecContext.new(subject) ctx._evaluate &block end
has_tag(tags, tag_exp)
click to toggle source
# File lib/spectre.rb, line 385 def has_tag tags, tag_exp tags = tags.map { |x| x.to_s } all_tags = tag_exp.split '+' included_tags = all_tags.select { |x| !x.start_with? '!' } excluded_tags = all_tags.select { |x| x.start_with? '!' }.map { |x| x[1..-1] } included_tags & tags == included_tags and excluded_tags & tags == [] end
property(key, val)
click to toggle source
# File lib/spectre.rb, line 428 def property key, val Spectre::Runner.current.properties[key] = val end
register(&block)
click to toggle source
# File lib/spectre.rb, line 399 def register &block @@modules << block end
specs(spec_filter=[], tags=[])
click to toggle source
# File lib/spectre.rb, line 375 def specs spec_filter=[], tags=[] @@subjects .map { |x| x.specs } .flatten .select do |spec| (spec_filter.empty? or spec_filter.any? { |x| spec.name.match('^' + x.gsub('*', '.*') + '$') }) and (tags.empty? or tags.any? { |x| has_tag(spec.tags, x) }) end end