Class: MockEnvironment
- Defined in:
- lib/droiuby/spec/mock_objects/mock_environment.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#current_app ⇒ Object
Returns the value of attribute current_app.
-
#main_url ⇒ Object
Returns the value of attribute main_url.
Instance Method Summary collapse
- #before_setup(activity_instance, template) ⇒ Object
-
#initialize(params = {}) ⇒ MockEnvironment
constructor
A new instance of MockEnvironment.
- #on_create(activity_instance, refresh = false) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ MockEnvironment
Returns a new instance of MockEnvironment.
5 6 7 8 9 10 11 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 5 def initialize(params = {}) @current_app = DroiubyApp.new @app_name = params[:app_name] || '' @base_url = params[:base_url] || '' @main_url = params[:main_url] || '' @mock_view_heirarchy = [] end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
3 4 5 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 3 def app_name @app_name end |
#base_url ⇒ Object
Returns the value of attribute base_url.
3 4 5 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 3 def base_url @base_url end |
#current_app ⇒ Object
Returns the value of attribute current_app.
3 4 5 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 3 def current_app @current_app end |
#main_url ⇒ Object
Returns the value of attribute main_url.
3 4 5 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 3 def main_url @main_url end |
Instance Method Details
#before_setup(activity_instance, template) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 13 def before_setup(activity_instance, template) if (activity_instance.kind_of? Activity) $framework.before_activity_setup else doc = Nokogiri.XML(File.read(template)) doc.css('app_descriptor name').each do |element| title = element.content end end end |
#on_create(activity_instance, refresh = false) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/droiuby/spec/mock_objects/mock_environment.rb', line 26 def on_create(activity_instance, refresh = false) skip_content_view = if activity_instance.respond_to? :before_content_render activity_instance.before_content_render unless refresh end set_content_view unless skip_content_view instance.on_create instance end |