Sha256: 19e73f1f2205075b625b179fb6c7cef649fb88d2c7ffcb0e95a337c63805ecc3

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

require 'erb'
require 'raml'

require "rspec/examples"
require "raml_models"

module Rambo
  module RSpec
    class SpecFile
      attr_reader :raml, :examples, :options

      TEMPLATE_PATH = File.expand_path('../templates/spec_file_template.erb', __FILE__)

      def initialize(raml, options={})
        @raml     = Rambo::RamlModels::Api.new(raml)
        @options  = options
        @examples = Examples.new(@raml, @options)
      end

      def template
        @template ||= File.read(TEMPLATE_PATH)
      end

      def render
        b = binding
        ERB.new(template, 0, "-", "@result").result(raml.instance_eval { b })
        @result
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rambo_ruby-0.1.0 lib/rspec/spec_file.rb