Sha256: 278854facb36f7f603275753f36a8145b2edbf83923e24f4d95e7bb0e191ef30

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 Bytes

Contents

require "spec_helper"

require "support/mapper_setup"
require "support/sequel_persistence_setup"
require "support/seed_data_setup"
require "terrestrial"

require "spec_helper"

require "support/mapper_setup"
require "support/sequel_persistence_setup"
require "support/seed_data_setup"
require "terrestrial"

RSpec.describe "README examples" do
  include_context "sequel persistence setup"

  readme_contents = File.read("README.md")

  code_samples = readme_contents
    .split("```ruby")
    .drop(1)
    .map { |s| s.split("```").first }

  code_samples.each_with_index do |code_sample, i|
    it "executes without error" do
      begin
        Module.new.module_eval(code_sample)
      rescue => e
        File.open("./example#{i}.rb", "w") { |f| f.puts(code_sample) }
        binding.pry if ENV["DEBUG"]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terrestrial-0.1.1 spec/readme_examples_spec.rb