Hi, I'd like to offer this suggestion for changes to the RSpec syntax to 
use expect.  More than just a style change, it has turned turned out that using 
'expect' over 'should' is a recommended practice because of 
dealing with delegate/proxy objects as detailed in 
http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
As detailed in the blog post "In the future, we plan to change the 
defaults so that only expect is available unless you explicitly enable should. 
We may do this as soon as RSpec 3.0, but we want to give users plenty of time 
to get acquianted with it."
I changed the pattern matchers from =~ to match() as required for this change 
and while at it I also took the opportunity to change the == format to eq as 
recommended in the post. 
I switched from lamba {} to expect{} as detailed in 
http://stackoverflow.com/questions/4191016/which-style-lambda-should-or-expect-to-is-preferred-for-testing-expectations?rq=1.
I made these changes in the main spec/ files and also in the spec/watirspec 
files (approx 90+ files, 1000+ tests) which I forked seperately and will make a 
pull request for after this.  I realized afterwards that a branch would 
probably have been better.  Still learning.
All tests pass for both this and the spec/watirspec files.
You can merge this Pull Request by running:

  git pull https://github.com/durrantm/watir-webdriver master

Or you can view, comment on it, or merge it online at:

  https://github.com/watir/watir-webdriver/pull/224

-- Commit Summary --

  * Update (suggested) from RSpec should to expect.  Includes changing == to eq 
and =~ to match

-- File Changes --

    M spec/browser_spec.rb (34)
    M spec/click_spec.rb (10)
    M spec/container_spec.rb (16)
    M spec/element_locator_spec.rb (41)
    M spec/element_spec.rb (18)
    M spec/input_spec.rb (12)
    M spec/special_chars_spec.rb (2)
    M spec/wait_spec.rb (45)
    M spec/watirspec (2)

-- Patch Links --

https://github.com/watir/watir-webdriver/pull/224.patch
https://github.com/watir/watir-webdriver/pull/224.diff
_______________________________________________
Wtr-development mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to