cypress-rails 0.3.0 → 0.4.0

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: 6cbbbc003d33e8f71d926860e428093061ffddf5c10adf67e4da34f4a4a5a763
4
- data.tar.gz: f9e5ce0881ccd57b8afa2d6b9839269f5999ac905cb3c2cd06d44db2a36a53ef
3
+ metadata.gz: b753d03802970fd8e870d84825cf9338ddb220749a94776b059bc76efba15569
4
+ data.tar.gz: '09f816ccaf74d9af77155079de053fa25c874bac8dfc7423852314a97be95a34'
5
5
  SHA512:
6
- metadata.gz: d1568bc421e21b5a61d3f35a133fe5e0bafcbf7830164457ea37f4c3d9a1f0c8e194b0446d93912a816a29bf0dce2404c48f1d848f33bda152cc75d8ea7c28a9
7
- data.tar.gz: 2408279b528acb1139dca550f19fae8cb5d4e5fb116d9eb26512c012d4549c44afe98d45ef29972aff96d3724c2afc63304e5c303cbe7f3f3d88668fbf590974
6
+ metadata.gz: b5e66032ab98b6e029485816713bb42eee64c3effccf35fd7b1d69cad84844b232156dc2bcde4413f0247946486aa2f129eb3201f0cbc4cb2ec1b2fc90675b61
7
+ data.tar.gz: 87b6866d459c8e6a235e635e062ea687c8478e798d716b93a805f463441def37eb9d573f4b89a580b4f617c05a66fff30089ab3131ffe9e8c9d2ef18555eb1dd
@@ -34,9 +34,9 @@ jobs:
34
34
  # Yarn dependencies
35
35
  - restore_cache:
36
36
  keys:
37
- - v2-yarn-{{ checksum "example/an_app/package.json" }}
37
+ - v3-yarn-{{ checksum "example/an_app/package.json" }}
38
38
  # fallback to using the latest cache if no exact match is found
39
- - v2-yarn-
39
+ - v3-yarn-
40
40
 
41
41
  - run: |
42
42
  cd example/an_app
@@ -46,7 +46,7 @@ jobs:
46
46
  paths:
47
47
  - example/an_app/node_modules
48
48
  - ~/.cache
49
- key: v2-yarn-{{ checksum "example/an_app/package.json" }}
49
+ key: v3-yarn-{{ checksum "example/an_app/package.json" }}
50
50
 
51
51
  - run: bundle exec rake
52
52
  - run: ./script/test_example_app
@@ -1,5 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.4.0
4
+
5
+ * Add a `CYPRESS_RAILS_HOST` option that allows a hostname to be specified (as
6
+ opposed to 127.0.0.1). Puma will still bind to 127.0.0.1, but Cypress will use
7
+ the hostname in its `baseUrl`, which may be necessary for some folks' tests to
8
+ work
9
+
3
10
  ## 0.3.0
4
11
 
5
12
  * Add a `CYPRESS_RAILS_BASE_PATH` option which will be appended to the
@@ -1,27 +1,27 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cypress-rails (0.3.0)
4
+ cypress-rails (0.4.0)
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 (6.0.3)
12
- actionview (= 6.0.3)
13
- activesupport (= 6.0.3)
11
+ actionpack (6.0.3.2)
12
+ actionview (= 6.0.3.2)
13
+ activesupport (= 6.0.3.2)
14
14
  rack (~> 2.0, >= 2.0.8)
15
15
  rack-test (>= 0.6.3)
16
16
  rails-dom-testing (~> 2.0)
17
17
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (6.0.3)
19
- activesupport (= 6.0.3)
18
+ actionview (6.0.3.2)
19
+ activesupport (= 6.0.3.2)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (6.0.3)
24
+ activesupport (6.0.3.2)
25
25
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
26
  i18n (>= 0.7, < 2)
27
27
  minitest (~> 5.1)
@@ -32,24 +32,24 @@ GEM
32
32
  concurrent-ruby (1.1.6)
33
33
  crass (1.0.6)
34
34
  erubi (1.9.0)
35
- i18n (1.8.2)
35
+ i18n (1.8.5)
36
36
  concurrent-ruby (~> 1.0)
37
37
  jaro_winkler (1.5.4)
38
- loofah (2.5.0)
38
+ loofah (2.6.0)
39
39
  crass (~> 1.0.2)
40
40
  nokogiri (>= 1.5.9)
41
41
  method_source (1.0.0)
42
42
  mini_portile2 (2.4.0)
43
43
  minitest (5.14.0)
44
44
  nio4r (2.5.2)
45
- nokogiri (1.10.9)
45
+ nokogiri (1.10.10)
46
46
  mini_portile2 (~> 2.4.0)
47
47
  parallel (1.19.1)
48
48
  parser (2.7.1.2)
49
49
  ast (~> 2.4.0)
50
- puma (4.3.3)
50
+ puma (4.3.5)
51
51
  nio4r (~> 2.0)
52
- rack (2.2.2)
52
+ rack (2.2.3)
53
53
  rack-test (1.1.0)
54
54
  rack (>= 1.0, < 3)
55
55
  rails-dom-testing (2.0.3)
@@ -57,9 +57,9 @@ GEM
57
57
  nokogiri (>= 1.6)
58
58
  rails-html-sanitizer (1.3.0)
59
59
  loofah (~> 2.3)
60
- railties (6.0.3)
61
- actionpack (= 6.0.3)
62
- activesupport (= 6.0.3)
60
+ railties (6.0.3.2)
61
+ actionpack (= 6.0.3.2)
62
+ activesupport (= 6.0.3.2)
63
63
  method_source
64
64
  rake (>= 0.8.7)
65
65
  thor (>= 0.20.3, < 2.0)
@@ -85,7 +85,7 @@ GEM
85
85
  tzinfo (1.2.7)
86
86
  thread_safe (~> 0.1)
87
87
  unicode-display_width (1.7.0)
88
- zeitwerk (2.3.0)
88
+ zeitwerk (2.4.0)
89
89
 
90
90
  PLATFORMS
91
91
  ruby
data/README.md CHANGED
@@ -102,7 +102,7 @@ like:
102
102
  return unless Rails.env.test?
103
103
 
104
104
  CypressRails.hooks.before_server_start do
105
- # Called once, before ether the transaction or the server is started
105
+ # Called once, before either the transaction or the server is started
106
106
  end
107
107
 
108
108
  CypressRails.hooks.after_transaction_start do
@@ -158,6 +158,7 @@ preferred environment variables project-wide using a tool like
158
158
 
159
159
 
160
160
  * **CYPRESS_RAILS_DIR** (default: `Dir.pwd`) the directory of your project
161
+ * **CYPRESS_RAILS_HOST** (default: `"127.0.0.1"`) the hostname to bind to
161
162
  * **CYPRESS_RAILS_PORT** (default: _a random available port_) the port to run
162
163
  the Rails test server on
163
164
  * **CYPRESS_RAILS_BASE_PATH** (default: `"/"`) the base path for all Cypress's
@@ -202,6 +203,22 @@ pollute other test suites or scripts, you can use the `before_server_stop` to
202
203
  of your test database. To set up the hook, pass a block to
203
204
  `CypressRails.hooks.before_server_stop`.
204
205
 
206
+ ## Configuring Rails
207
+
208
+ Beyond the configuration options above, you'll probably also want to disable caching
209
+ in your Rails app's [config/environments/test.rb](/example/an_app/config/environments/test.rb#L9)
210
+ file, so that changes to your Ruby code are reflected in your tests while you
211
+ work on them with `rake cypress:open`. (If either option is set to
212
+ `true`, any changes to your Ruby code will require a server restart to be reflected as you work
213
+ on your tests.)
214
+
215
+ To illustrate, here's what that might look like in `config/environments/test.rb`:
216
+
217
+ ```ruby
218
+ config.cache_classes = false
219
+ config.action_view.cache_template_loading = false
220
+ ```
221
+
205
222
  ## Setting up continuous integration
206
223
 
207
224
  #### Circle CI
@@ -1,9 +1,10 @@
1
1
  require_relative "env"
2
2
 
3
3
  module CypressRails
