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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17a9c9a3af4b4dcde29ffb4b27780a5e3d42aea4
4
- data.tar.gz: 0ad42a978ebd4448c61fc059eccf48cee48b7df1
3
+ metadata.gz: fc774eee5532ad17f97100e095d6b22b09b46edc
4
+ data.tar.gz: 309f738180e7214345a3df694797f8fd1afc5238
5
5
  SHA512:
6
- metadata.gz: 12d3a9c86ffb64482bc9280d135dae376b082004686acf8d0280976023f8a647157be98a8c6377a78d50b050e06327234d5943fdd63d28faf03bfb1bfb239fd1
7
- data.tar.gz: 85691194ee4d77df74816d732d38346eeb7d9a0a701ffe4383e603d15024a7b128818cd9a637ce4353ada7a40a5f524acc8b9f52e8d87cb1416521c9f9f14688
6
+ metadata.gz: '067649ab8ecdfb4d268da1e3c530d4d769357fb03edd9957b2bf381b2bfecad28ab1f89616f717c29f292ede56a6a33603309b567567ddb7076111fb6c6bb3d3'
7
+ data.tar.gz: d05a69989befd487b2a338922ff73e932aee4522c5e11c1149f76798ecce3365063192f2b752167b18fd5d650aa348094069b3b7622a00e471619d864c07f42e
data/ChangeLog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### 0.4.1 / 2018-05-23
2
+
3
+ * renamed `seeds` to `scripts`
4
+ * added `scripts_path` to config, it defaults to `spec/cypress/scripts`
5
+
1
6
  ### 0.4.0 / 2018-05-17
2
7
 
3
8
  * Integrate the gem with Rails and hook up a middleware for:
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 seeds(name)
10
- instance_eval File.read("spec/cypress/seeds/#{name}.rb")
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 :seeds
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
- seed!(request) if seed_url?(request.path)
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 seed_url?(path)
36
- path.gsub("/__cypress_rails__/", "") == "seeds"
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 seed!(request)
43
+ def execute_script!(request)
44
44
  body = JSON.parse(request.body.read)
45
- CypressRails.seeds(body.fetch("seed")).call
45
+ CypressRails.scripts(body.fetch("name")).call
46
46
  end
47
47
 
48
48
  def reset_db!
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CypressRails
4
4
  # cypress_rails version
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
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.0
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-17 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor