@@ -16,21 +16,21 @@ def rack_input(json_value)
16
16
17
17
context '/__cypress__/command' do
18
18
before do
19
- allow ( command_executor ) . to receive ( :load ) . and_return ( { id : 1 , title : 'some result' } )
19
+ allow ( command_executor ) . to receive ( :perform ) . and_return ( { id : 1 , title : 'some result' } )
20
20
allow ( file ) . to receive ( :exists? )
21
21
env [ 'PATH_INFO' ] = '/__cypress__/command'
22
22
end
23
23
24
24
it 'command file exists' do
25
- allow ( command_executor ) . to receive ( :load ) . and_return ( { id : 1 , title : 'some result' } )
25
+ allow ( command_executor ) . to receive ( :perform ) . and_return ( { id : 1 , title : 'some result' } )
26
26
env [ 'rack.input' ] = rack_input ( name : 'seed' )
27
27
allow ( file ) . to receive ( :exists? ) . with ( 'spec/cypress/app_commands/seed.rb' ) . and_return ( true )
28
28
29
29
aggregate_failures do
30
30
expect ( response ) . to eq ( [ 201 ,
31
31
{ "Content-Type" => "application/json" } ,
32
32
[ "[{\" id\" :1,\" title\" :\" some result\" }]" ] ] )
33
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
33
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
34
34
end
35
35
end
36
36
@@ -42,21 +42,21 @@ def rack_input(json_value)
42
42
expect ( response ) . to eq ( [ 201 ,
43
43
{ "Content-Type" => "application/json" } ,
44
44
[ "[{\" id\" :1,\" title\" :\" some result\" }]" ] ] )
45
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/seed.rb' , [ 'my_options' ] )
45
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/seed.rb' , [ 'my_options' ] )
46
46
end
47
47
end
48
48
49
49
it 'command file does not exists' do
50
50
object = BasicObject . new
51
- allow ( command_executor ) . to receive ( :load ) . and_return ( object )
51
+ allow ( command_executor ) . to receive ( :perform ) . and_return ( object )
52
52
env [ 'rack.input' ] = rack_input ( name : 'seed' )
53
53
allow ( file ) . to receive ( :exists? ) . with ( 'spec/cypress/app_commands/seed.rb' ) . and_return ( true )
54
54
55
55
aggregate_failures do
56
56
expect ( response ) . to eq ( [ 201 ,
57
57
{ "Content-Type" => "application/json" } ,
58
58
[ "{\" message\" :\" Cannot convert to json\" }" ] ] )
59
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
59
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
60
60
end
61
61
end
62
62
@@ -68,7 +68,7 @@ def rack_input(json_value)
68
68
expect ( response ) . to eq ( [ 201 ,
69
69
{ "Content-Type" => "application/json" } ,
70
70
[ "[{\" id\" :1,\" title\" :\" some result\" }]" ] ] )
71
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
71
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/seed.rb' , nil )
72
72
end
73
73
end
74
74
@@ -82,8 +82,8 @@ def rack_input(json_value)
82
82
expect ( response ) . to eq ( [ 201 ,
83
83
{ "Content-Type" => "application/json" } ,
84
84
[ "[{\" id\" :1,\" title\" :\" some result\" },{\" id\" :1,\" title\" :\" some result\" }]" ] ] )
85
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/load_user.rb' , nil )
86
- expect ( command_executor ) . to have_received ( :load ) . with ( 'spec/cypress/app_commands/load_sample.rb' , { 'all' => 'true' } )
85
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/load_user.rb' , nil )
86
+ expect ( command_executor ) . to have_received ( :perform ) . with ( 'spec/cypress/app_commands/load_sample.rb' , { 'all' => 'true' } )
87
87
end
88
88
end
89
89
@@ -94,7 +94,7 @@ def rack_input(json_value)
94
94
95
95
aggregate_failures do
96
96
expect ( response ) . to eq ( [ 404 , { } , [ 'could not find command file: spec/cypress/app_commands/load_sample.rb' ] ] )
97
- expect ( command_executor ) . to_not have_received ( :load )
97
+ expect ( command_executor ) . to_not have_received ( :perform )
98
98
end
99
99
end
100
100
end
0 commit comments