[rspec-users] [RSpec] implicit receiver for should problem when helper predicate methods are in use
Jarmo Pertman
Jarmo.P at gmail.com
Wed May 13 13:11:39 EDT 2009
On May 13, 7:08 pm, David Chelimsky <dchelim... at gmail.com> wrote:
>
> I actually think that what you're doing is perfectly fine. Just not
> the common case. That's why I think it's OK to support explicitly
> assigning self as subject, but not making that a default behaviour.
>
> If it were me, and it's *not*, but if it were, I'd wrap those helpers
> in an object and make explicit calls.
you mean something like this?
class PageHelper
def has_text?
# blah
end
end
describe "cool page" do
subject {PageHelper.new}
before :all do
PageHelper.new
end
it "has something" do
should have_text("blah")
end
end
Doesn't seem too bad. I will give it a thought!
Jarmo
More information about the rspec-users
mailing list