Sha256: 070acbbebcdb1e958f22041bf2b5be36339d50ac9e2f31f9487601a1ed6a9863

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 Bytes

Contents

require "spec_helper"

require "support/mapper_setup"
require "support/sequel_persistence_setup"
require "support/seed_data_setup"
require "sequel_mapper"

require "spec_helper"

require "support/mapper_setup"
require "support/sequel_persistence_setup"
require "support/seed_data_setup"
require "sequel_mapper"

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
sequel_mapper-0.0.3 spec/readme_examples_spec.rb