Skip to content

Instantly share code, notes, and snippets.

@forforf
Created March 7, 2013 22:32
Show Gist options
  • Save forforf/5112445 to your computer and use it in GitHub Desktop.
Save forforf/5112445 to your computer and use it in GitHub Desktop.
RSpec issue with Regex declared by let
class Foo
def a_string
"abcdef8"
end
end
require_relative "./foo"
describe Foo do
let(:foo) {Foo.new}
let(:my_matcher) {/^[a-z]+(\d)$/}
it "should match and pass" do
my_str = foo.a_string
p my_matcher
matcher = my_str.match(my_matcher)
8.should == matcher[1].to_i
end
it "should also match and pass but fails" do
my_str = foo.a_string
#p my_matcher
matcher = my_str.match(my_matcher)
8.should == matcher[1].to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment