smalruby-editor 0.1.6-x86-mingw32 → 0.1.7-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of smalruby-editor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/javascripts/blocks/hardware.js.coffee.erb +40 -3
- data/app/assets/stylesheets/toolbox.css.scss.erb +1 -6
- data/app/controllers/source_codes_controller.rb +5 -1
- data/app/models/concerns/ruby_to_block/block/base.rb +251 -0
- data/app/models/concerns/ruby_to_block/block/character.rb +42 -0
- data/app/models/concerns/ruby_to_block/block/character_event.rb +27 -0
- data/app/models/concerns/ruby_to_block/block/character_method_call.rb +29 -0
- data/app/models/concerns/ruby_to_block/block/character_new.rb +7 -0
- data/app/models/concerns/ruby_to_block/block/character_operation.rb +80 -0
- data/app/models/concerns/ruby_to_block/block/control_if.rb +45 -0
- data/app/models/concerns/ruby_to_block/block/control_loop.rb +19 -0
- data/app/models/concerns/ruby_to_block/block/control_sleep.rb +18 -0
- data/app/models/concerns/ruby_to_block/block/do.rb +24 -0
- data/app/models/concerns/ruby_to_block/block/else.rb +12 -0
- data/app/models/concerns/ruby_to_block/block/end.rb +26 -0
- data/app/models/concerns/ruby_to_block/block/events_on_click.rb +14 -0
- data/app/models/concerns/ruby_to_block/block/events_on_key_push_or_down.rb +17 -0
- data/app/models/concerns/ruby_to_block/block/events_on_start.rb +14 -0
- data/app/models/concerns/ruby_to_block/block/hardware_init_hardware.rb +14 -0
- data/app/models/concerns/ruby_to_block/block/hardware_led_off.rb +16 -0
- data/app/models/concerns/ruby_to_block/block/hardware_led_on.rb +16 -0
- data/app/models/concerns/ruby_to_block/block/hardware_on_sensor_change.rb +17 -0
- data/app/models/concerns/ruby_to_block/block/hardware_rgb_led_off.rb +18 -0
- data/app/models/concerns/ruby_to_block/block/hardware_rgb_led_on.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/hardware_sensor_value.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car.rb +26 -0
- data/app/models/concerns/ruby_to_block/block/looks_hide.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/looks_say.rb +20 -0
- data/app/models/concerns/ruby_to_block/block/looks_show.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/looks_vanish.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/math_number.rb +14 -0
- data/app/models/concerns/ruby_to_block/block/motion_change_x_by.rb +20 -0
- data/app/models/concerns/ruby_to_block/block/motion_change_y_by.rb +20 -0
- data/app/models/concerns/ruby_to_block/block/motion_move.rb +15 -0
- data/app/models/concerns/ruby_to_block/block/motion_point_towards_character.rb +24 -0
- data/app/models/concerns/ruby_to_block/block/motion_point_towards_mouse.rb +9 -0
- data/app/models/concerns/ruby_to_block/block/motion_reach_wall.rb +24 -0
- data/app/models/concerns/ruby_to_block/block/motion_rotate_left.rb +20 -0
- data/app/models/concerns/ruby_to_block/block/motion_rotate_right.rb +20 -0
- data/app/models/concerns/ruby_to_block/block/motion_self_angle.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/motion_self_x.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/motion_self_y.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/motion_set_angle.rb +15 -0
- data/app/models/concerns/ruby_to_block/block/motion_set_x.rb +38 -0
- data/app/models/concerns/ruby_to_block/block/motion_set_y.rb +15 -0
- data/app/models/concerns/ruby_to_block/block/motion_turn.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/motion_turn_if_reach_wall.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/null.rb +17 -0
- data/app/models/concerns/ruby_to_block/block/operators_compare.rb +36 -0
- data/app/models/concerns/ruby_to_block/block/operators_false.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/operators_true.rb +8 -0
- data/app/models/concerns/ruby_to_block/block/require_smalruby.rb +7 -0
- data/app/models/concerns/ruby_to_block/block/ruby_comment.rb +16 -0
- data/app/models/concerns/ruby_to_block/block/ruby_expression.rb +14 -0
- data/app/models/concerns/ruby_to_block/block/ruby_statement.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/sensing_hit.rb +23 -0
- data/app/models/concerns/ruby_to_block/block/sound_play.rb +15 -0
- data/app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb +31 -0
- data/app/models/concerns/ruby_to_block/block/text.rb +15 -0
- data/app/models/concerns/ruby_to_block/block/value.rb +12 -0
- data/app/models/concerns/ruby_to_block/block.rb +97 -0
- data/app/models/concerns/ruby_to_block/context.rb +97 -0
- data/app/models/concerns/ruby_to_block/formatter.rb +26 -0
- data/app/models/concerns/ruby_to_block.rb +17 -360
- data/app/models/source_code.rb +3 -1
- data/app/views/editor/_toolbox.html.haml +16 -0
- data/lib/smalruby_editor/version.rb +3 -3
- data/public/assets/{application-64a390efe879c386a5950515064f062d.css → application-28b7bed56c5389dfa372e972c75b6676.css} +17 -10
- data/public/assets/application-28b7bed56c5389dfa372e972c75b6676.css.gz +0 -0
- data/public/assets/{application-8bfffad1222d4e198f3c7ccc1cbd774f.js → application-4f747690ebc8ec4815ae36021fdb2c44.js} +135 -0
- data/public/assets/{application-8bfffad1222d4e198f3c7ccc1cbd774f.js.gz → application-4f747690ebc8ec4815ae36021fdb2c44.js.gz} +0 -0
- data/public/assets/manifest-332a5a1668194028b55103e0ea45c054.json +1 -1
- data/smalruby-editor.gemspec +1 -1
- data/spec/acceptance/block_mode/blocks/hardware/two_wheel_drive_car.feature +69 -0
- data/spec/acceptance/ruby_mode/translate.feature +1 -1
- data/spec/controllers/source_codes_controller_spec.rb +14 -11
- data/spec/models/concerns/ruby_to_block/block/character_method_call_spec.rb +175 -0
- data/spec/models/concerns/ruby_to_block/block/control_if_spec.rb +75 -0
- data/spec/models/concerns/ruby_to_block/block/control_loop_spec.rb +68 -0
- data/spec/models/concerns/ruby_to_block/block/events_on_start_spec.rb +120 -0
- data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +120 -0
- data/spec/models/concerns/ruby_to_block/block/looks_say_spec.rb +79 -0
- data/spec/models/concerns/ruby_to_block/block/looks_spec.rb +74 -0
- data/spec/models/concerns/ruby_to_block/block/motion_move_spec.rb +63 -0
- data/spec/models/concerns/ruby_to_block/block/motion_reach_wall_spec.rb +67 -0
- data/spec/models/concerns/ruby_to_block/block/motion_spec.rb +392 -0
- data/spec/models/concerns/ruby_to_block/block/motion_turn_spec.rb +54 -0
- data/spec/models/concerns/ruby_to_block/block/require_smalruby_spec.rb +39 -0
- data/spec/models/concerns/ruby_to_block/block/ruby_comment_spec.rb +55 -0
- data/spec/models/concerns/ruby_to_block/block/ruby_statement_spec.rb +113 -0
- data/spec/models/concerns/ruby_to_block/block/shared/block_examples.rb +44 -0
- data/spec/models/concerns/ruby_to_block/block/sound_spec.rb +46 -0
- data/spec/models/concerns/ruby_to_block/block_spec.rb +49 -0
- data/spec/models/concerns/ruby_to_block_spec.rb +421 -217
- data/spec/support/ruby_to_block.rb +10 -0
- metadata +108 -10
- data/public/assets/application-64a390efe879c386a5950515064f062d.css.gz +0 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative 'shared/block_examples'
|
4
|
+
|
5
|
+
# rubocop:disable EmptyLines, LineLength
|
6
|
+
|
7
|
+
describe RubyToBlock::Block::MotionTurn, to_blocks: true do
|
8
|
+
_parts = <<-EOS
|
9
|
+
turn
|
10
|
+
EOS
|
11
|
+
describe compact_source_code(_parts), on_start_data: true do
|
12
|
+
__parts = _parts
|
13
|
+
let(:parts) { __parts }
|
14
|
+
|
15
|
+
it '結果が正しいこと' do
|
16
|
+
should eq_block_xml(<<-XML)
|
17
|
+
<block type="motion_turn" />
|
18
|
+
XML
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
_parts = <<-EOS
|
23
|
+
car1.turn
|
24
|
+
EOS
|
25
|
+
describe compact_source_code(_parts), character_new_data: true do
|
26
|
+
__parts = _parts
|
27
|
+
let(:parts) { __parts }
|
28
|
+
|
29
|
+
it '結果が正しいこと' do
|
30
|
+
should eq_block_xml(<<-XML)
|
31
|
+
<field name="NAME">car1</field>
|
32
|
+
<statement name="DO">
|
33
|
+
<block type="motion_turn" />
|
34
|
+
</statement>
|
35
|
+
XML
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
_parts = <<-EOS
|
40
|
+
turn
|
41
|
+
EOS
|
42
|
+
describe compact_source_code(_parts) do
|
43
|
+
__parts = _parts
|
44
|
+
let(:data) { __parts }
|
45
|
+
|
46
|
+
it '結果が正しいこと' do
|
47
|
+
should eq_block_xml(<<-XML)
|
48
|
+
<block type="ruby_statement">
|
49
|
+
<field name="STATEMENT">turn</field>
|
50
|
+
</block>
|
51
|
+
XML
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative 'shared/block_examples'
|
4
|
+
|
5
|
+
# rubocop:disable EmptyLines, LineLength
|
6
|
+
|
7
|
+
describe RubyToBlock::Block::RequireSmalruby, to_blocks: true do
|
8
|
+
_data = 'require "smalruby"'
|
9
|
+
describe compact_source_code(_data) do
|
10
|
+
__data = _data
|
11
|
+
let(:data) { __data }
|
12
|
+
|
13
|
+
it { should eq('') }
|
14
|
+
end
|
15
|
+
|
16
|
+
_data = ' require "smalruby"'
|
17
|
+
describe compact_source_code(_data) do
|
18
|
+
__data = _data
|
19
|
+
let(:data) { __data }
|
20
|
+
|
21
|
+
it { should eq('') }
|
22
|
+
end
|
23
|
+
|
24
|
+
_data = 'require "smalruby" '
|
25
|
+
describe compact_source_code(_data) do
|
26
|
+
__data = _data
|
27
|
+
let(:data) { __data }
|
28
|
+
|
29
|
+
it { should eq('') }
|
30
|
+
end
|
31
|
+
|
32
|
+
_data = ' require "smalruby" '
|
33
|
+
describe compact_source_code(_data) do
|
34
|
+
__data = _data
|
35
|
+
let(:data) { __data }
|
36
|
+
|
37
|
+
it { should eq('') }
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative 'shared/block_examples'
|
4
|
+
|
5
|
+
# rubocop:disable EmptyLines, LineLength
|
6
|
+
|
7
|
+
describe RubyToBlock::Block::RubyComment, to_blocks: true do
|
8
|
+
_data = <<-EOS
|
9
|
+
# 逃げる車
|
10
|
+
EOS
|
11
|
+
describe compact_source_code(_data) do
|
12
|
+
__data = _data
|
13
|
+
let(:data) { __data }
|
14
|
+
|
15
|
+
it '結果が正しいこと' do
|
16
|
+
should eq_block_xml(<<-XML)
|
17
|
+
<block type="ruby_comment">
|
18
|
+
<field name="COMMENT">逃げる車</field>
|
19
|
+
</block>
|
20
|
+
XML
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
_data = <<-EOS
|
25
|
+
# 逃げる車
|
26
|
+
EOS
|
27
|
+
describe compact_source_code(_data) do
|
28
|
+
__data = _data
|
29
|
+
let(:data) { __data }
|
30
|
+
|
31
|
+
it '結果が正しいこと' do
|
32
|
+
should eq_block_xml(<<-XML)
|
33
|
+
<block type="ruby_comment">
|
34
|
+
<field name="COMMENT"> 逃げる車</field>
|
35
|
+
</block>
|
36
|
+
XML
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
_data = <<-EOS
|
41
|
+
#逃げる車
|
42
|
+
EOS
|
43
|
+
describe compact_source_code(_data) do
|
44
|
+
__data = _data
|
45
|
+
let(:data) { __data }
|
46
|
+
|
47
|
+
it '結果が正しいこと' do
|
48
|
+
should eq_block_xml(<<-XML)
|
49
|
+
<block type="ruby_statement">
|
50
|
+
<field name="STATEMENT">#逃げる車</field>
|
51
|
+
</block>
|
52
|
+
XML
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative 'shared/block_examples'
|
4
|
+
|
5
|
+
# rubocop:disable EmptyLines, LineLength
|
6
|
+
|
7
|
+
describe RubyToBlock::Block::RubyStatement, to_blocks: true do
|
8
|
+
parts = <<-EOS
|
9
|
+
s = :a
|
10
|
+
case s
|
11
|
+
when :a
|
12
|
+
puts "エー"
|
13
|
+
when :b
|
14
|
+
puts "ビー"
|
15
|
+
end
|
16
|
+
EOS
|
17
|
+
describe compact_source_code(parts), on_start_data: true do
|
18
|
+
_parts = parts
|
19
|
+
let(:parts) { _parts }
|
20
|
+
|
21
|
+
it '結果が正しいこと' do
|
22
|
+
should eq_block_xml(<<-XML)
|
23
|
+
<block type="ruby_statement">
|
24
|
+
<field name="STATEMENT">s = :a</field>
|
25
|
+
<next>
|
26
|
+
<block type="ruby_statement">
|
27
|
+
<field name="STATEMENT">case s</field>
|
28
|
+
<next>
|
29
|
+
<block type="ruby_statement">
|
30
|
+
<field name="STATEMENT">when :a</field>
|
31
|
+
<next>
|
32
|
+
<block type="ruby_statement">
|
33
|
+
<field name="STATEMENT"> puts "エー"</field>
|
34
|
+
<next>
|
35
|
+
<block type="ruby_statement">
|
36
|
+
<field name="STATEMENT">when :b</field>
|
37
|
+
<next>
|
38
|
+
<block type="ruby_statement">
|
39
|
+
<field name="STATEMENT"> puts "ビー"</field>
|
40
|
+
<next>
|
41
|
+
<block type="ruby_statement">
|
42
|
+
<field name="STATEMENT">end</field>
|
43
|
+
</block>
|
44
|
+
</next>
|
45
|
+
</block>
|
46
|
+
</next>
|
47
|
+
</block>
|
48
|
+
</next>
|
49
|
+
</block>
|
50
|
+
</next>
|
51
|
+
</block>
|
52
|
+
</next>
|
53
|
+
</block>
|
54
|
+
</next>
|
55
|
+
</block>
|
56
|
+
XML
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
parts = <<-EOS
|
61
|
+
require "smalruby"
|
62
|
+
|
63
|
+
s = :a
|
64
|
+
case s
|
65
|
+
when :a
|
66
|
+
puts "エー"
|
67
|
+
when :b
|
68
|
+
puts "ビー"
|
69
|
+
end
|
70
|
+
EOS
|
71
|
+
describe compact_source_code(parts) do
|
72
|
+
_parts = parts
|
73
|
+
let(:data) { _parts }
|
74
|
+
|
75
|
+
it '結果が正しいこと' do
|
76
|
+
should eq_block_xml(<<-XML)
|
77
|
+
<block type="ruby_statement">
|
78
|
+
<field name="STATEMENT">s = :a</field>
|
79
|
+
<next>
|
80
|
+
<block type="ruby_statement">
|
81
|
+
<field name="STATEMENT">case s</field>
|
82
|
+
<next>
|
83
|
+
<block type="ruby_statement">
|
84
|
+
<field name="STATEMENT">when :a</field>
|
85
|
+
<next>
|
86
|
+
<block type="ruby_statement">
|
87
|
+
<field name="STATEMENT"> puts "エー"</field>
|
88
|
+
<next>
|
89
|
+
<block type="ruby_statement">
|
90
|
+
<field name="STATEMENT">when :b</field>
|
91
|
+
<next>
|
92
|
+
<block type="ruby_statement">
|
93
|
+
<field name="STATEMENT"> puts "ビー"</field>
|
94
|
+
<next>
|
95
|
+
<block type="ruby_statement">
|
96
|
+
<field name="STATEMENT">end</field>
|
97
|
+
</block>
|
98
|
+
</next>
|
99
|
+
</block>
|
100
|
+
</next>
|
101
|
+
</block>
|
102
|
+
</next>
|
103
|
+
</block>
|
104
|
+
</next>
|
105
|
+
</block>
|
106
|
+
</next>
|
107
|
+
</block>
|
108
|
+
</next>
|
109
|
+
</block>
|
110
|
+
XML
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
shared_context ':to_blocks', to_blocks: true do
|
2
|
+
let(:source_code) { SourceCode.new(data: data) }
|
3
|
+
|
4
|
+
subject { source_code.to_blocks }
|
5
|
+
end
|
6
|
+
|
7
|
+
shared_context ':character_new_data', character_new_data: true do
|
8
|
+
let(:data) {
|
9
|
+
<<-EOS.strip_heredoc
|
10
|
+
require "smalruby"
|
11
|
+
|
12
|
+
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
13
|
+
#{parts}
|
14
|
+
EOS
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
shared_context ':on_start_data', on_start_data: true do
|
19
|
+
let(:data) {
|
20
|
+
<<-EOS.strip_heredoc
|
21
|
+
require "smalruby"
|
22
|
+
|
23
|
+
car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
|
24
|
+
|
25
|
+
car1.on(:start) do
|
26
|
+
#{parts.lines.join(' ')}
|
27
|
+
end
|
28
|
+
EOS
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
class EqBlockXml < RSpec::Matchers::BuiltIn::Eq
|
33
|
+
def matches?(actual)
|
34
|
+
indent = @expected.slice(/\A(\s*).*$/, 1).length
|
35
|
+
re = /\A {#{indent},}/
|
36
|
+
@actual = actual.lines.select { |l| re.match(l) }.join
|
37
|
+
@actual = actual if @actual.empty?
|
38
|
+
match(@expected, @actual)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def eq_block_xml(xml)
|
43
|
+
EqBlockXml.new(xml)
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
require_relative 'shared/block_examples'
|
4
|
+
|
5
|
+
# rubocop:disable EmptyLines, LineLength
|
6
|
+
|
7
|
+
describe RubyToBlock::Block, '音ジャンル', to_blocks: true do
|
8
|
+
parts = <<-EOS
|
9
|
+
car1.on(:start) do
|
10
|
+
play(name: "piano_do.wav")
|
11
|
+
end
|
12
|
+
car1.play(name: "piano_do.wav")
|
13
|
+
EOS
|
14
|
+
describe compact_source_code(parts), character_new_data: true do
|
15
|
+
_parts = parts
|
16
|
+
let(:parts) { _parts }
|
17
|
+
|
18
|
+
it '結果が正しいこと' do
|
19
|
+
should eq_block_xml(<<-XML)
|
20
|
+
<field name="NAME">car1</field>
|
21
|
+
<statement name="DO">
|
22
|
+
<block type="events_on_start">
|
23
|
+
<statement name="DO">
|
24
|
+
<block type="sound_play" inline="true">
|
25
|
+
<value name="NAME">
|
26
|
+
<block type="sound_preset_sounds">
|
27
|
+
<field name="NAME">piano_do.wav</field>
|
28
|
+
</block>
|
29
|
+
</value>
|
30
|
+
</block>
|
31
|
+
</statement>
|
32
|
+
<next>
|
33
|
+
<block type="sound_play" inline="true">
|
34
|
+
<value name="NAME">
|
35
|
+
<block type="sound_preset_sounds">
|
36
|
+
<field name="NAME">piano_do.wav</field>
|
37
|
+
</block>
|
38
|
+
</value>
|
39
|
+
</block>
|
40
|
+
</next>
|
41
|
+
</block>
|
42
|
+
</statement>
|
43
|
+
XML
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
# rubocop:disable EmptyLines, LineLength
|
5
|
+
|
6
|
+
describe RubyToBlock::Block do
|
7
|
+
describe '.new' do
|
8
|
+
subject { described_class.new(type) }
|
9
|
+
|
10
|
+
context '引数がruby_statementの場合'do
|
11
|
+
let(:type) { 'ruby_statement' }
|
12
|
+
|
13
|
+
it { should be_instance_of(described_class::RubyStatement) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.statement_regexp' do
|
18
|
+
subject { described_class.statement_regexp }
|
19
|
+
|
20
|
+
it { should be_kind_of(Regexp) }
|
21
|
+
it {
|
22
|
+
expect(subject.to_s)
|
23
|
+
.to match(/#{Regexp.quote('|(?<ruby_statement>^.*$))')}$/)
|
24
|
+
}
|
25
|
+
its(:names) { should include('ruby_statement') }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '.value_regexp' do
|
29
|
+
subject { described_class.value_regexp }
|
30
|
+
|
31
|
+
it { should be_kind_of(Regexp) }
|
32
|
+
it {
|
33
|
+
expect(subject.to_s)
|
34
|
+
.to match(/#{Regexp.quote('|(?<ruby_expression>^.*$))')}$/)
|
35
|
+
}
|
36
|
+
its(:names) { should include('ruby_expression') }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '.regexp' do
|
40
|
+
subject { described_class.regexp(type) }
|
41
|
+
|
42
|
+
context '引数がruby_statementの場合'do
|
43
|
+
let(:type) { 'ruby_statement' }
|
44
|
+
|
45
|
+
it { should be_kind_of(Regexp) }
|
46
|
+
it { should eq(Regexp.new(described_class::RubyStatement.regexp)) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|