smalruby-editor 0.2.6-x86-mingw32 → 0.2.7-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/.rubocop.yml +5 -0
 - data/Guardfile +2 -0
 - data/app/assets/javascripts/blocks/hardware.js.coffee.erb +1 -1
 - data/app/assets/javascripts/fix_blockly.js.erb +0 -50
 - data/app/assets/javascripts/generators/ruby.js.coffee.erb +18 -4
 - data/app/assets/javascripts/models/source_code.js +1 -1
 - data/app/assets/javascripts/msg/en_us.js +1 -0
 - data/app/assets/javascripts/msg/ja.js +4 -0
 - data/app/assets/javascripts/smalruby.js.coffee.erb +50 -6
 - data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +14 -4
 - data/app/assets/javascripts/views/preference_modal_view.js.coffee.erb +71 -0
 - data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +5 -4
 - data/app/assets/stylesheets/application.css +1 -0
 - data/app/assets/stylesheets/preference-modal.css.scss +22 -0
 - data/app/assets/stylesheets/toolbox.css.scss.erb +36 -0
 - data/app/controllers/application_controller.rb +20 -4
 - data/app/controllers/editor_controller.rb +4 -0
 - data/app/controllers/sessions_controller.rb +7 -4
 - data/app/controllers/source_codes_controller.rb +2 -2
 - data/app/controllers/users_controller.rb +22 -0
 - data/app/helpers/application_helper.rb +4 -4
 - data/app/helpers/sessions_helper.rb +0 -0
 - data/app/helpers/users_helper.rb +10 -0
 - data/app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb +0 -6
 - data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +0 -0
 - data/app/models/preference.rb +71 -0
 - data/app/models/source_code.rb +4 -0
 - data/app/models/user.rb +26 -0
 - data/app/views/editor/_block_tab.html.haml +5 -6
 - data/app/views/editor/_load_modal.html.haml +2 -2
 - data/app/views/editor/_preference_modal.html.haml +16 -0
 - data/app/views/editor/_signin_modal.html.haml +1 -1
 - data/app/views/editor/_toolbox_default.html.haml +86 -79
 - data/app/views/editor/{_toolbox_raspberrypi.html.haml → _toolbox_smalrubot.html.haml} +72 -105
 - data/app/views/editor/_toolbox_smalrubot_s1.html.haml +1 -196
 - data/app/views/editor/_toolbox_smalrubot_v3.html.haml +1 -196
 - data/app/views/editor/index.html.haml +11 -4
 - data/app/views/editor/toolbox.html.haml +1 -0
 - data/app/views/layouts/application.html.erb +1 -1
 - data/app/views/users/preferences.html.haml +34 -0
 - data/config/application.rb +1 -1
 - data/config/locales/en.yml +30 -0
 - data/config/locales/ja.yml +30 -0
 - data/config/routes.rb +4 -57
 - data/db/migrate/20150513061200_create_users.rb +10 -0
 - data/db/migrate/20150513061250_add_index_name_on_users.rb +9 -0
 - data/db/schema.rb +10 -1
 - data/lib/smalruby_editor.rb +22 -24
 - data/lib/smalruby_editor/version.rb +1 -1
 - data/smalruby-editor.gemspec +0 -0
 - data/spec/acceptance/block_mode/blocks/hardware/button_pressed_or_released.feature +2 -0
 - data/spec/acceptance/block_mode/blocks/hardware/init_hardware.feature +1 -0
 - data/spec/acceptance/block_mode/blocks/hardware/led_turn_off.feature +11 -1
 - data/spec/acceptance/block_mode/blocks/hardware/led_turn_on.feature +11 -1
 - data/spec/acceptance/block_mode/blocks/hardware/motor_driver.feature +7 -1
 - data/spec/acceptance/block_mode/blocks/hardware/motor_driver_speed.feature +2 -0
 - data/spec/acceptance/block_mode/blocks/hardware/rgb_led_set_color.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/rgb_led_turn_off.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/sensor_value.feature +59 -60
 - data/spec/acceptance/block_mode/blocks/hardware/servo_set_position.feature +76 -67
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +9 -11
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_dc_motor_power_ratio.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +9 -10
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_action_with_sec.feature +9 -11
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_dc_motor_power_ratio.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +9 -12
 - data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_sensor_value.feature +11 -12
 - data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature +7 -1
 - data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car_speed.feature +2 -0
 - data/spec/acceptance/standalone/preference.feature +92 -0
 - data/{demos → spec/fixtures/files}/hardware_led.rb.xml +0 -0
 - data/spec/javascripts/models/source_code_spec.coffee +0 -0
 - data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_spec.rb +1 -1
 - data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +4 -4
 - data/spec/models/concerns/ruby_to_block_spec.rb +1 -1
 - data/spec/models/source_code_spec.rb +1 -11
 - data/spec/spec_helper.rb +8 -0
 - data/spec/steps/base_steps.rb +68 -16
 - data/spec/steps/standalone_steps.rb +21 -0
 - data/spec/steps/text_editor_steps.rb +8 -8
 - data/spec/support/feature_helper.rb +13 -0
 - data/vendor/assets/javascripts/blockly/blockly_compressed.js +500 -454
 - data/vendor/assets/javascripts/blockly/blocks_compressed.js +29 -28
 - data/vendor/assets/javascripts/blockly/msg/js/ja.js +2 -1
 - metadata +33 -35
 - data/app/assets/stylesheets/toolbox_default.css.scss.erb +0 -34
 - data/app/assets/stylesheets/toolbox_raspberrypi.css.scss.erb +0 -32
 - data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +0 -32
 - data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +0 -32
 - data/demos/adjust_2wd_car.rb.xml +0 -179
 - data/lib/smalruby_editor/config.rb +0 -24
 - data/spec/controllers/editor_controller_spec.rb +0 -12
 - data/spec/controllers/sessions_controller_spec.rb +0 -74
 - data/spec/helpers/sessions_helper_spec.rb +0 -15
 
