• Download Gist
Property-Based Testing in RSpec.md
Markdown

DSL

require 'something'
require 'something/rspec'

describe String do
  describe "#wrap" do
    it "wraps" do
      expect("test foo".wrap(4)).to eq("test\nfoo")
    end

    generative do
      data(:string, String)
      data(:wrap_at) { rand(255) }

      property do
        expect(string.wrap(wrap_at)).to_not be_nil
        expect(string.wrap(wrap_at).length).to eq(string.length)
      end
    end
  end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.