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.
17 18 19 20 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 17 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.
16 17 18 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 16 def description @description end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
16 17 18 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 16 def file @file end |
#group_description ⇒ Object (readonly)
Returns the value of attribute group_description.
16 17 18 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 16 def group_description @group_description end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
16 17 18 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 16 def line @line end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 22 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
26 27 28 29 30 31 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 26 def eql?(other) File.basename(file) == File.basename(other.file) && line == other.line && group_description == other.group_description && description == other.description end |
#hash ⇒ Object
33 34 35 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 33 def hash description.hash end |
#locate(groups) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 37 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
46 47 48 |
# File 'lib/deep_test/spec/extensions/example_methods.rb', line 46 def to_s "#{group_description} #{description}" end |