Created
March 7, 2013 22:32
-
-
Save forforf/5112445 to your computer and use it in GitHub Desktop.
RSpec issue with Regex declared by let
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def a_string | |
"abcdef8" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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