specs migrated to rspec2.3 #11

21 commits merged into from Jan 31, 2011


None yet

2 participants

hipe commented Dec 15, 2010

hi per our conv in the message thread here's the chnges to bring the specs up to rspec2.3 to go green on ruby 1.8.7

hipe added some commits Dec 14, 2010
@hipe hipe Refactor :shared => true to shared_examples_for() 48156a4
@hipe hipe Change Gemfile to specify rspec 2.3.0 and not 1.3.0
  * the next few commits will be broken as we progressively make changes
@hipe hipe Change Rakefile to work with rspec 2.3
  @todo - what did libs() do?
@hipe hipe Change spec_helper to work with rspec2.3
  * all tests are broken now!
  * rather than registering compiler & runtime with example group,
      we call include() and extend() on the config object
@hipe hipe Change shared exmaple group in palidromic fixture to be valid for rsp…
…ec 2.3

  * all tests still broken!
@hipe hipe Change one last :shared=>true to be a shared_example_group
  * now the tests aren't fully broken: (359 examples, 139 failures)
  * we will be changing this one probably to be a shared context
@hipe hipe Merge branch 'master' of github.com:hipe/treetop into rspec2.3 6e466a9
@hipe hipe Fix how we require helper file so it doesn't get loaded twice
  (407 examples, 144 failures)
@hipe hipe Change shared example with filter to be a SharedContext for rspec 2.3
  in rspec 2.3, it looks like shared example groups will not allow
  you to specify before filters that descend down to children, only
  to specify examples.  Rather, we need to create a SharedContext module
  and include it in the example groups.

  @todo refactor after 'deterministic' migration is done
@hipe hipe Refactor insert_and_delete_node_spec for rspec 2.3
  Create the @deterministic tag to aide in running focused tests.
  (44 examples, 0 failures) (Run filtered using {:deterministic=>true})
@hipe hipe Create temporary tag to show the currently broken spec
  (108 examples, 42 failures) (Run filtered using {:deterministic2=>true})
  Note that because of the underlying pseudo-randomness of the calls,
  the number of errors itself is non-deterministic
@hipe hipe Just to be sure this change is necessary, demonstrate it
(above and below this commit is the migration happending that demonstrates this.)
@hipe hipe Fantatic! refactor for rspec 2.3
in spec_helper.rb just comment out unused code

in insert_spec.rb,
changing one line wins us dozens of greens
(108 examples, 0 failures) (Run filtered using {:deterministic2=>true})
@hipe hipe Determinsitic tagged exmaples: 152 examples, 0 failures c607966
@hipe hipe Add palindromic tag to show 96/96 failures before refactor
(96 examples, 96 failures) (Run filtered using {:palindromic=>true})
@hipe hipe Refactor palindromic shared context to work with rspec2.3
Make a temporary, more focused 'palindromic2' tag (@todo temporary)
(26 examples, 0 failures) (Run filtered using {:palindromic2=>true})

@smell is it clear enough what is going on? can it be cleaned up?
@hipe hipe Palindromic is all green!
(96 examples, 0 failures) (Run filtered using {:palindromic=>true})
@hipe hipe Refactor: remove unused shared example (became shared context) ff4c6bd
@hipe hipe Refactor to remove unnecessary (empty) shared example that became a S…
@hipe hipe Create @mutlbyte tag showing 3 examples, 3 failures d9f5cdb
@hipe hipe Restore $KCODE setting for multibyte support that rspec used to do
(3 examples, 0 failures) (Run filtered using {:multibyte=>true})

@todo 1.9 ?

rspec 1.3.1 used to set $KCODE='u' in one place which activated the
activesuport wrapper for multibyte chars when calling String#mb_chars
cjheath commented Dec 16, 2010

I've merged this on my master branch, but not yet pushed. It works with any RSpec 2, not just 2.3, so I loosened up the Gemfile a little. rr still fails badly on 1.9.2. When you were looking at the IntervalSkipList tests, did you get your head around the way rr is being used for mocking? Because if the author doesn't bring it up to 1.9.2 soon, we might need to ditch rr and refactor using another mocking framework. I haven't looked, but I doubt it's hard.

hipe commented Dec 16, 2010

This is all very exciting! I did see that the mocking lib being used to turn next_node_height() into a thing that returns a series of (deterministic) integers rather than the randomness. I find it likely that we could bring rr up to 1.9.2 but the fact that it hasn't already doesn't bode well for the health of the project I think. But i'm not sure whether that is smarter than b) switching to a different mock lib (factory girl/machinist?) or just writing the five lines of code we would need to implement stub() ourselves in spec_helper.rb or something. What sounds smartest to you? I'll read up on rr. Thanks!

hipe commented Dec 18, 2010

rspec 2.3 if not 2.0 has mocks i'll probably go this route if it meets the requirements unless u would rather something else! thx

hipe commented Dec 26, 2010

hi i hope to work on this in the next seven days or so i'm hoping it will only take like 2-4 hours or so to determine if the mocking facilities in rspec2 can work for the minimal mocking needs of the specs

cjheath commented Jan 13, 2011

Did you get anywhere with the mocking stuff?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment