Module: Crabfarm::RSpec
- Defined in:
- lib/crabfarm/rspec.rb
Instance Method Summary collapse
- #crawl(_state = nil, _params = {}) ⇒ Object
- #last_state ⇒ Object
- #parse(_snap_or_url, _options = {}) ⇒ Object
- #parser ⇒ Object
- #state ⇒ Object
Instance Method Details
#crawl(_state = nil, _params = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/crabfarm/rspec.rb', line 21 def crawl(_state=nil, _params={}) if _state.is_a? Hash _params = _state _state = nil end if _state.nil? return nil unless described_class < BaseState # TODO: maybe raise an error here. @state = @last_state = CF_TEST_CONTEXT.run_state(described_class, _params) else @last_state = CF_TEST_CONTEXT.run_state(_state, _params) end end |
#last_state ⇒ Object
39 40 41 |
# File 'lib/crabfarm/rspec.rb', line 39 def last_state @last_state end |
#parse(_snap_or_url, _options = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crabfarm/rspec.rb', line 10 def parse(_snap_or_url, ={}) fixture = Pathname.new(File.join(ENV['SNAPSHOT_DIR'], _snap_or_url)) if fixture.exist? CF_TEST_BUCKET.get("file://#{fixture.realpath}") else CF_TEST_BUCKET.get(_snap_or_url) end CF_TEST_BUCKET.parse(described_class, ) end |
#parser ⇒ Object
43 44 45 |
# File 'lib/crabfarm/rspec.rb', line 43 def parser @parser end |
#state ⇒ Object
35 36 37 |
# File 'lib/crabfarm/rspec.rb', line 35 def state @state ||= crawl end |