Sha256: d102759faa8afbade9d6aa6c84987fb9bc9f4e13306fe34befff351ff5559ee4
Contents?: true
Size: 936 Bytes
Versions: 2
Compression:
Stored size: 936 Bytes
Contents
# frozen_string_literal: true RSpec.describe Fear::Extractor::Pattern do describe ".new" do context "invalid syntax" do subject { -> { described_class.new("[1, 2, 3") } } it "shows where the error happens" do is_expected.to raise_error(Fear::PatternSyntaxError) { |error| lines = error.message.split("\n") expect(lines[0]).to start_with("Expected one of") .and(end_with("at line 1, column 9 (byte 9):")) expect(lines[1]).to eq("[1, 2, 3") expect(lines[2]).to eq("~~~~~~~~^") } end end end describe "#failure_reason" do let(:pattern) { described_class.new("Some([:err, 444])") } context "not defined" do subject { pattern.failure_reason(Fear.some([:err, 445])) } it { is_expected.to eq(<<~MSG.strip) } Expected `445` to match: Some([:err, 444]) ~~~~~~~~~~~~^ MSG end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fear-1.2.0 | spec/fear/extractor/pattern_spec.rb |
fear-1.1.0 | spec/fear/extractor/pattern_spec.rb |