Class: Facebooker::Rails::Cucumber::World

Inherits:
Cucumber::Rails::World
  • Object
show all
Defined in:
lib/facebooker/rails/cucumber/world.rb

Instance Method Summary collapse

Instance Method Details

#open_session {|session| ... } ⇒ Object

Yields:

  • (session)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/facebooker/rails/cucumber/world.rb', line 8

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

#without_canvasObject



31
32
33
34
35
36
# File 'lib/facebooker/rails/cucumber/world.rb', line 31

def without_canvas
  in_canvas = @integration_session.canvas
  @integration_session.canvas = false
  yield
  @integration_session.canvas = in_canvas
end