cypress-rails 0.6.1 → 0.7.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
  SHA256:
3
- metadata.gz: 24eb8b9afcb78821b2291a9f649aa23289be2de7b7e301aa04bbc521af73f5d6
4
- data.tar.gz: 76d178ce43355d9072d400101bf7e2166e84124e20e406b785b1d3983a5c7f5e
3
+ metadata.gz: 82a9d3f3bc6cb77aca55dc375e88029182140befde29771ba0fb256af3bbb2ea
4
+ data.tar.gz: 0463fdc3679a692952ee9f30e4b3001dfefdafd3c9466185ee3c53e54fc2c442
5
5
  SHA512:
6
- metadata.gz: de8f996a5e27aa4788c5fcf496b6c48d486261b343bb914ed0a55399c1560499642cf9413faa39bad17db08cb29fda94d91ecb4ec03539ae7a495380ef8d4d2b
7
- data.tar.gz: c12bdc03096784182c2aa048e96386e8ce3ca8742eed24d1c1b0a0dcbcf438270f53a1d07d721d17eee85d9b950633d705760a519a7441811a9c5f6a0da23529
6
+ metadata.gz: 42f56ef58b0b3836a66a29b806013f1a07d4c324f8f874dc0e59be4e5bbf48858f2168782535f8c90fc6ff450ab5097f07566f55e187c0d2bc12ee729f1a1ced
7
+ data.tar.gz: d24f8cdfca0d6cb6b3e509cca0db8a5acb3f695c5ff9e05b8c73d892af94ae52d19637b2c747314e5dacf1969c147f2b7e9a361c4a511e694fa4417eaabfa356
@@ -8,10 +8,10 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: ['2.7', '3.0']
11
+ ruby-version: ['3.0', '3.3']
12
12
 
13
13
  steps:
