Skip to content

Commit

Permalink
Refactor palindromic shared context to work with rspec2.3
Browse files Browse the repository at this point in the history
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 48e5fc9
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
42 changes: 29 additions & 13 deletions spec/runtime/interval_skip_list/palindromic_fixture.rb
@@ -1,23 +1,39 @@
shared_examples_for "the palindromic fixture" do module PalindromicFixtureSharedContext
attr_reader :list, :node extend RSpec::Core::SharedContext
include IntervalSkipListSpecHelper include IntervalSkipListSpecHelper


before do attr_reader :list, :node

def construct_interval_skip_list
@list = IntervalSkipList.new @list = IntervalSkipList.new
end end


it_should_behave_like "#next_node_height is deterministic"
def expected_node_heights def expected_node_heights
[3, 2, 1, 3, 1, 2, 3] [3, 2, 1, 3, 1, 2, 3]
end end


before do def populate_interval_skip_list
list.insert(1..3, :a) @list.insert(1..3, :a)
list.insert(1..5, :b) @list.insert(1..5, :b)
list.insert(1..7, :c) @list.insert(1..7, :c)
list.insert(1..9, :d) @list.insert(1..9, :d)
list.insert(1..11, :e) @list.insert(1..11, :e)
list.insert(1..13, :f) @list.insert(1..13, :f)
list.insert(5..13, :g) @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 end

shared_examples_for "the palindromic fixture" do
# @todo needs cleanup!
end
3 changes: 2 additions & 1 deletion spec/runtime/interval_skip_list/palindromic_fixture_spec.rb
@@ -1,7 +1,8 @@
require 'runtime/interval_skip_list/spec_helper' 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" it_should_behave_like "the palindromic fixture"
include PalindromicFixtureSharedContext


describe " #nodes" do describe " #nodes" do
describe "[0]" do describe "[0]" do
Expand Down

0 comments on commit 48e5fc9

Please sign in to comment.