Skip to content

Commit

Permalink
Ensuring tests are order independant
Browse files Browse the repository at this point in the history
  • Loading branch information
simonc committed Mar 3, 2014
1 parent 76f7889 commit ecb519b
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions spec/spec_helper.rb
Expand Up @@ -7,6 +7,12 @@

RSpec.configure do |config|
config.expect_with(:rspec) { |c| c.syntax = :expect }
config.order = :random

config.before do
SimpleNavigation.config_files.clear
setup_adapter_for :rails
end
end

# FIXME: actualize to make it 4 by default
Expand All @@ -23,14 +29,14 @@ module VERSION

require 'simple_navigation'

def setup_adapter_for(framework)
adapter = case framework
when :rails
context = double(:context, view_context: ActionView::Base.new)
SimpleNavigation::Adapters::Rails.new(context)
end
SimpleNavigation.stub(adapter: adapter)
adapter
def setup_adapter_for(framework, context = double(:context))
if framework == :rails
context.stub(view_context: ActionView::Base.new)
end

SimpleNavigation.stub(framework: framework)
SimpleNavigation.load_adapter
SimpleNavigation.init_adapter_from(context)
end

def setup_renderer(renderer_class, options)
Expand Down

0 comments on commit ecb519b

Please sign in to comment.