14
- - uses: actions/checkout@v2
14
+ - uses: actions/checkout@v4
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby-version }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.7.1
4
+ * Add Rack 3.1 support [#163](https://github.com/testdouble/cypress-rails/pull/163)
5
+
6
+ ## 0.7.0
7
+ git
8
+ * Add a `CYPRESS_RAILS_CYPRESS_DIR` option for cases where
9
+ the cypress tests live outside the CYPRESS_RAILS_DIR [#159](https://github.com/testdouble/cypress-rails/pull/159)
10
+
3
11
  ## 0.6.1
4
12
 
5
13
  * Fix a deprecation warning in Rails
data/Gemfile.lock CHANGED
@@ -1,98 +1,143 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cypress-rails (0.6.1)
4
+ cypress-rails (0.7.1)
5
5
  puma (>= 3.8.0)
6
6
  railties (>= 5.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actionpack (7.0.6)
12
- actionview (= 7.0.6)
13
- activesupport (= 7.0.6)
14
- rack (~> 2.0, >= 2.2.4)
11
+ actionpack (7.1.3)
12
+ actionview (= 7.1.3)
13
+ activesupport (= 7.1.3)
14
+ nokogiri (>= 1.8.5)
15
+ racc
16
+ rack (>= 2.2.4)
17
+ rack-session (>= 1.0.1)
15
18
  rack-test (>= 0.6.3)
16
- rails-dom-testing (~> 2.0)
17
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (7.0.6)
19
- activesupport (= 7.0.6)
19
+ rails-dom-testing (~> 2.2)
20
+ rails-html-sanitizer (~> 1.6)
21
+ actionview (7.1.3)
22
+ activesupport (= 7.1.3)
20
23
  builder (~> 3.1)
21
- erubi (~> 1.4)
22
- rails-dom-testing (~> 2.0)
23
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (7.0.6)
24
+ erubi (~> 1.11)
25
+ rails-dom-testing (~> 2.2)
26
+ rails-html-sanitizer (~> 1.6)
27
+ activesupport (7.1.3)
28
+ base64
29
+ bigdecimal
25
30
  concurrent-ruby (~> 1.0, >= 1.0.2)
31
+ connection_pool (>= 2.2.5)
32
+ drb
26
33
  i18n (>= 1.6, < 2)
27
34
  minitest (>= 5.1)
35
+ mutex_m
28
36
  tzinfo (~> 2.0)
29
37
  ast (2.4.2)
38
+ base64 (0.2.0)
39
+ bigdecimal (3.1.6)
30
40
  builder (3.2.4)
31
- concurrent-ruby (1.2.2)
41
+ concurrent-ruby (1.2.3)
42
+ connection_pool (2.4.1)
32
43
  crass (1.0.6)
44
+ drb (2.2.0)
45
+ ruby2_keywords
33
46
  erubi (1.12.0)
34
47
  i18n (1.14.1)
35
48
  concurrent-ruby (~> 1.0)
36
- loofah (2.21.3)
49
+ io-console (0.7.2)
50
+ irb (1.13.1)
51
+ rdoc (>= 4.0.0)
52
+ reline (>= 0.4.2)
53
+ json (2.7.1)
54
+ language_server-protocol (3.17.0.3)
55
+ lint_roller (1.1.0)
56
+ loofah (2.22.0)
37
57
  crass (~> 1.0.2)
38
58
  nokogiri (>= 1.12.0)
39
- method_source (1.0.0)
40
- mini_portile2 (2.8.2)
41
- minitest (5.15.0)
42
- nio4r (2.5.9)
43
- nokogiri (1.15.3)
44
- mini_portile2 (~> 2.8.2)
59
+ minitest (5.22.2)
60
+ mutex_m (0.2.0)
61
+ nio4r (2.7.0)
62
+ nokogiri (1.16.2)
45
63
  racc (~> 1.4)
46
- parallel (1.22.1)
47
- parser (3.1.2.0)
64
+ parallel (1.24.0)
65
+ parser (3.3.0.5)
48
66
  ast (~> 2.4.1)
49
- puma (6.3.0)
67
+ racc
68
+ psych (5.1.2)
69
+ stringio
70
+ puma (6.4.2)
50
71
  nio4r (~> 2.0)
51
- racc (1.7.1)
52
- rack (2.2.7)
72
+ racc (1.7.3)
73
+ rack (3.1.7)
74
+ rack-session (2.0.0)
75
+ rack (>= 3.0.0)
53
76
  rack-test (2.1.0)
54
77
  rack (>= 1.3)
55
- rails-dom-testing (2.1.1)
78
+ rackup (2.1.0)
79
+ rack (>= 3)
80
+ webrick (~> 1.8)
81
+ rails-dom-testing (2.2.0)
56
82
  activesupport (>= 5.0.0)
57
83
  minitest
58
84
  nokogiri (>= 1.6)
59
85
  rails-html-sanitizer (1.6.0)
60
86
  loofah (~> 2.21)
61
87
  nokogiri (~> 1.14)
62
- railties (7.0.6)
63
- actionpack (= 7.0.6)
64
- activesupport (= 7.0.6)
65
- method_source
88
+ railties (7.1.3)
89
+ actionpack (= 7.1.3)
90
+ activesupport (= 7.1.3)
91
+ irb
92
+ rackup (>= 1.0.0)
66
93
  rake (>= 12.2)
67
- thor (~> 1.0)
68
- zeitwerk (~> 2.5)
94
+ thor (~> 1.0, >= 1.2.2)
95
+ zeitwerk (~> 2.6)
69
96
  rainbow (3.1.1)
70
- rake (13.0.6)
71
- regexp_parser (2.4.0)
72
- rexml (3.2.5)
73
- rubocop (1.29.1)
97
+ rake (13.1.0)
98
+ rdoc (6.6.3.1)
99
+ psych (>= 4.0.0)
100
+ regexp_parser (2.9.0)
101
+ reline (0.5.7)
102
+ io-console (~> 0.5)
103
+ rexml (3.2.6)
104
+ rubocop (1.59.0)
105
+ json (~> 2.3)
106
+ language_server-protocol (>= 3.17.0)
74
107
  parallel (~> 1.10)
75
- parser (>= 3.1.0.0)
108
+ parser (>= 3.2.2.4)
76
109
  rainbow (>= 2.2.2, < 4.0)
77
110
  regexp_parser (>= 1.8, < 3.0)
78
111
  rexml (>= 3.2.5, < 4.0)
79
- rubocop-ast (>= 1.17.0, < 2.0)
112
+ rubocop-ast (>= 1.30.0, < 2.0)
80
113
  ruby-progressbar (~> 1.7)
81
- unicode-display_width (>= 1.4.0, < 3.0)
82
- rubocop-ast (1.18.0)
83
- parser (>= 3.1.1.0)
84
- rubocop-performance (1.13.3)
85
- rubocop (>= 1.7.0, < 2.0)
86
- rubocop-ast (>= 0.4.0)
87
- ruby-progressbar (1.11.0)
88
- standard (1.12.1)
89
- rubocop (= 1.29.1)
90
- rubocop-performance (= 1.13.3)
91
- thor (1.2.2)
114
+ unicode-display_width (>= 2.4.0, < 3.0)
115
+ rubocop-ast (1.30.0)
116
+ parser (>= 3.2.1.0)
117
+ rubocop-performance (1.20.2)
118
+ rubocop (>= 1.48.1, < 2.0)
119
+ rubocop-ast (>= 1.30.0, < 2.0)
120
+ ruby-progressbar (1.13.0)
121
+ ruby2_keywords (0.0.5)
122
+ standard (1.33.0)
123
+ language_server-protocol (~> 3.17.0.2)
124
+ lint_roller (~> 1.0)
125
+ rubocop (~> 1.59.0)
126
+ standard-custom (~> 1.0.0)
127
+ standard-performance (~> 1.3)
128
+ standard-custom (1.0.2)
129
+ lint_roller (~> 1.0)
130
+ rubocop (~> 1.50)
131
+ standard-performance (1.3.1)
132
+ lint_roller (~> 1.1)
133
+ rubocop-performance (~> 1.20.2)
134
+ stringio (3.1.1)
135
+ thor (1.3.0)
92
136
  tzinfo (2.0.6)
93
137
  concurrent-ruby (~> 1.0)
94
- unicode-display_width (2.1.0)
95
- zeitwerk (2.6.8)
138
+ unicode-display_width (2.5.0)
139
+ webrick (1.8.1)
140
+ zeitwerk (2.6.13)
96
141
 
97
142
  PLATFORMS
98
143
  ruby
data/README.md CHANGED
@@ -155,7 +155,8 @@ preferred environment variables project-wide using a tool like
155
155
  [dotenv](https://github.com/bkeepers/dotenv).
156
156
 
157
157
 
158
- * **CYPRESS_RAILS_DIR** (default: `Dir.pwd`) the directory of your project
158
+ * **CYPRESS_RAILS_DIR** (default: `Dir.pwd`) the directory of your Rails project
159
+ * **CYPRESS_RAILS_CYPRESS_DIR** (default: _same value as `rails_dir`_) the directory of your Cypress project
159
160
  * **CYPRESS_RAILS_HOST** (default: `"127.0.0.1"`) the hostname to bind to
160
161
  * **CYPRESS_RAILS_PORT** (default: _a random available port_) the port to run
161
162
  the Rails test server on
data/exe/cypress-rails CHANGED
@@ -3,7 +3,7 @@
3
3
  ENV["RAILS_ENV"] ||= "test"
4
4
  require "pathname"
5
5
  require "cypress-rails"
6
- require Pathname.new(CypressRails::Config.new.dir).join("config/environment")
6
+ require Pathname.new(CypressRails::Config.new.rails_dir).join("config/environment")
7
7
 
8
8
  command = ARGV[0]
9
9
  case command
@@ -2,17 +2,19 @@ require_relative "env"
2
2
 
3
3
  module CypressRails
4
4
  class Config
5
- attr_accessor :dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts
5
+ attr_accessor :rails_dir, :cypress_dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts
6
6
 
7
7
  def initialize(
8
- dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
8
+ rails_dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
9
+ cypress_dir: Env.fetch("CYPRESS_RAILS_CYPRESS_DIR", default: rails_dir),
9
10
  host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"),
10
11
  port: Env.fetch("CYPRESS_RAILS_PORT"),
11
12
  base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"),
12
13
  transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
13
14
  cypress_cli_opts: Env.fetch("CYPRESS_RAILS_CYPRESS_OPTS", default: "")
14
15
  )
15
- @dir = dir
16
+ @rails_dir = rails_dir
17
+ @cypress_dir = cypress_dir
16
18
  @host = host
17
19
  @port = port
18
20
  @base_path = base_path
@@ -25,7 +27,8 @@ module CypressRails
25
27
 
26
28
  cypress-rails configuration:
27
29
  ============================
28
- CYPRESS_RAILS_DIR.....................#{dir.inspect}
30
+ CYPRESS_RAILS_DIR.....................#{rails_dir.inspect}
31
+ CYPRESS_RAILS_CYPRESS_DIR.............#{cypress_dir.inspect}
29
32
  CYPRESS_RAILS_HOST....................#{host.inspect}
30
33
  CYPRESS_RAILS_PORT....................#{port.inspect}
31
34
  CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect}
@@ -4,8 +4,8 @@ module CypressRails
4
4
  class FindsBin
5
5
  LOCAL_PATH = "node_modules/.bin/cypress"
6
6
 
7
- def call(dir = Dir.pwd)
8
- local_path = Pathname.new(dir).join(LOCAL_PATH)
7
+ def call(cypress_dir = Dir.pwd)
8
+ local_path = Pathname.new(cypress_dir).join(LOCAL_PATH)
9
9
  if File.exist?(local_path)
10
10
  local_path
11
11
  else
@@ -19,8 +19,8 @@ module CypressRails
19
19
  })
20
20
  JS
21
21
 
22
- def call(dir = Dir.pwd)
23
- config_path = File.join(dir, "cypress.config.js")
22
+ def call(cypress_dir = Config.new.cypress_dir)
23
+ config_path = File.join(cypress_dir, "cypress.config.js")
24
24
  if !File.exist?(config_path)
25
25
  File.write(config_path, DEFAULT_CONFIG)
26
26
  puts "Cypress config initialized in `#{config_path}'"
@@ -14,7 +14,7 @@ module CypressRails
14
14
  end
15
15
 
16
16
  def call(command, config)
17
- puts config.to_s
17
+ puts config
18
18
  @initializer_hooks.run(:before_server_start)
19
19
  if config.transactional_server
20
20
  @manages_transactions.begin_transaction
@@ -24,12 +24,12 @@ module CypressRails
24
24
  port: config.port,
25
25
  transactional_server: config.transactional_server
26
26
  )
