Class: LimitedRed::Rspec::Metadata
- Inherits:
-
Object
- Object
- LimitedRed::Rspec::Metadata
- Defined in:
- lib/limited_red/rspec/metadata.rb
Instance Method Summary collapse
- #add_exception(exception) ⇒ Object
- #file_and_line ⇒ Object
-
#initialize(metadata) ⇒ Metadata
constructor
A new instance of Metadata.
- #to_json ⇒ Object
- #uri ⇒ Object
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_line ⇒ Object
27 28 29 |
# File 'lib/limited_red/rspec/metadata.rb', line 27 def file_and_line "#{file}:#{line}" end |
#to_json ⇒ Object
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 |
#uri ⇒ Object
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 |