Class: Mutiny::Tests::TestSet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mutiny/tests/test_set.rb

Direct Known Subclasses

Integration::RSpec::TestSet

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tests) ⇒ TestSet

Returns a new instance of TestSet.



13
14
15
# File 'lib/mutiny/tests/test_set.rb', line 13

def initialize(tests)
  @tests = tests
end

Class Method Details

.emptyObject



9
10
11
# File 'lib/mutiny/tests/test_set.rb', line 9

def self.empty
  new([])
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


37
38
39
# File 'lib/mutiny/tests/test_set.rb', line 37

def eql?(other)
  is_a?(other.class) && other.tests == tests
end

#for(subject) ⇒ Object



25
26
27
# File 'lib/mutiny/tests/test_set.rb', line 25

def for(subject)
  subset { |test| subject.name == test.expression }
end

#for_all(subject_set) ⇒ Object



21
22
23
# File 'lib/mutiny/tests/test_set.rb', line 21

def for_all(subject_set)
  subset { |test| subject_set.names.include?(test.expression) }
end

#locationsObject



17
18
19
# File 'lib/mutiny/tests/test_set.rb', line 17

def locations
  tests.map(&:location)
end

#subset(&block) ⇒ Object



29
30
31
# File 'lib/mutiny/tests/test_set.rb', line 29

def subset(&block)
  self.class.new(tests.select(&block))
end

#take(n) ⇒ Object



33
34
35
# File 'lib/mutiny/tests/test_set.rb', line 33

def take(n)
  self.class.new(tests.take(n))
end