Sha256: 320ddce73c398b8118e8b053afe463e5cc7baa70c8d40f2e0d964312788ad84f

Contents?: true

Size: 1.34 KB

Versions: 44

Compression:

Stored size: 1.34 KB

Contents

require 'cucumber/rails/world'
require 'facebooker/rails/integration_session'

module Facebooker
  module Rails
    module Cucumber
      class World < ::Cucumber::Rails::World
        def open_session
          session = Facebooker::Rails::IntegrationSession.new

          # delegate the fixture accessors back to the test instance
          extras = Module.new { attr_accessor :delegate, :test_result }
          if self.class.respond_to?(:fixture_table_names)
            self.class.fixture_table_names.each do |table_name|
              name = table_name.tr(".", "_")
              next unless respond_to?(name)
              extras.__send__(:define_method, name) { |*args| delegate.send(name, *args) }
            end
          end

          # delegate add_assertion to the test case
          extras.__send__(:define_method, :add_assertion) { test_result.add_assertion }
          session.extend(extras)
          session.delegate = self
          session.test_result = @_result

          yield session if block_given?
          session
        end
        
        def without_canvas
          in_canvas = @integration_session.canvas
          @integration_session.canvas = false
          yield
          @integration_session.canvas = in_canvas
        end
      end
    end
  end
end

World do
  w = Facebooker::Rails::Cucumber::World.new
  w.reset!
  w
end

Version data entries

44 entries across 44 versions & 9 rubygems

Version Path
mmangino-facebooker-1.0.32 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.36 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.37 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.38 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.39 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.40 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.41 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.42 lib/facebooker/rails/cucumber/world.rb
mmangino-facebooker-1.0.43 lib/facebooker/rails/cucumber/world.rb
mwilliams-facebooker-1.0.40 lib/facebooker/rails/cucumber/world.rb
simianarmy-facebooker-1.0.40 lib/facebooker/rails/cucumber/world.rb
taweili-facebooker-1.0.37 lib/facebooker/rails/cucumber/world.rb
taweili-facebooker-1.0.38 lib/facebooker/rails/cucumber/world.rb
taweili-facebooker-1.0.40 lib/facebooker/rails/cucumber/world.rb
taweili-facebooker-1.0.41 lib/facebooker/rails/cucumber/world.rb
tenderlove-facebooker-1.0.16.20090319151701 lib/facebooker/rails/cucumber/world.rb
tenderlove-facebooker-1.0.16.20090319171318 lib/facebooker/rails/cucumber/world.rb
facebooker-1.0.41 lib/facebooker/rails/cucumber/world.rb
facebooker-1.0.42 lib/facebooker/rails/cucumber/world.rb
facebooker-1.0.43 lib/facebooker/rails/cucumber/world.rb