| 
         @@ -0,0 +1,92 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            # language: en
         
     | 
| 
      
 3 
     | 
    
         
            +
            @javascript
         
     | 
| 
      
 4 
     | 
    
         
            +
            @standalone
         
     | 
| 
      
 5 
     | 
    
         
            +
            Feature: Preference - 設定
         
     | 
| 
      
 6 
     | 
    
         
            +
              Background:
         
     | 
| 
      
 7 
     | 
    
         
            +
                When セッションをクリアする
         
     | 
| 
      
 8 
     | 
    
         
            +
                And '/' にアクセスする
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              Scenario: ログインして設定ダイアログを表示する
         
     | 
| 
      
 11 
     | 
    
         
            +
                When "submenu-button" をクリックする
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                Then "#submenu" に "#preference-button" が表示されていないこと
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                When ログインする
         
     | 
| 
      
 16 
     | 
    
         
            +
                And "submenu-button" をクリックする
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                Then "#submenu" に "#preference-button" が表示されていること
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                When サブメニューの "#preference-button" をクリックする
         
     | 
| 
      
 21 
     | 
    
         
            +
                And JavaScriptによるアニメーションが終わるまで待つ
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                Then "#preference-modal" が表示されていること
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                When "preference-modal-ok-button" をクリックする
         
     | 
| 
      
 26 
     | 
    
         
            +
                And JavaScriptによるリクエストが終わるまで待つ
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                Then "#preference-modal" が表示されていないこと
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                When ログアウトする
         
     | 
| 
      
 31 
     | 
    
         
            +
                And "submenu-button" をクリックする
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                Then "#submenu" に "#preference-button" が表示されていないこと
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              Scenario: ツールボックス "通常" の設定を変更する
         
     | 
| 
      
 36 
     | 
    
         
            +
                When ログインする
         
     | 
| 
      
 37 
     | 
    
         
            +
                And サブメニューの "#preference-button" をクリックする
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                Then "#preference-modal" が表示されていること
         
     | 
| 
      
 40 
     | 
    
         
            +
                And コンボボックス "user[preferences][toolbox_name]" の "通常" を選択していること
         
     | 
| 
      
 41 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_hardware_blocks" が表示されていること
         
     | 
| 
      
 42 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_hardware_blocks]" がチェックされていないこと
         
     | 
| 
      
 43 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_smalrubot_v3_blocks" が表示されていること
         
     | 
| 
      
 44 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_v3_blocks]" がチェックされていないこと
         
     | 
| 
      
 45 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_smalrubot_s1_blocks" が表示されていること
         
     | 
| 
      
 46 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_s1_blocks]" がチェックされていないこと
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                When "user[preferences][toolbox__default__enabled_hardware_blocks]" をチェックする
         
     | 
| 
      
 49 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_v3_blocks]" をチェックする
         
     | 
| 
      
 50 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_s1_blocks]" をチェックする
         
     | 
| 
      
 51 
     | 
    
         
            +
                And "preference-modal-ok-button" をクリックする
         
     | 
| 
      
 52 
     | 
    
         
            +
                And JavaScriptによるリクエストが終わるまで待つ
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                Then "#preference-modal" が表示されていないこと
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                When サブメニューの "#preference-button" をクリックする
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                Then "#preference-modal" が表示されていること
         
     | 
| 
      
 59 
     | 
    
         
            +
                And コンボボックス "user[preferences][toolbox_name]" の "通常" を選択していること
         
     | 
| 
      
 60 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_hardware_blocks" が表示されていること
         
     | 
| 
      
 61 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_hardware_blocks]" がチェックされていること
         
     | 
| 
      
 62 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_smalrubot_v3_blocks" が表示されていること
         
     | 
| 
      
 63 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_v3_blocks]" がチェックされていること
         
     | 
| 
      
 64 
     | 
    
         
            +
                And "#user_preferences_toolbox__default__enabled_smalrubot_s1_blocks" が表示されていること
         
     | 
