summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringscanner/fixed_anchor_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringscanner/fixed_anchor_spec.rb')
-rw-r--r--spec/ruby/library/stringscanner/fixed_anchor_spec.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/ruby/library/stringscanner/fixed_anchor_spec.rb b/spec/ruby/library/stringscanner/fixed_anchor_spec.rb
new file mode 100644
index 0000000000..ce0b714fa8
--- /dev/null
+++ b/spec/ruby/library/stringscanner/fixed_anchor_spec.rb
@@ -0,0 +1,17 @@
+require_relative '../../spec_helper'
+require 'strscan'
+
+describe "StringScanner#fixed_anchor?" do
+ it "returns whether the fixed-anchor property is set" do
+ s = StringScanner.new("foo", fixed_anchor: true)
+ s.should.fixed_anchor?
+
+ s = StringScanner.new("foo", fixed_anchor: false)
+ s.should_not.fixed_anchor?
+ end
+
+ it "is set to false by default" do
+ s = StringScanner.new("foo")
+ s.should_not.fixed_anchor?
+ end
+end