27
- bin = @finds_bin.call(config.dir)
27
+ bin = @finds_bin.call(config.cypress_dir)
28
28
 
29
29
  set_exit_hooks!(config)
30
30
 
31
31
  command = <<~EXEC
32
- CYPRESS_BASE_URL="http://#{server.host}:#{server.port}#{config.base_path}" "#{bin}" #{command} --project "#{config.dir}" #{config.cypress_cli_opts}
32
+ CYPRESS_BASE_URL="http://#{server.host}:#{server.port}#{config.base_path}" "#{bin}" #{command} --project "#{config.cypress_dir}" #{config.cypress_cli_opts}
33
33
  EXEC
34
34
 
35
35
  puts "\nLaunching Cypress…\n$ #{command}\n"
@@ -10,7 +10,8 @@ module CypressRails
10
10
  default_options = {Host: host, Port: port, Threads: "0:4", workers: 0, daemon: false}
11
11
  options = default_options # .merge(options)
12
12
 
13
- conf = Rack::Handler::Puma.config(app, options)
13
+ puma_rack_handler = defined?(Rackup::Handler::Puma) ? Rackup::Handler::Puma : Rack::Handler::Puma
14
+ conf = puma_rack_handler.config(app, options)
14
15
  conf.clamp
15
16
  logger = (defined?(::Puma::LogWriter) ? ::Puma::LogWriter : ::Puma::Events).stdio
16
17
 
@@ -53,7 +53,7 @@ module CypressRails
53
53
 
54
54
  res = @checker.request { |http| http.get("/__identify__") }
55
55
 
56
- return res.body == app.object_id.to_s if res.is_a?(Net::HTTPSuccess) || res.is_a?(Net::HTTPRedirection)
56
+ res.body == app.object_id.to_s if res.is_a?(Net::HTTPSuccess) || res.is_a?(Net::HTTPRedirection)
57
57
  rescue SystemCallError, Net::ReadTimeout, OpenSSL::SSL::SSLError
58
58
  false
59
59
  end
@@ -1,3 +1,3 @@
1
1
  module CypressRails
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.1"
3
3
  end
data/script/test CHANGED
@@ -15,5 +15,7 @@ echo "---> Running tests"
15
15
  bundle exec rake
16
16
  ./script/test_example_app
17
17
 
18
+ bundle exec rake test
19
+
18
20
  echo "---> Job's done!"
19
21
 
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.6.1
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-12 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.4.14
162
+ rubygems_version: 3.5.11
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Helps you write Cypress tests of your Rails app