| 
      
 65 
     | 
    
         
            +
                And "user[preferences][toolbox__default__enabled_smalrubot_s1_blocks]" がチェックされていること
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
              Scenario: 一般設定を変更する
         
     | 
| 
      
 68 
     | 
    
         
            +
                When ログインする
         
     | 
| 
      
 69 
     | 
    
         
            +
                And サブメニューの "#preference-button" をクリックする
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                Then "#preference-modal" が表示されていること
         
     | 
| 
      
 72 
     | 
    
         
            +
                And "user[preferences][disabled_add_character_from_beginning]" がチェックされていること
         
     | 
| 
      
 73 
     | 
    
         
            +
                And "user[preferences][disabled_new_character]" がチェックされていないこと
         
     | 
| 
      
 74 
     | 
    
         
            +
                And "user[preferences][enabled_auto_init_hardware]" がチェックされていないこと
         
     | 
| 
      
 75 
     | 
    
         
            +
                And "user[preferences][enabled_readonly_ruby_mode]" がチェックされていないこと
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                When "user[preferences][disabled_add_character_from_beginning]" のチェックを外す
         
     | 
| 
      
 78 
     | 
    
         
            +
                And "user[preferences][disabled_new_character]" をチェックする
         
     | 
| 
      
 79 
     | 
    
         
            +
                And "user[preferences][enabled_auto_init_hardware]" をチェックする
         
     | 
| 
      
 80 
     | 
    
         
            +
                And "user[preferences][enabled_readonly_ruby_mode]" をチェックする
         
     | 
| 
      
 81 
     | 
    
         
            +
                And "preference-modal-ok-button" をクリックする
         
     | 
| 
      
 82 
     | 
    
         
            +
                And JavaScriptによるリクエストが終わるまで待つ
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                Then "#preference-modal" が表示されていないこと
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                When サブメニューの "#preference-button" をクリックする
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                Then "#preference-modal" が表示されていること
         
     | 
| 
      
 89 
     | 
    
         
            +
                And "user[preferences][disabled_add_character_from_beginning]" がチェックされていないこと
         
     | 
| 
      
 90 
     | 
    
         
            +
                And "user[preferences][disabled_new_character]" がチェックされていること
         
     | 
| 
      
 91 
     | 
    
         
            +
                And "user[preferences][enabled_auto_init_hardware]" がチェックされていること
         
     | 
| 
      
 92 
     | 
    
         
            +
                And "user[preferences][enabled_readonly_ruby_mode]" がチェックされていること
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -11,6 +11,7 @@ describe RubyToBlock::Block, 'Smalrubot blocks', to_blocks: true do 
     | 
|
| 
       11 
11 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       14 
15 
     | 
    
         
             
            car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
17 
     | 
    
         
             
            car1.on(:start) do
         
     | 
| 
         @@ -69,7 +70,6 @@ car1.smalrubot_#{smalrubot_version}.right_dc_motor_power_ratio = 90 
     | 
|
| 
       69 
70 
     | 
    
         
             
                    it '結果が正しいこと' do
         
     | 
| 
       70 
71 
     | 
    
         
             
                      should eq_block_xml(<<-XML)
         
     | 
| 
       71 
72 
     | 
    
         
             
              <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
         
     | 
| 
       72 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       73 
73 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       74 
74 
     | 
    
         
             
                <field name="NAME">car1</field>
         
     | 
| 
       75 
75 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -9,6 +9,7 @@ describe RubyToBlock::Block, 'ハードウェアジャンル', to_blocks: true d 
     | 
|
| 
       9 
9 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       12 
13 
     | 
    
         
             
            car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
            car1.on(:start) do
         
     | 
| 
         @@ -40,7 +41,6 @@ end 
     | 
|
| 
       40 
41 
     | 
    
         
             
                it '結果が正しいこと' do
         
     | 
| 
       41 
42 
     | 
    
         
             
                  should eq_block_xml(<<-XML)
         
     | 
| 
       42 
43 
     | 
    
         
             
              <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
         
     | 
| 
       43 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       44 
44 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       45 
45 
     | 
    
         
             
                <field name="NAME">car1</field>
         
     | 
| 
       46 
46 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -201,6 +201,7 @@ end 
     | 
|
| 
       201 
201 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       202 
202 
     | 
    
         | 
| 
       203 
203 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
       204 
205 
     | 
    
         
             
            car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
       205 
206 
     | 
    
         | 
| 
       206 
207 
     | 
    
         
             
            car1.on(:start) do
         
     | 
| 
         @@ -220,7 +221,6 @@ car1.motor_driver("D3").stop 
     | 
|
| 
       220 
221 
     | 
    
         
             
                it '結果が正しいこと' do
         
     | 
| 
       221 
222 
     | 
    
         
             
                  should eq_block_xml(<<-XML)
         
     | 
| 
       222 
223 
     | 
    
         
             
              <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
         
     | 
| 
       223 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       224 
224 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       225 
225 
     | 
    
         
             
                <field name="NAME">car1</field>
         
     | 
| 
       226 
