Class: Spectre::Spec

Inherits:
Object show all
Defined in:
lib/spectre.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, subject, desc, tags, data, block, context, file, line) ⇒ Spec

Returns a new instance of Spec.



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/spectre.rb', line 104

def initialize name, subject, desc, tags, data, block, context, file, line
  @name = name
  @context = context
  @data = data
  @subject = subject
  @desc = desc
  @tags = tags
  @block = block
  @file = file
  @line = line
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



102
103
104
# File 'lib/spectre.rb', line 102

def block
  @block
end

#contextObject (readonly)

Returns the value of attribute context.



102
103
104
# File 'lib/spectre.rb', line 102

def context
  @context
end

#dataObject (readonly)

Returns the value of attribute data.



102
103
104
# File 'lib/spectre.rb', line 102

def data
  @data
end

#descObject (readonly)

Returns the value of attribute desc.



102
103
104
# File 'lib/spectre.rb', line 102

def desc
  @desc
end

#fileObject (readonly)

Returns the value of attribute file.



102
103
104
# File 'lib/spectre.rb', line 102

def file
  @file
end

#idObject (readonly)

Returns the value of attribute id.



102
103
104
# File 'lib/spectre.rb', line 102

def id
  @id
end

#lineObject (readonly)

Returns the value of attribute line.



102
103
104
# File 'lib/spectre.rb', line 102

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



102
103
104
# File 'lib/spectre.rb', line 102

def name
  @name
end

#subjectObject (readonly)

Returns the value of attribute subject.



102
103
104
# File 'lib/spectre.rb', line 102

def subject
  @subject
end

#tagsObject (readonly)

Returns the value of attribute tags.



102
103
104
# File 'lib/spectre.rb', line 102

def tags
  @tags
end

Instance Method Details

#full_descObject



116
117
118
# File 'lib/spectre.rb', line 116

def full_desc
  @subject.desc + ' ' + desc
end

#to_hObject



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/spectre.rb', line 120

def to_h
  {
    name: @name,
    context: @context.__desc,
    data: @data.map { |x| x.to_h },
    subject: @subject.desc,
    desc: @desc,
    tags: @tags,
    file: @file,
    line: @line,
  }
end