Sha256: 1c7337d95e2f301e71258a729226b2884d7e3359520bf8a75cb53833027fd114

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

require 'coveralls'
Coveralls.wear!

require 'json'
require 'ostruct'
require 'tag_along'

RSpec.configure do |c|
  c.mock_with :rr
end

module TagAlongSpec
  def self.process_spec_data(dir)
    data = open(File.join(dir, 'spec_data.json')).read
    data = JSON.parse(data, symbolize_names: true)
    text = data[:content]
    offset_hash = data[:names]
    offset_obj = offset_hash.map do |h| 
      OpenStruct.new(name:  h[:verbatim],
                     start: h[:offsetStart],
                     end:   h[:offsetEnd])
    end
    offset_ary = offset_obj.map { |h| [h.start, h.end, h.name] }
    [text, offset_ary, offset_hash, offset_obj]
  end
end

unless defined?(SPEC_VARS)
  FILES_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'files'))
  TEXT, OFFSETS_ARY, OFFSETS_HASH, OFFSETS_OBJ = 
    TagAlongSpec.process_spec_data(FILES_DIR)
  HTML_TEXT = "
    <html>
      <head>
        <title>Days of the week</title>
      </head>
      <body>
        <p>
        There's <strong>Sunday</strong>
        and there's <strong>Monday</strong>
        </p>
      </body>
    </html>
    "
  SPEC_VARS = true
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tag_along-0.8.3 spec/spec_helper.rb
tag_along-0.8.2 spec/spec_helper.rb
tag_along-0.8.1 spec/spec_helper.rb
tag_along-0.8.0 spec/spec_helper.rb