226 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -292,6 +292,7 @@ car1.motor_driver("D3").stop 
     | 
|
| 
       292 
292 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       293 
293 
     | 
    
         | 
| 
       294 
294 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 295 
     | 
    
         
            +
             
     | 
| 
       295 
296 
     | 
    
         
             
            car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
       296 
297 
     | 
    
         | 
| 
       297 
298 
     | 
    
         
             
            car1.on(:start) do
         
     | 
| 
         @@ -311,7 +312,6 @@ car1.two_wheel_drive_car("D5").stop 
     | 
|
| 
       311 
312 
     | 
    
         
             
                it '結果が正しいこと' do
         
     | 
| 
       312 
313 
     | 
    
         
             
                  should eq_block_xml(<<-XML)
         
     | 
| 
       313 
314 
     | 
    
         
             
              <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
         
     | 
| 
       314 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       315 
315 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       316 
316 
     | 
    
         
             
                <field name="NAME">car1</field>
         
     | 
| 
       317 
317 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -384,6 +384,7 @@ car1.two_wheel_drive_car("D5").stop 
     | 
|
| 
       384 
384 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       385 
385 
     | 
    
         | 
| 
       386 
386 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 387 
     | 
    
         
            +
             
     | 
| 
       387 
388 
     | 
    
         
             
            car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
         
     | 
| 
       388 
389 
     | 
    
         | 
| 
       389 
390 
     | 
    
         
             
            car1.on(:start) do
         
     | 
| 
         @@ -400,7 +401,6 @@ p(car1.button("D3").pressed?) 
     | 
|
| 
       400 
401 
     | 
    
         
             
                it '結果が正しいこと' do
         
     | 
| 
       401 
402 
     | 
    
         
             
                  should eq_block_xml(<<-XML)
         
     | 
| 
       402 
403 
     | 
    
         
             
              <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
         
     | 
| 
       403 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       404 
404 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       405 
405 
     | 
    
         
             
                <field name="NAME">car1</field>
         
     | 
| 
       406 
406 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -419,6 +419,7 @@ end 
     | 
|
| 
       419 
419 
     | 
    
         
             
            require "smalruby"
         
     | 
| 
       420 
420 
     | 
    
         | 
| 
       421 
421 
     | 
    
         
             
            init_hardware
         
     | 
| 
      
 422 
     | 
    
         
            +
             
     | 
| 
       422 
423 
     | 
    
         
             
            frog1 = Character.new(costume: "frog1.png", x: 261, y: 191, angle: 0)
         
     | 
| 
       423 
424 
     | 
    
         | 
| 
       424 
425 
     | 
    
         
             
            frog1.on(:click) do
         
     | 
| 
         @@ -440,7 +441,6 @@ end 
     | 
|
| 
       440 
441 
     | 
    
         
             
                  it '結果が正しいこと' do
         
     | 
| 
       441 
442 
     | 
    
         
             
                    should eq_block_xml(<<-XML)
         
     | 
| 
       442 
443 
     | 
    
         
             
              <character name="frog1" x="261" y="191" angle="0" costumes="frog1.png" />
         
     | 
| 
       443 
     | 
    
         
            -
              <block type="hardware_init_hardware" />
         
     | 
| 
       444 
444 
     | 
    
         
             
              <block type="character_new">
         
     | 
| 
       445 
445 
     | 
    
         
             
                <field name="NAME">frog1</field>
         
     | 
| 
       446 
446 
     | 
    
         
             
                <statement name="DO">
         
     | 
| 
         @@ -102,16 +102,6 @@ describe SourceCode, 'Rubyのソースコードを表現するモデル' do 
     | 
|
| 
       102 
102 
     | 
    
         
             
                      filename: 'pong.rb',
         
     | 
| 
       103 
103 
     | 
    
         
             
                      imageUrl: '/smalruby/assets/cat2.png',
         
     | 
| 
       104 
104 
     | 
    
         
             
                    },
         
     | 
| 
       105 
     | 
    
         
            -
                    hardware_led: {
         
     | 
| 
       106 
     | 
    
         
            -
                      title: 'ライトをぴかっとさせるでよ',
         
     | 
| 
       107 
     | 
    
         
            -
                      filename: 'hardware_led.rb',
         
     | 
| 
       108 
     | 
    
         
            -
                      imageUrl: '/smalruby/assets/frog1.png',
         
     | 
| 
       109 
     | 
    
         
            -
                    },
         
     | 
| 
       110 
     | 
    
         
            -
                    adjust_2wd_car: {
         
     | 
| 
       111 
     | 
    
         
            -
                      title: '2WD車の左右のモーターを調整する',
         
     | 
| 
       112 
     | 
    
         
            -
                      filename: 'adjust_2wd_car.rb',
         
     | 
| 
       113 
     | 
    
         
            -
                      imageUrl: '/smalruby/assets/car2.png',
         
     | 
| 
       114 
     | 
    
         
            -
                    },
         
     | 
| 
       115 
105 
     | 
    
         
             
                  }.each do |name, summary|
         
     | 
