I am trying to use cucumber but my application has a "Spec" model (I
followed the RailsSpace book). So now I am getting an error when
running cucumber (below). I think because cucumber does not like a
model named "Spec." But I have "Spec" and "spec(s)" everywhere in my
application now. A universal text change is a huge pain. Some
innocent text contains the string "spec", e.g. "aspect". So I have to
look at each replacement. What can I do? Please help. Thanks.
I am trying to use cucumber but my application has a "Spec" model (I
followed the RailsSpace book).
...which is quite out of date.
So now I am getting an error when
running cucumber (below). I think because cucumber does not like a
model named "Spec."
Actually, I think that would be more of a proble for RSpec. But I
could be wrong.
But I have "Spec" and "spec(s)" everywhere in my
application now. A universal text change is a huge pain. Some
innocent text contains the string "spec", e.g. "aspect". So I have to
look at each replacement.
Well, you should look at each replacement anyway.
What can I do? Please help.
Try a regular expression search and replace, so that you don't hit
innocent words.
Thanks Marnen. I am trying to use regular expression to replace the
text "spec" in TextMate with "mug". I am trying to avoid instances of
"spec" where it does not mean the name of the model, e.g. "aspect".
So I use the following regular expression: [^a-zA-Z]spec . That
would catch "@spec" which is what I want. But if I tell TextMate to
replace that with "mug", I lose the character before "spec". TextMate
replaces "@spec" with "mug" . How can I make it replace @spec with
@mug ?
Thanks Marnen. I am trying to use regular expression to replace the
text "spec" in TextMate with "mug". I am trying to avoid instances of
"spec" where it does not mean the name of the model, e.g. "aspect".
So I use the following regular expression: [^a-zA-Z]spec . That
would catch "@spec" which is what I want. But if I tell TextMate to
replace that with "mug", I lose the character before "spec". TextMate
replaces "@spec" with "mug" . How can I make it replace @spec with
@mug ?
Most regexp syntaxes support backreferences in the replace string, which
is what you need. Check TextMate's documentation to see how it
implements backreferences.
I will surely look into back references next time. Before I got your answer, I managed to do this manually by replacing “Spec” then “spec” when preceded with each of the special characters: @ : ’ " / - ! space. I downloaded and used “Name Mangler” to replace “spec” in file names. While tedious, you are right that it is not too difficult. Cucumber seems to work now. I am ready to dive into BDD.