cypress_rails 0.4.0 → 0.4.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 +5 -0
- data/lib/cypress_rails.rb +15 -3
- data/lib/cypress_rails/configuration.rb +2 -10
- data/lib/cypress_rails/middleware.rb +5 -5
- data/lib/cypress_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc774eee5532ad17f97100e095d6b22b09b46edc
|
4
|
+
data.tar.gz: 309f738180e7214345a3df694797f8fd1afc5238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '067649ab8ecdfb4d268da1e3c530d4d769357fb03edd9957b2bf381b2bfecad28ab1f89616f717c29f292ede56a6a33603309b567567ddb7076111fb6c6bb3d3'
|
7
|
+
data.tar.gz: d05a69989befd487b2a338922ff73e932aee4522c5e11c1149f76798ecce3365063192f2b752167b18fd5d650aa348094069b3b7622a00e471619d864c07f42e
|
data/ChangeLog.md
CHANGED
data/lib/cypress_rails.rb
CHANGED
@@ -5,9 +5,21 @@ require "cypress_rails/railtie"
|
|
5
5
|
require "cypress_rails/configuration"
|
6
6
|
|
7
7
|
module CypressRails
|
8
|
+
class << self
|
9
|
+
attr_accessor :configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
self.configuration ||= Configuration.new
|
14
|
+
yield(configuration)
|
15
|
+
end
|
16
|
+
|
8
17
|
|
9
|
-
def
|
10
|
-
|
18
|
+
def scripts(name)
|
19
|
+
path = Pathname.new(configuration.scripts_path).join("#{name}.rb")
|
20
|
+
instance_eval File.read(
|
21
|
+
path
|
22
|
+
)
|
11
23
|
end
|
12
|
-
module_function :
|
24
|
+
module_function :scripts
|
13
25
|
end
|
@@ -1,18 +1,10 @@
|
|
1
1
|
module CypressRails
|
2
|
-
class << self
|
3
|
-
attr_accessor :configuration
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.configure
|
7
|
-
self.configuration ||= Configuration.new
|
8
|
-
yield(configuration)
|
9
|
-
end
|
10
|
-
|
11
2
|
class Configuration
|
12
|
-
attr_accessor :before_each
|
3
|
+
attr_accessor :before_each, :scripts_path
|
13
4
|
|
14
5
|
def initialize
|
15
6
|
@before_each = -> {}
|
7
|
+
@scripts_path = "spec/cypress/seeds"
|
16
8
|
end
|
17
9
|
end
|
18
10
|
end
|
@@ -11,7 +11,7 @@ module CypressRails
|
|
11
11
|
|
12
12
|
if cypress_rails_url?(request.path)
|
13
13
|
setup! if setup_url?(request.path)
|
14
|
-
|
14
|
+
execute_script!(request) if scripts_url?(request.path)
|
15
15
|
return [
|
16
16
|
201,
|
17
17
|
{ "Content-Type" => "text/html" },
|
@@ -32,17 +32,17 @@ module CypressRails
|
|
32
32
|
path.gsub("/__cypress_rails__/", "") == "setup"
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
path.gsub("/__cypress_rails__/", "") == "
|
35
|
+
def scripts_url?(path)
|
36
|
+
path.gsub("/__cypress_rails__/", "") == "scripts"
|
37
37
|
end
|
38
38
|
|
39
39
|
def setup!
|
40
40
|
reset_db!
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def execute_script!(request)
|
44
44
|
body = JSON.parse(request.body.read)
|
45
|
-
CypressRails.
|
45
|
+
CypressRails.scripts(body.fetch("name")).call
|
46
46
|
end
|
47
47
|
|
48
48
|
def reset_db!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cypress_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Szymon Szeliga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|