Class: ActiveFixtures::Session
- Defined in:
- lib/active-fixtures/session.rb
Defined Under Namespace
Modules: Helper
Constant Summary collapse
- CLEAN_NAME =
:__clean
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Session
constructor
A new instance of Session.
- #perform(block) ⇒ Object
Methods inherited from Resource
Methods included from Context
#context, extended, #method_missing
Constructor Details
#initialize(attrs = {}) ⇒ Session
Returns a new instance of Session.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/active-fixtures/session.rb', line 15 def initialize(attrs = {}) super .map!(&:symbolize_keys!) if attrs[:block] using_session do attrs[:block].call self.url = context.current_url self. = context.page.driver..values.map{ |c| c.instance_variable_get(:@attributes).symbolize_keys} end end end |
Instance Method Details
#perform(block) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/active-fixtures/session.rb', line 30 def perform(block) res = nil using_session do context.reset_session! .each do || context.page.driver.(nil, nil, ) end context.visit(url) if url res = block.call end res end |