Skip to content
This repository has been archived by the owner on Nov 27, 2017. It is now read-only.

Commit

Permalink
Merge pull request #5 from gongo/supress_warnings
Browse files Browse the repository at this point in the history
Supress warnings
  • Loading branch information
gongo committed Mar 27, 2015
2 parents f8210a4 + c6d021c commit e9fa0d3
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -4,6 +4,7 @@
.config
.yardoc
Gemfile.lock
gemfiles/*.lock
InstalledFiles
_yardoc
coverage
Expand All @@ -18,4 +19,3 @@ tmp
vendor
.DS_Store
spec/stepdoc

2 changes: 0 additions & 2 deletions .rspec
@@ -1,4 +1,2 @@
--colour
--format documentation
--order random
--tag ~before_load
8 changes: 6 additions & 2 deletions lib/table_beet.rb
@@ -1,6 +1,10 @@
require 'rspec'
require 'turnip'

# Instead of 'turnip/rspec'
::RSpec.configuration.include Turnip::Steps, turnip: true

module TableBeet
require 'turnip'
require 'turnip/rspec'
require 'table_beet/reporter'
require 'table_beet/step'
require 'table_beet/version'
Expand Down
2 changes: 2 additions & 0 deletions lib/table_beet/formatters/base_formatter.rb
@@ -1,6 +1,8 @@
module TableBeet
module Formatters
class BaseFormatter
attr_reader :scopes, :directory

def initialize(scopes, directory)
@scopes = scopes
@directory = directory
Expand Down
7 changes: 1 addition & 6 deletions lib/table_beet/formatters/html_formatter.rb
Expand Up @@ -9,7 +9,7 @@ class HTMLFormatter < BaseFormatter

def flush
# TODO: uh..
Dir.mkdir directory unless File.exists?(directory)
Dir.mkdir directory unless File.exist?(directory)

create_index
create_metadata_dir
Expand All @@ -19,7 +19,6 @@ def flush

def create_index
erb = ERB.new(File.read(template_output))
scopes = @scopes

File.open(output, 'w') do |f|
f.write erb.result(binding)
Expand All @@ -42,10 +41,6 @@ def template_metadata_dir
template_dir + '/data'
end

def directory
@directory
end

def output
directory + '/index.html'
end
Expand Down
60 changes: 59 additions & 1 deletion spec/spec_helper.rb
@@ -1,6 +1,64 @@
require 'table_beet'
require 'coveralls'
Coveralls.wear!


if RSpec::Core::Version::STRING >= '3.2.0'
require 'rspec/core/sandbox'
else
require 'rspec/core'

# See: https://github.com/rspec/rspec-core/blob/v3.2.2/lib/rspec/core/sandbox.rb
module RSpec

class << self
# For RSpec 3.1.x
attr_writer :configuration, :world unless RSpec.respond_to?(:configuration=)
end

module Core
module Sandbox
def self.sandboxed
orig_config = RSpec.configuration
orig_world = RSpec.world

RSpec.configuration = RSpec::Core::Configuration.new
RSpec.world = RSpec::Core::World.new(RSpec.configuration)

yield RSpec.configuration
ensure
RSpec.configuration = orig_config
RSpec.world = orig_world
end
end
end
end
end

require 'table_beet'

FIXTURES_PATH = File.dirname(__FILE__) + '/fixtures/steps'
OUTPUT_PATH = File.dirname(__FILE__) + '/stepdoc'

RSpec.configure do |c|
c.around(:each) do |ex|
#
# Reset the added steps
# on https://github.com/jnicklas/turnip/blob/v1.2.4/lib/turnip/dsl.rb#L21
#
RSpec::Core::Sandbox.sandboxed do |config|
#
# Sandbox config does not included Turnip::Steps yet.
#
config.include Turnip::Steps, turnip: true

ex.run

#
# Reset the addes 'global' steps
#
Turnip::Steps.instance_methods.each do |method|
Turnip::Steps.module_eval { undef_method method }
end
end
end
end

0 comments on commit e9fa0d3

Please sign in to comment.