Permalink
Browse files

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?
  • Loading branch information...
hipe committed Dec 15, 2010
1 parent be153ed commit 48e5fc96909a06bca3c2737d2505185ae120759a
@@ -1,23 +1,39 @@
-shared_examples_for "the palindromic fixture" do
- attr_reader :list, :node
+module PalindromicFixtureSharedContext
+ extend RSpec::Core::SharedContext
include IntervalSkipListSpecHelper
- before do
+ attr_reader :list, :node
+
+ def construct_interval_skip_list
@list = IntervalSkipList.new
end
- it_should_behave_like "#next_node_height is deterministic"
def expected_node_heights
[3, 2, 1, 3, 1, 2, 3]
end
- before do
- list.insert(1..3, :a)
- list.insert(1..5, :b)
- list.insert(1..7, :c)
- list.insert(1..9, :d)
- list.insert(1..11, :e)
- list.insert(1..13, :f)
- list.insert(5..13, :g)
+ def populate_interval_skip_list
+ @list.insert(1..3, :a)
+ @list.insert(1..5, :b)
+ @list.insert(1..7, :c)
+ @list.insert(1..9, :d)
+ @list.insert(1..11, :e)
+ @list.insert(1..13, :f)
+ @list.insert(5..13, :g)
+ end
+
+ def make_it_determinisitic
+ extend NextNodeHeightIsDeterministicSharedContext # use the method without getting the filter
+ next_node_height_is_deterministic
+ end
+
+ before :each do
+ construct_interval_skip_list
+ make_it_determinisitic
+ populate_interval_skip_list
end
-end
+end
+
+shared_examples_for "the palindromic fixture" do
+ # @todo needs cleanup!
+end
@@ -1,7 +1,8 @@
require 'runtime/interval_skip_list/spec_helper'
-describe "The palindromic fixture", :palindromic => true do
+describe "The palindromic fixture", :palindromic2 => true do
it_should_behave_like "the palindromic fixture"
+ include PalindromicFixtureSharedContext
describe " #nodes" do
describe "[0]" do

0 comments on commit 48e5fc9

Please sign in to comment.