From 35def4911d4eb7f6f3c2aadb6b1983993f9293f6 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 15 Nov 2017 16:22:05 +0100 Subject: schema_spec: Remove unnecessary capture Thanks to Robert for suggesting `(?:...)`. I didn't know that syntax, happy I learned something new. Here, I had used parentheses for the "or" (`|`), but didn't need the captured value. To do the "or" without capturing, you can use the `?:` inside the start of the parentheses. Refs #4951 --- spec/db/schema_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index b2f259abd..74e92bebe 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -16,7 +16,7 @@ RSpec::Matchers.define :use_bigint_keys do # Primary key if line =~ /create_table\s/ && - !(line =~ /id:\s+(:bigserial|false)/) + !(line =~ /id:\s+(?::bigserial|false)/) expected_line = line.sub(/(create_table\s"\w+",\s)/, '\1id: :bigserial, ') end -- cgit v1.2.3