cypress-on-rails 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/cypress_on_rails/command_executor.rb +1 -1
- data/lib/cypress_on_rails/middleware.rb +1 -1
- data/lib/cypress_on_rails/version.rb +1 -1
- data/spec/cypress_on_rails/command_executor_spec.rb +7 -7
- data/spec/cypress_on_rails/middleware_spec.rb +10 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df550a0ca15f4fe35c0bdf3227596ea79e6cbb9c407117592383466c81f45447
|
4
|
+
data.tar.gz: 6dc7c397f9e13dd6ad7f60e5d0bb929bb1aa0a65dab9ed5992f1d260686316ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd12f10387af1cd51f91e65acea0b2705970487e101fe963273a70982c0f789a00896bab78ea461a2fee1dab3e1aa63be8d0e9d45e8ab39b8bee7b0c3821a5cb
|
7
|
+
data.tar.gz: dbf5569c5d5b71bd737b28f656f2c9993a0235ebc9e87c8f42def465521900c713fa9ffe33035b5603d00796c7c6bae39941e36f261b17266159567addf470ff
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,7 @@ require 'cypress_on_rails/configuration'
|
|
3
3
|
module CypressOnRails
|
4
4
|
# loads and evals the command files
|
5
5
|
class CommandExecutor
|
6
|
-
def self.
|
6
|
+
def self.perform(file,command_options = nil)
|
7
7
|
load_cypress_helper
|
8
8
|
file_data = File.read(file)
|
9
9
|
eval file_data, binding, file
|
@@ -56,7 +56,7 @@ module CypressOnRails
|
|
56
56
|
missing_command = commands.find {|command| !@file.exists?(command.file_path) }
|
57
57
|
|
58
58
|
if missing_command.nil?
|
59
|
-
results = commands.map { |command| @command_executor.
|
59
|
+
results = commands.map { |command| @command_executor.perform(command.file_path, command.options) }
|
60
60
|
|
61
61
|
begin
|
62
62
|
output = results.to_json
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'cypress_on_rails/command_executor'
|
2
2
|
|
3
3
|
RSpec.describe CypressOnRails::CommandExecutor do
|
4
|
-
describe '.
|
4
|
+
describe '.perform' do
|
5
5
|
let(:folder) { "#{__dir__}/command_executor" }
|
6
6
|
subject { described_class }
|
7
7
|
|
8
|
-
def
|
9
|
-
subject.
|
8
|
+
def executor_perform(*values)
|
9
|
+
subject.perform(*values)
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
@@ -15,18 +15,18 @@ RSpec.describe CypressOnRails::CommandExecutor do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'runs test command' do
|
18
|
-
|
18
|
+
executor_perform("#{folder}/test_command.rb")
|
19
19
|
expect(DummyTest.values).to eq(%w(hello))
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'runs test command twice' do
|
23
|
-
|
24
|
-
|
23
|
+
executor_perform("#{folder}/test_command.rb")
|
24
|
+
executor_perform("#{folder}/test_command.rb")
|
25
25
|
expect(DummyTest.values).to eq(%w(hello hello))
|
26
26
|
end
|
27
27
|
|
28
28
|
it 'runs command with options' do
|
29
|
-
|
29
|
+
executor_perform("#{folder}/test_command_with_options.rb", 'my_string')
|
30
30
|
expect(DummyTest.values).to eq(%w(my_string))
|
31
31
|
end
|
32
32
|
end
|
@@ -16,13 +16,13 @@ RSpec.describe CypressOnRails::Middleware do
|
|
16
16
|
|
17
17
|
context '/__cypress__/command' do
|
18
18
|
before do
|
19
|
-
allow(command_executor).to receive(:
|
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(:
|
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
|
|
@@ -30,7 +30,7 @@ RSpec.describe CypressOnRails::Middleware 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(:
|
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,13 +42,13 @@ RSpec.describe CypressOnRails::Middleware do
|
|
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(:
|
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(:
|
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
|
|
@@ -56,7 +56,7 @@ RSpec.describe CypressOnRails::Middleware 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(:
|
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 @@ RSpec.describe CypressOnRails::Middleware do
|
|
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(:
|
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 @@ RSpec.describe CypressOnRails::Middleware do
|
|
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(:
|
86
|
-
expect(command_executor).to have_received(:
|
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 @@ RSpec.describe CypressOnRails::Middleware do
|
|
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(:
|
97
|
+
expect(command_executor).to_not have_received(:perform)
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cypress-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miceportal team
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-03-
|
12
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|