require File.expand_path("test_helper", File.dirname(__FILE__)) require 'fileutils' class BroadcastReceiverTest < Test::Unit::TestCase SRC_DIR ="#{APP_DIR}/src" def setup generate_app end def teardown cleanup_app end def test_generated_broadcast_receiver action_name = 'org.ruboto.example.click_broadcast' message = 'Broadcast received!' Dir.chdir APP_DIR do activity_filename = 'src/ruboto_test_app_activity.rb' activity_content = File.read(activity_filename) assert activity_content.sub!(/ def on_create\(bundle\)\n/, < false") assert test_content.sub!(/ button.performClick/, < 10) EOF assert test_content.sub!(/What hath Matz wrought!/, message) File.open(test_filename, 'w') { |f| f << test_content } end run_app_tests end end