| 
       116 
106 
     | 
    
         
             
                    _rb_path = "demos/#{name}.rb"
         
     | 
| 
       117 
107 
     | 
    
         
             
                    context "'#{_rb_path + '.xml'}'" do
         
     | 
| 
         @@ -152,7 +142,7 @@ describe SourceCode, 'Rubyのソースコードを表現するモデル' do 
     | 
|
| 
       152 
142 
     | 
    
         
             
                  subject { source_code.include_block?(type) }
         
     | 
| 
       153 
143 
     | 
    
         | 
| 
       154 
144 
     | 
    
         
             
                  context 'ソースコードにハードウェア関連ブロックを含む場合' do
         
     | 
| 
       155 
     | 
    
         
            -
                    let(:xml_path) { ' 
     | 
| 
      
 145 
     | 
    
         
            +
                    let(:xml_path) { 'spec/fixtures/files/hardware_led.rb.xml' }
         
     | 
| 
       156 
146 
     | 
    
         | 
| 
       157 
147 
     | 
    
         
             
                    context '引数にhardware_init_hardwareを指定する' do
         
     | 
| 
       158 
148 
     | 
    
         
             
                      let(:type) { 'hardware_init_hardware' }
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -98,6 +98,14 @@ RSpec.configure do |config| 
     | 
|
| 
       98 
98 
     | 
    
         
             
              config.include ERB::Util, type: :helper
         
     | 
| 
       99 
99 
     | 
    
         
             
              config.include ERB::Util, type: :feature
         
     | 
| 
       100 
100 
     | 
    
         
             
              config.include ActionView::Helpers::JavaScriptHelper, type: :feature
         
     | 
| 
      
 101 
     | 
    
         
            +
              config.include FeatureHelper, type: :feature
         
     | 
| 
      
 102 
     | 
    
         
            +
             
     | 
| 
      
 103 
     | 
    
         
            +
              config.before(:all) do
         
     | 
| 
      
 104 
     | 
    
         
            +
                Preference.defaults.each do |key, value|
         
     | 
| 
      
 105 
     | 
    
         
            +
                  Preference[key] = value
         
     | 
| 
      
 106 
     | 
    
         
            +
                end
         
     | 
| 
      
 107 
     | 
    
         
            +
                Preference["disabled_add_character_from_beginning"] = true
         
     | 
| 
      
 108 
     | 
    
         
            +
              end
         
     | 
| 
       101 
109 
     | 
    
         | 
| 
       102 
110 
     | 
    
         
             
              config.after(javascript: true) do
         
     | 
| 
       103 
111 
     | 
    
         
             
                page.execute_script('window.onbeforeunload = null')
         
     | 
    
        data/spec/steps/base_steps.rb
    CHANGED
    
    | 
         @@ -6,7 +6,7 @@ end 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            step ':name にアクセスする' do |name|
         
     | 
| 
       8 
8 
     | 
    
         
             
              page.driver.headers = { 'Accept-Language' => 'ja' }
         
     | 
| 
       9 
     | 
    
         
            -
              visit  
     | 
| 
      
 9 
     | 
    
         
            +
              visit name_to(name, :path)
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              if poltergeist?
         
     | 
| 
       12 
12 
     | 
    
         
             
                page.execute_script('window.confirmResult = true')
         
     | 
| 
         @@ -27,16 +27,60 @@ step ':name 画面を表示する' do |name| 
     | 
|
| 
       27 
27 
     | 
    
         
             
            end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
            step ':name が表示されていること' do |name|
         
     | 
| 
       30 
     | 
    
         
            -
              expect(page).to have_selector( 
     | 
| 
      
 30 
     | 
    
         
            +
              expect(page).to have_selector(name_to(name))
         
     | 
| 
       31 
31 
     | 
    
         
             
            end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
            step ':name が表示されていないこと' do |name|
         
     | 
| 
       34 
     | 
    
         
            -
              expect(page).not_to have_selector( 
     | 
| 
      
 34 
     | 
    
         
            +
              expect(page).not_to have_selector(name_to(name))
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            step ':parent に :name が表示されていること' do |parent, name|
         
     | 
| 
      
 38 
     | 
    
         
            +
              within(name_to(parent)) do
         
     | 
| 
      
 39 
     | 
    
         
            +
                expect(page.all(name_to(name), visible: true)).not_to be_empty
         
     | 
| 
      
 40 
     | 
    
         
            +
              end
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            step ':parent に :name が表示されていないこと' do |parent, name|
         
     | 
| 
      
 44 
     | 
    
         
            +
              within(name_to(parent)) do
         
     | 
| 
      
 45 
     | 
    
         
            +
                expect(page.all(name_to(name), visible: true)).to be_empty
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            step 'コンボボックス :name の :option_label を選択していること' do
         
     | 
| 
      
 50 
     | 
    
         
            +
              |name, option_label|
         
     | 
| 
      
 51 
     | 
    
         
            +
              expect(find(%{select[name="#{name}"] option[selected]}).text)
         
     | 
| 
      
 52 
     | 
    
         
            +
                .to eq(option_label)
         
     | 
| 
      
 53 
     | 
    
         
            +
            end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            step 'コンボボックス :name の :option_label を選択していないこと' do
         
     | 
| 
      
 56 
     | 
    
         
            +
              |name, option_label|
         
     | 
| 
      
 57 
     | 
    
         
            +
              expect(find(%{select[name="#{name}"] option[selected]}).text)
         
     | 
| 
      
 58 
     | 
    
         
            +
                .not_to eq(option_label)
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            step ':name に :value を指定する' do |name, value|
         
     | 
| 
      
 62 
     | 
    
         
            +
              fill_in(name_to(name, :id), with: value)
         
     | 
| 
      
 63 
     | 
    
         
            +
            end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            step ':name をチェックする' do |name|
         
     | 
| 
      
 66 
     | 
    
         
            +
              check(name)
         
     | 
| 
      
 67 
     | 
    
         
            +
            end
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            step ':name のチェックを外す' do |name|
         
     | 
| 
      
 70 
     | 
    
         
            +
              uncheck(name)
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
            step ':name がチェックされていること' do |name|
         
     | 
| 
      
 74 
     | 
    
         
            +
              expect(find(%{input[type="checkbox"][name="#{name}"]})).to be_checked
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            step ':name がチェックされていないこと' do |name|
         
     | 
| 
      
 78 
     | 
    
         
            +
              expect(find(%{input[type="checkbox"][name="#{name}"]})).not_to be_checked
         
     | 
| 
       35 
79 
     | 
    
         
             
            end
         
     | 
| 
       36 
80 
     | 
    
         | 
| 
       37 
81 
     | 
    
         
             
            step ':name にタブを切り替える' do |name|
         
     | 
| 
       38 
82 
     | 
    
         
             
              page.execute_script(<<-JS)
         
     | 
| 
       39 
     | 
    
         
            -
                $('#tabs a[href=\"#{ 
     | 
| 
      
 83 
     | 
    
         
            +
                $('#tabs a[href=\"#{name_to(name)}\"]').click()
         
     | 
| 
       40 
84 
     | 
    
         
             
              JS
         
     | 
| 
       41 
85 
     | 
    
         
             
            end
         
     | 
| 
       42 
86 
     | 
    
         | 
| 
         @@ -45,10 +89,6 @@ step ':name タブを表示する' do |name| 
     | 
|
| 
       45 
89 
     | 
    
         
             
              step %("#{name}タブ" にタブを切り替える)
         
     | 
| 
       46 
90 
     | 
    
         
             
            end
         
     | 
| 
       47 
91 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
            step ':name に :value を指定する' do |name, value|
         
     | 
| 
       49 
     | 
    
         
            -
              fill_in(NAME_INFO.key?(name) ? NAME_INFO[name][:id] : name, with: value)
         
     | 
| 
       50 
     | 
    
         
            -
            end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
92 
     | 
    
         
             
            step 'プログラムの名前に :filename を指定する' do |filename|
         
     | 
| 
       53 
93 
     | 
    
         
             
              step %("プログラム名の入力欄" に "#{filename}" を指定する)
         
     | 
| 
       54 
94 
     | 
    
         
             
            end
         
     | 
| 
         @@ -56,12 +96,14 @@ end 
     | 
|
| 
       56 
96 
     | 
    
         
             
            step 'サブメニューの :name をクリックする' do |name|
         
     | 
| 
       57 
97 
     | 
    
         
             
              # HACK: 以下では期待通りの動作にならなかったのでjQueryで無理やり実現した
         
     | 
| 
       58 
98 
     | 
    
         
             
              # click_on('submenu-button')
         
     | 
| 
       59 
     | 
    
         
            -
              # click_on( 
     | 
| 
       60 
     | 
    
         
            -
              page.execute_script("$('#{ 
     | 
| 
      
 99 
     | 
    
         
            +
              # click_on(name_to(name, :id))
         
     | 
| 
      
 100 
     | 
    
         
            +
              page.execute_script("$('#{name_to(name)}').click()")
         
     | 
| 
      
 101 
     | 
    
         
            +
              step %{JavaScriptによるリクエストが終わるまで待つ}
         
     | 
| 
      
 102 
     | 
    
         
            +
              step %{JavaScriptによるアニメーションが終わるまで待つ}
         
     | 
| 
       61 
103 
     | 
    
         
             
            end
         
     | 
| 
       62 
104 
     | 
    
         | 
| 
       63 
105 
     | 
    
         
             
            step ':name をクリックする' do |name|
         
     | 
| 
       64 
     | 
    
         
            -
              click_on( 
     | 
| 
      
 106 
     | 
    
         
            +
              click_on(name_to(name, :id))
         
     | 
| 
       65 
107 
     | 
    
         
             
            end
         
     | 
| 
       66 
108 
     | 
    
         | 
| 
       67 
109 
     | 
    
         
             
            step 'ダウンロードが完了するまで待つ' do
         
     | 
| 
         @@ -98,7 +140,7 @@ end 
     | 
|
| 
       98 
140 
     | 
    
         | 
| 
       99 
141 
     | 
    
         
             
            step ':name にフォーカスを移す' do |name|
         
     | 
| 
       100 
142 
     | 
    
         
             
              page.execute_script(<<-JS)
         
     | 
| 
       101 
     | 
    
         
            -
                $('#{ 
     | 
| 
      
 143 
     | 
    
         
            +
                $('#{name_to(name)}').focus()
         
     | 
| 
       102 
144 
     | 
    
         
             
              JS
         
     | 
| 
       103 
145 
     | 
    
         
             
            end
         
     | 
| 
       104 
146 
     | 
    
         | 
| 
         @@ -106,7 +148,7 @@ step ':name にフォーカスがあること' do |name| 
     | 
|
| 
       106 
148 
     | 
    
         
             
              # HACK: 現在のPhantomJSでは$(':focus')は動作しない
         
     | 
| 
       107 
149 
     | 
    
         
             
              # https://github.com/netzpirat/guard-jasmine/issues/48
         
     | 
| 
       108 
150 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to be_true
         
     | 
| 
       109 
     | 
    
         
            -
                $('#{ 
     | 
| 
      
 151 
     | 
    
         
            +
                $('#{name_to(name)}').get(0) == document.activeElement
         
     | 
| 
       110 
152 
     | 
    
         
             
              JS
         
     | 
| 
       111 
153 
     | 
    
         
             
            end
         
     | 
| 
       112 
154 
     | 
    
         | 
| 
         @@ -145,16 +187,16 @@ end 
     | 
|
| 
       145 
187 
     | 
    
         | 
| 
       146 
188 
     | 
    
         
             
            step ':name は :value であること' do |name, value|
         
     | 
| 
       147 
189 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to eq(value)
         
     | 
| 
       148 
     | 
    
         
            -
                $('#{ 
     | 
| 
      
 190 
     | 
    
         
            +
                $('#{name_to(name)}').val()
         
     | 
| 
       149 
191 
     | 
    
         
             
              JS
         
     | 
| 
       150 
192 
     | 
    
         
             
            end
         
     | 
| 
       151 
193 
     | 
    
         | 
| 
       152 
194 
     | 
    
         
             
            step ':name に :message を含むこと' do |name, message|
         
     | 
| 
       153 
     | 
    
         
            -
              expect(page.find( 
     | 
| 
      
 195 
     | 
    
         
            +
              expect(page.find(name_to(name))).to have_content(message)
         
     | 
| 
       154 
196 
     | 
    
         
             
            end
         
     | 
| 
       155 
197 
     | 
    
         | 
| 
       156 
198 
     | 
    
         
             
            step ':name に :message を含まないこと' do |name, message|
         
     | 
| 
       157 
     | 
    
         
            -
              expect(page.find( 
     | 
| 
      
 199 
     | 
    
         
            +
              expect(page.find(name_to(name))).not_to have_content(message)
         
     | 
| 
       158 
200 
     | 
    
         
             
            end
         
     | 
| 
       159 
201 
     | 
    
         | 
| 
       160 
202 
     | 
    
         
             
            step 'ページをリロードする' do
         
     | 
| 
         @@ -278,3 +320,13 @@ step ':directory ディレクトリの :filename の内容が :program である 
     | 
|
| 
       278 
320 
     | 
    
         
             
              path = Pathname("#{directory}/#{filename}").expand_path
         
     | 
| 
       279 
321 
     | 
    
         
             
              expect(path.read).to eq(program)
         
     | 
| 
       280 
322 
     | 
    
         
             
            end
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
            step 'ページを表示する' do
         
     | 
| 
      
 325 
     | 
    
         
            +
              # no-op
         
     | 
| 
      
 326 
     | 
    
         
            +
            end
         
     | 
| 
      
 327 
     | 
    
         
            +
             
     | 
| 
      
 328 
     | 
    
         
            +
            steps_for :debug do
         
     | 
| 
      
 329 
     | 
    
         
            +
              step 'ページを表示する' do
         
     | 
| 
      
 330 
     | 
    
         
            +
                save_and_open_page
         
     | 
| 
      
 331 
     | 
    
         
            +
              end
         
     | 
| 
      
 332 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            step ":name としてログインする" do |name|
         
     | 
| 
      
 4 
     | 
    
         
            +
              step %{"signin-button" をクリックする}
         
     | 
| 
      
 5 
     | 
    
         
            +
              step %{JavaScriptによるアニメーションが終わるまで待つ}
         
     | 
| 
      
 6 
     | 
    
         
            +
              step %{"signin-modal-username" に "#{name}" を指定する}
         
     | 
| 
      
 7 
     | 
    
         
            +
              step %{"signin-modal-ok-button" をクリックする}
         
     | 
| 
      
 8 
     | 
    
         
            +
              step %{JavaScriptによるリクエストが終わるまで待つ}
         
     | 
| 
      
 9 
     | 
    
         
            +
              step %{JavaScriptによるアニメーションが終わるまで待つ}
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            step "ログインする" do
         
     | 
| 
      
 13 
     | 
    
         
            +
              step %{"1102" としてログインする}
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            step "ログアウトする" do
         
     | 
| 
      
 17 
     | 
    
         
            +
              step %{"submenu-button" をクリックする}
         
     | 
| 
      
 18 
     | 
    
         
            +
              step %{サブメニューの "#signout-button" をクリックする}
         
     | 
| 
      
 19 
     | 
    
         
            +
              step %{JavaScriptによるリクエストが終わるまで待つ}
         
     | 
| 
      
 20 
     | 
    
         
            +
              step %{"#main-menu" に "ログイン" を含むこと}
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -4,13 +4,13 @@ text_editor = 'テキストエディタ' 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            step 'テキストエディタにフォーカスがあること' do
         
     | 
| 
       6 
6 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to be_true
         
     | 
| 
       7 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 7 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}').isFocused()
         
     | 
| 
       8 
8 
     | 
    
         
             
              JS
         
     | 
| 
       9 
9 
     | 
    
         
             
            end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
            step 'テキストエディタの :row 行目の :column 文字目にカーソルがあること' do |row, column|
         
     | 
| 
       12 
12 
     | 
    
         
             
              get_cursor_position_js =
         
     | 
| 
       13 
     | 
    
         
            -
                "ace.edit('#{ 
     | 
| 
      
 13 
     | 
    
         
            +
                "ace.edit('#{name_to(text_editor, :id)}').getCursorPosition()"
         
     | 
| 
       14 
14 
     | 
    
         
             
              expect(page.evaluate_script("#{get_cursor_position_js}.row")).to eq(row.to_i)
         
     | 
| 
       15 
15 
     | 
    
         
             
              expect(page.evaluate_script("#{get_cursor_position_js}.column"))
         
     | 
| 
       16 
16 
     | 
    
         
             
                .to eq(column.to_i)
         
     | 
| 
         @@ -22,7 +22,7 @@ end 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            step 'テキストエディタにプログラムを入力済みである:' do |program|
         
     | 
| 
       24 
24 
     | 
    
         
             
              page.execute_script(<<-JS)
         
     | 
| 
       25 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 25 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       26 
26 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       27 
27 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       28 
28 
     | 
    
         
             
                  .setValue('#{program.gsub(/'/, "\\\\'").gsub(/\r?\n/, '\n')}')
         
     | 
| 
         @@ -31,7 +31,7 @@ end 
     | 
|
| 
       31 
31 
     | 
    
         | 
| 
       32 
32 
     | 
    
         
             
            step 'テキストエディタに :filename を読み込むこと' do |filename|
         
     | 
| 
       33 
33 
     | 
    
         
             
              js = <<-JS
         
     | 
| 
       34 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 34 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       35 
35 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       36 
36 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       37 
37 
     | 
    
         
             
                  .getValue()
         
     | 
| 
         @@ -42,7 +42,7 @@ end 
     | 
|
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
            step 'テキストエディタのプログラムは以下であること:' do |program|
         
     | 
| 
       44 
44 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to eq(program)
         
     | 
| 
       45 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 45 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       46 
46 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       47 
47 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       48 
48 
     | 
    
         
             
                  .getValue()
         
     | 
| 
         @@ -51,7 +51,7 @@ end 
     | 
|
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
            step 'テキストエディタのプログラムは以下を含むこと:' do |program|
         
     | 
| 
       53 
53 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to include(program)
         
     | 
| 
       54 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 54 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       55 
55 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       56 
56 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       57 
57 
     | 
    
         
             
                  .getValue()
         
     | 
| 
         @@ -60,7 +60,7 @@ end 
     | 
|
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
            step 'テキストエディタのプログラムは以下を含まないこと:' do |program|
         
     | 
| 
       62 
62 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).not_to include(program)
         
     | 
| 
       63 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 63 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       64 
64 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       65 
65 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       66 
66 
     | 
    
         
             
                  .getValue()
         
     | 
| 
         @@ -69,7 +69,7 @@ end 
     | 
|
| 
       69 
69 
     | 
    
         | 
| 
       70 
70 
     | 
    
         
             
            step 'テキストエディタのプログラムは :program であること' do |program|
         
     | 
| 
       71 
71 
     | 
    
         
             
              expect(page.evaluate_script(<<-JS)).to eq(program)
         
     | 
| 
       72 
     | 
    
         
            -
                ace.edit('#{ 
     | 
| 
      
 72 
     | 
    
         
            +
                ace.edit('#{name_to(text_editor, :id)}')
         
     | 
| 
       73 
73 
     | 
    
         
             
                  .getSession()
         
     | 
| 
       74 
74 
     | 
    
         
             
                  .getDocument()
         
     | 
| 
       75 
75 
     | 
    
         
             
                  .getValue()
         
     |