Skip to content

Instantly share code, notes, and snippets.

@csexton
Forked from forforf/foo.rb
Created March 8, 2013 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csexton/5118622 to your computer and use it in GitHub Desktop.
Save csexton/5118622 to your computer and use it in GitHub Desktop.
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)
matcher = my_str.match(my_matcher) #WUT?
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