New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy Object should inherit from BasicObject, to avoid clashes with methods on Object. eg present? defined by ActiveSupport #216
Conversation
methods on Object. eg present? defined by ActiveSupport
After looking at output of failed build I see my naive mistake. Kirill R |
This should fix failing tests |
Thanks, can you also write a spec for this? |
Yeah, i will. |
I think mocking would be enough |
In case Google ever finds this, I should write a better description of this issue. Kirill R |
I guess you mean I'm using watir-webdriver for rails testing and has never seen this problem, since |
No, I dont mean wait_until_present, since that calls Watir::Wait.until. |
@kirillrdy I can't really see the purpose of calling |
Oh, I see now. I agree with @jarib, why would you want to call this sequence? |
assuming #present? is missing on WhenPresentDecorator, it should only timeout after 30 seconds. |
just to give example of code we use in tests that will always pass since present? was redefined by active support and always returns true for non nil objects. I will write a test to show this, forgive my timing. Kirill R |
I'd say that this is a bad verification, since you already verify presence with You should perform these assertions in the same fashion as watir-rspec does it |
@p0deje, when_present is non blocking, so it doesnt verify for presence until we call a method on return value of when_present. The reason we use when_present because it returns a promise object against which we can test other things, eg @when_present.text.should == "something" Hope this helps |
@kirillrdy Yeah, but It works correct when using with |
http://api.rubyonrails.org/classes/Object.html#method-i-present-3F active_resource defines #present? on Object, so Watir::WhenPresentDecorator#method_missing will never be called for #present? KirillR |
That's understood. The question is why would you want to call |
Anyway, it's not a big deal. I don't think we lose anything (apart from support for Ruby 1.8, which I don't think we care about anyway) by inheriting from BasicObject. |
Yes, thats true, I've stated that multiple times in this issue, perhaps a chat or a solid test would show this. |
I've added to your lib/watir-webdriver.rb No failing tests, This should not work because WhenPresentDecorator should call present? on Element not on Object |
@kirillrdy We're just saying that calling |
Why not just delegate require "forwardable"
class WhenPresentDecorator
extend Forwardable
def_delegator :@element, :present?
end This seems much cleaner solution to this problem in my opinion than extending |
@jarmo Thanks, applied that. |
I hope issue title is descriptive enough.