Class: Spec::Example::ExampleMethods::Identifier
- Inherits:
-
Object
- Object
- Spec::Example::ExampleMethods::Identifier
- Defined in:
- lib/deep_test/spec/extensions/example_methods.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#group_description ⇒ Object
readonly
Returns the value of attribute group_description.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(file, line, group_description, description) ⇒ Identifier
constructor
A new instance of Identifier.
- #locate(groups) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file, line, group_description, description) ⇒ Identifier
Returns a new instance of Identifier.
11 12 13 14 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 11 def initialize(file, line, group_description, description) @file, @line, @group_description, @description = file, line, group_description, description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
10 11 12 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 10 def description @description end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
10 11 12 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 10 def file @file end |
#group_description ⇒ Object (readonly)
Returns the value of attribute group_description.
10 11 12 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 10 def group_description @group_description end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
10 11 12 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 10 def line @line end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 16 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
20 21 22 23 24 25 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 20 def eql?(other) File.basename(file) == File.basename(other.file) && line == other.line && group_description == other.group_description && description == other.description end |
#hash ⇒ Object
27 28 29 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 27 def hash description.hash end |
#locate(groups) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 31 def locate(groups) groups.each do |group| group.examples.each do |example| return example if example.identifier == self end end raise "Unable to locate example #{self}" end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 40 def to_s "#{group_description} #{description}" end |