Class: LimitedRed::Rspec::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/limited_red/rspec/metadata.rb

Instance Method Summary collapse

Constructor Details

#initialize(metadata) ⇒ Metadata

Returns a new instance of Metadata.



6
7
8
# File 'lib/limited_red/rspec/metadata.rb', line 6

def initialize()
  @metadata = 
end

Instance Method Details

#add_exception(exception) ⇒ Object



23
24
25
# File 'lib/limited_red/rspec/metadata.rb', line 23

def add_exception(exception)
  @exception = exception
end

#file_and_lineObject



27
28
29
# File 'lib/limited_red/rspec/metadata.rb', line 27

def file_and_line
  "#{file}:#{line}"
end

#to_jsonObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/limited_red/rspec/metadata.rb', line 10

def to_json
  hash = {:file => file, 
          :line => line, 
          :uri =>  uri,
          :pretty_name => full_description,
          :scopes => scopes}
  if @exception
    hash = hash.merge({:error => {:message => @exception,
                                  :type => @exception.class}})
  end
  hash.to_json
end

#uriObject



31
32
33
# File 'lib/limited_red/rspec/metadata.rb', line 31

def uri
  scopes.map{|s| s.to_s.downcase.gsub(/\s+/, '-')}.join("-")
end