4
- class Config < Struct.new(:dir, :port, :base_path, :transactional_server, :cypress_cli_opts, keyword_init: true)
4
+ class Config < Struct.new(:dir, :host, :port, :base_path, :transactional_server, :cypress_cli_opts, keyword_init: true)
5
5
  def initialize(
6
6
  dir: Env.fetch("CYPRESS_RAILS_DIR", default: Dir.pwd),
7
+ host: Env.fetch("CYPRESS_RAILS_HOST", default: "127.0.0.1"),
7
8
  port: Env.fetch("CYPRESS_RAILS_PORT"),
8
9
  base_path: Env.fetch("CYPRESS_RAILS_BASE_PATH", default: "/"),
9
10
  transactional_server: Env.fetch("CYPRESS_RAILS_TRANSACTIONAL_SERVER", type: :boolean, default: true),
@@ -18,6 +19,7 @@ module CypressRails
18
19
  cypress-rails configuration:
19
20
  ============================
20
21
  CYPRESS_RAILS_DIR.....................#{dir.inspect}
22
+ CYPRESS_RAILS_HOST....................#{host.inspect}
21
23
  CYPRESS_RAILS_PORT....................#{port.inspect}
22
24
  CYPRESS_RAILS_BASE_PATH...............#{base_path.inspect}
23
25
  CYPRESS_RAILS_TRANSACTIONAL_SERVER....#{transactional_server.inspect}
@@ -20,6 +20,7 @@ module CypressRails
20
20
  @manages_transactions.begin_transaction
21
21
  end
22
22
  server = @starts_rails_server.call(
23
+ host: config.host,
23
24
  port: config.port,
24
25
  transactional_server: config.transactional_server
25
26
  )
@@ -16,11 +16,11 @@ module CypressRails
16
16
  end
17
17
  end
18
18
 
19
- attr_reader :app, :port, :host
19
+ attr_reader :app, :host, :port
20
20
 
21
21
  def initialize(app,
22
+ host:,
22
23
  port:,
23
- host: "127.0.0.1",
24
24
  reportable_errors: [Exception],
25
25
  extra_middleware: [])
26
26
  @app = app
@@ -3,10 +3,10 @@ require_relative "server"
3
3
 
4
4
  module CypressRails
5
5
  class StartsRailsServer
6
- def call(port:, transactional_server:)
6
+ def call(host:, port:, transactional_server:)
7
7
  configure_rails_to_run_our_state_reset_on_every_request!(transactional_server)
8
8
  app = create_rack_app
9
- Server.new(app, port: port).tap do |server|
9
+ Server.new(app, host: host, port: port).tap do |server|
10
10
  server.boot
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module CypressRails
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,10 @@
1
+ {
2
+ "systemParams": "darwin-x64-72",
3
+ "modulesFolders": [],
4
+ "flags": [],
5
+ "linkedModules": [],
6
+ "topLevelPatterns": [],
7
+ "lockfileEntries": {},
8
+ "files": [],
9
+ "artifacts": {}
10
+ }
@@ -0,0 +1,4 @@
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Searls
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.2.0
97
- description:
97
+ description:
98
98
  email:
99
99
  - searls@gmail.com
100
100
  executables:
@@ -137,12 +137,14 @@ files:
137
137
  - lib/cypress-rails/starts_rails_server.rb
138
138
  - lib/cypress-rails/tracks_resets.rb
139
139
  - lib/cypress-rails/version.rb
140
+ - node_modules/.yarn-integrity
140
141
  - script/test_example_app
142
+ - yarn.lock
141
143
  homepage: https://github.com/testdouble/cypress-rails
142
144
  licenses:
143
145
  - MIT
144
146
  metadata: {}
145
- post_install_message:
147
+ post_install_message:
146
148
  rdoc_options: []
147
149
  require_paths:
148
150
  - lib
@@ -158,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
160
  version: '0'
159
161
  requirements: []
160
162
  rubygems_version: 3.1.2
161
- signing_key:
163
+ signing_key:
162
164
  specification_version: 4
163
165
  summary: Helps you write Cypress tests of your Rails app
164
166
  test_files: []