cypress-on-rails 1.5.0 → 1.8.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: 423d83b19153f88f90b88295c62934aeb0a20e79cd1e4d700e9a01990972c400
4
- data.tar.gz: a5c6a528c074c22ce50206c8120290d9bf12d576348cd033342f593c3efd2d38
3
+ metadata.gz: 6bf2c478221a73bfd04c79925bfbda32188e6bad7bc95669df6dd5c0080a5431
4
+ data.tar.gz: d7c0a2b7db03f4410b0fd2bccadc557b94cbbafa84f1a583eebe8614bbe7b114
5
5
  SHA512:
6
- metadata.gz: 309a6837d21c5cd1814a3b84f9903edcc9d4ddb035f4f0dd8e435640ce16b96e21d51f52b7715d3b88f3f87956143bb53db9434cd151b1c53ba5505316f46cf4
7
- data.tar.gz: ec631f2f6a4a48240d1314911076888557da7f24e62ea7b9e0ad50be33f2367fd5581fe09699790a0cd55aa9dbc44d911252284d48e3aee595e5c4765790c91c
6
+ metadata.gz: 8accebdf65474c35fe2a26c7aed606d5a3d1da221024eb7569e12b5b0fb6802ac8063586aa34ce3564e969cbfea7bbcbd0c360e329b863f7f2dbaddc4d79fd3a
7
+ data.tar.gz: 4bc6725bb7d1b3b9e1b5c7d698b399113191661623a21f95a58829ac0d825128767e4f565876ffcc7f6e55c77250595adfa9a109d01ba9ffae40b07933b82297
@@ -0,0 +1 @@
1
+ github: [shakacode]
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ spec/examples.txt
5
5
  .idea
6
6
  spec/test.log
7
7
  pkg/*.gem
8
+ vendor/bundle
data/.travis.yml CHANGED
@@ -1,6 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2
3
+ - 2.3
4
+ - 2.4
5
+ - 2.5
6
+ - 2.6
7
+ # - 2.7
4
8
 
5
9
  #addons:
6
10
  # artifacts:
@@ -22,9 +26,14 @@ before_install:
22
26
  - sudo apt-get -qq update
23
27
  - sudo apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev libxml2-dev
24
28
  - sudo apt-get install -y xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2
29
+ - travis_retry nvm install 14.13.1
30
+ - node -v
31
+ - nvm alias default 14.13.1
25
32
 
26
33
  script:
27
34
  - bundle exec rake
35
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
36
+ - gem install bundler -v '< 2'
28
37
  - ./spec/integrations/rails_5_2/test.sh
29
38
  - ./spec/integrations/rails_4_2/test.sh
30
39
  - ./spec/integrations/rails_3_2/test.sh
data/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ ## [1.8.1]
2
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.8.0...v1.8.1
3
+
4
+ ### Fixed
5
+ * remove "--silent" option when adding cypress [PR 76](https://github.com/shakacode/cypress-on-rails/pull/76)
6
+ * update cypress examples to use "preserve" instead of "whitelist" [PR 75](https://github.com/shakacode/cypress-on-rails/pull/75) by [alvincrespo](https://github.com/alvincrespo)
7
+
8
+ ## [1.8.0]
9
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.7.0...v1.8.0
10
+
11
+ ### Changed
12
+ * Use `FactoryBo#reload` to reset factory bot
13
+
14
+ ## [1.7.0]
15
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.6.0...v1.7.0
16
+
17
+ ### Changed
18
+ * Improve eval() in command executor [PR 46](https://github.com/shakacode/cypress-on-rails/pull/46) by [Systho](https://github.com/Systho)
19
+
20
+ ### Fixed
21
+ * Add middleware after load_config_initializers [PR 62](https://github.com/shakacode/cypress-on-rails/pull/62) by [duytd](https://github.com/duytd)
22
+
23
+ ## [1.6.0]
24
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.1...v1.6.0
25
+
26
+ ### Changed
27
+ * Change default port to 5017 [PR 49](https://github.com/shakacode/cypress-on-rails/pull/49) by [vfonic](https://github/vfonic)
28
+
29
+ ### Fixed
30
+ * fix file location warning message in clean.rb [PR 54](https://github.com/shakacode/cypress-on-rails/pull/54) by [ootoovak](https://github.com/ootoovak)
31
+
32
+ ## [1.5.1]
33
+ [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.0...v1.5.1
34
+
35
+ ### Fixed
36
+ * fix FactoryBot Trait not registered error [PR 43](https://github.com/shakacode/cypress-on-rails/pull/43)
37
+
1
38
  ## [1.5.0]
2
39
  [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.4.2...v1.5.0
3
40
 
@@ -26,7 +63,7 @@
26
63
  * Update Travis CI badge in README [PR 31](https://github.com/shakacode/cypress-on-rails/pull/31)
27
64
  * Fix CI by Installing cypress dependencies on Travis CI [PR 31](https://github.com/shakacode/cypress-on-rails/pull/31)
28
65
 
29
- ## [1.4.0]
66
+ ## [1.4.0]
30
67
  [Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.3.0...v1.4.0
31
68
 
32
69
  * Accept an options argument for scenarios. [PR 18](https://github.com/shakacode/cypress-on-rails/pull/18) by [ericraio](https://github.com/ericraio).
@@ -92,6 +129,14 @@
92
129
  ## 0.1.2 (2017-10-31)
93
130
  * First release.
94
131
 
132
+ [1.8.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.7.0...v1.8.0
133
+ [1.7.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.6.0...v1.7.0
134
+ [1.6.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.1...v1.6.0
135
+ [1.5.1]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.0...v1.5.1
136
+ [1.5.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.4.2...v1.5.0
137
+ [1.4.2]: https://github.com/shakacode/cypress-on-rails/compare/v1.4.1...v1.4.2
138
+ [1.4.1]: https://github.com/shakacode/cypress-on-rails/compare/v1.4.0...v1.4.1
139
+ [1.4.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.3.0...v1.4.0
95
140
  [1.3.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.2.1...v1.3.0
96
141
  [1.2.1]: https://github.com/shakacode/cypress-on-rails/compare/v1.2.0...v1.2.1
97
142
  [1.2.0]: https://github.com/shakacode/cypress-on-rails/compare/v1.1.1...v1.2.0
data/README.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.com/shakacode/cypress-on-rails.svg?branch=master)](https://travis-ci.org/shakacode/cypress-on-rails) [![Gem Version](https://badge.fury.io/rb/cypress-on-rails.svg)](https://badge.fury.io/rb/cypress-on-rails)
4
4
 
5
- Gem for using [cypress.io](http://github.com/cypress-io/) in Rails and ruby rack applications
5
+ ----
6
+
7
+ This project is sponsored by the software consulting firm [ShakaCode](https://www.shakacode.com), creator of the [React on Rails Gem](https://github.com/shakacode/react_on_rails). We focus on React front-ends, often with Ruby on Rails or Gatsby. The best way to see what we do is to see the details of [our recent work](https://www.shakacode.com/recent-work). Feel free to engage in discussions around this gem at our [forum category for Cypress](https://forum.shakacode.com/c/cypress-on-rails/55).
8
+
9
+ ----
10
+
11
+ Gem for using [cypress.io](http://github.com/cypress-io/) in Rails and ruby rack applications
6
12
  with the goal of controlling State as mentioned in [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices.html#Organizing-Tests-Logging-In-Controlling-State)
7
13
 
8
14
  It allows to run code in the application context when executing cypress tests.
@@ -18,21 +24,23 @@ Has examples of setting up state with:
18
24
  * scenarios
19
25
  * custom commands
20
26
 
21
- This gem is based off https://github.com/konvenit/cypress-on-rails
22
-
23
- Video of getting started with this gem https://grant-ps.blog/2018/08/10/getting-started-with-cypress-io-and-ruby-on-rails/
27
+ ## Resources
28
+ * [Video of getting started with this gem](https://grant-ps.blog/2018/08/10/getting-started-with-cypress-io-and-ruby-on-rails/)
29
+ * [Article: Introduction to Cypress on Rails](https://www.shakacode.com/blog/introduction-to-cypress-on-rails/)
24
30
 
25
31
  ## Getting started
26
32
 
27
33
  Add this to your Gemfile:
28
- ```
34
+
35
+ ```ruby
29
36
  group :test, :development do
30
37
  gem 'cypress-on-rails', '~> 1.0'
31
38
  end
32
39
  ```
33
40
 
34
41
  Generate the boilerplate code using:
35
- ```
42
+
43
+ ```shell
36
44
  bin/rails g cypress_on_rails:install
37
45
 
38
46
  # if you have/want a different cypress folder (default is spec/cypress)
@@ -41,21 +49,25 @@ bin/rails g cypress_on_rails:install --cypress_folder=test/cypress
41
49
  # if you want to install cypress with npm
42
50
  bin/rails g cypress_on_rails:install --install_cypress_with=npm
43
51
 
52
+ # if you already have cypress installed globally
53
+ bin/rails g cypress_on_rails:install --install_cypress_with=skip
54
+
44
55
  # to update the generated files run
45
56
  bin/rails g cypress_on_rails:update
46
57
  ```
47
58
 
48
- The generator adds the following files/directory to your application:
59
+ The generator modifies/adds the following files/directory in your application:
60
+ * `config/environments/test.rb`
49
61
  * `config/initializers/cypress_on_rails` used to configure CypressDev
50
62
  * `spec/cypress/integrations/` contains your cypress tests
51
63
  * `spec/cypress/support/on-rails.js` contains CypressDev support code
52
64
  * `spec/cypress/app_commands/scenarios/` contains your CypressDev scenario definitions
53
65
  * `spec/cypress/cypress_helper.rb` contains helper code for CypressDev app commands
54
66
 
55
- if you are not using database_cleaner look at `spec/cypress/app_commands/clean_db.rb`.
67
+ if you are not using database_cleaner look at `spec/cypress/app_commands/clean.rb`.
56
68
  if you are not using factory_bot look at `spec/cypress/app_commands/factory_bot.rb`.
57
69
 
58
- Now you can create scenarios and commands that are plan ruby files that get loaded through middleware, the ruby sky is your limit.
70
+ Now you can create scenarios and commands that are plain ruby files that get loaded through middleware, the ruby sky is your limit.
59
71
 
60
72
  ### WARNING
61
73
  *WARNING!!:* cypress-on-rails can execute arbitrary ruby code
@@ -65,10 +77,10 @@ Please use with extra caution if starting your local server on 0.0.0.0 or runnin
65
77
 
66
78
  Start the rails server in test mode and start cypress
67
79
 
68
- ```
80
+ ```shell
69
81
  # start rails
70
82
  RAILS_ENV=test bin/rake db:create db:schema:load
71
- bin/rails server -e test -p 5002
83
+ bin/rails server -e test -p 5017
72
84
 
73
85
  # in separate window start cypress
74
86
  yarn cypress open --project ./spec
@@ -82,10 +94,10 @@ You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) direct
82
94
  require 'cypress_on_rails/smart_factory_wrapper'
83
95
 
84
96
  CypressOnRails::SmartFactoryWrapper.configure(
85
- always_reload: !Rails.configuration.cache_classes,
86
- factory: FactoryBot,
87
- files: Dir['./spec/factories/**/*.rb']
88
- )
97
+ always_reload: !Rails.configuration.cache_classes,
98
+ factory: FactoryBot,
99
+ files: Dir['./spec/factories/**/*.rb']
100
+ )
89
101
  ```
90
102
 
91
103
  ```js
@@ -95,16 +107,17 @@ describe('My First Test', function() {
95
107
  // This calls to the backend to prepare the application state
96
108
  cy.appFactories([
97
109
  ['create_list', 'post', 10],
98
- ['create', 'post', {title: 'Hello World'} ]
110
+ ['create', 'post', {title: 'Hello World'} ],
111
+ ['create', 'post', 'with_comments', {title: 'Factory_bot Traits here'} ] // use traits
99
112
  ])
100
113
 
101
114
  // Visit the application under test
102
115
  cy.visit('/')
103
116
 
104
117
  cy.contains("Hello World")
105
-
118
+
106
119
  // Accessing result
107
- cy.appFactories([['create', 'invoice', { paid: false }]]).then((records) => {
120
+ cy.appFactories([['create', 'invoice', { paid: false }]]).then((records) => {
108
121
  cy.visit(`/invoices/${records[0].id}`);
109
122
  });
110
123
  })
@@ -149,7 +162,7 @@ You define a scenario in the `spec/cypress/app_commands/scenarios` directory:
149
162
  Profile.create name: "Cypress Hill"
150
163
 
151
164
  # or if you have factory_bot enabled in your cypress_helper
152
- CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
165
+ CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
153
166
  ```
154
167
 
155
168
  Then reference the scenario in your test:
@@ -171,8 +184,8 @@ describe('My First Test', function() {
171
184
 
172
185
  create a ruby file in `spec/cypress/app_commands` directory:
173
186
  ```ruby
174
- # spec/cypress/app_commands/load_seed.rb
175
- load "#{Rails.root}/db/seeds.rb"
187
+ # spec/cypress/app_commands/load_seed.rb
188
+ load "#{Rails.root}/db/seeds.rb"
176
189
  ```
177
190
 
178
191
  Then reference the command in your test with `cy.app('load_seed')`:
@@ -180,7 +193,7 @@ Then reference the command in your test with `cy.app('load_seed')`:
180
193
  // spec/cypress/integrations/simple_spec.js
181
194
  describe('My First Test', function() {
182
195
  beforeEach(() => { cy.app('load_seed') })
183
-
196
+
184
197
  it('visit root', function() {
185
198
  cy.visit('/')
186
199
 
@@ -203,7 +216,7 @@ CypressOnRails.configure do |c|
203
216
  end
204
217
  use CypressOnRails::Middleware
205
218
 
206
- run MyApp
219
+ run MyApp
207
220
  ```
208
221
 
209
222
  add the following file to cypress
@@ -242,7 +255,7 @@ beforeEach(() => {
242
255
 
243
256
  ## Contributing
244
257
 
245
- 1. Fork it ( https://github.com/[my-github-username]/cypress-on-rails/fork )
258
+ 1. Fork it ( https://github.com/shakacode/cypress-on-rails/fork )
246
259
  2. Create your feature branch (`git checkout -b my-new-feature`)
247
260
  3. Commit your changes (`git commit -am 'Add some feature'`)
248
261
  4. Push to the branch (`git push origin my-new-feature`)
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = CypressOnRails::VERSION
8
8
  s.author = ["miceportal team", 'Grant Petersen-Speelman']
9
9
  s.email = ["info@miceportal.de", 'grantspeelman@gmail.com']
10
- s.homepage = "http://github.com/grantspeelman/cypress-on-rails"
10
+ s.homepage = "http://github.com/shakacode/cypress-on-rails"
11
11
  s.summary = "Integrates cypress with rails or rack applications"
12
12
  s.description = "Integrates cypress with rails or rack applications"
13
13
  s.post_install_message = 'The CypressDev constant is being deprecated and will be completely removed and replaced with CypressOnRails.'
@@ -19,4 +19,12 @@ Gem::Specification.new do |s|
19
19
  s.add_development_dependency 'rake'
20
20
  s.add_development_dependency 'rspec'
21
21
  s.add_development_dependency 'railties', '>= 3.2'
22
+ s.add_development_dependency 'factory_bot'
23
+ s.metadata = {
24
+ "bug_tracker_uri" => "https://github.com/shakacode/cypress-on-rails/issues",
25
+ "changelog_uri" => "https://github.com/shakacode/cypress-on-rails/blob/master/CHANGELOG.md",
26
+ "documentation_uri" => "https://github.com/shakacode/cypress-on-rails/blob/master/README.md",
27
+ "homepage_uri" => "http://github.com/shakacode/cypress-on-rails",
28
+ "source_code_uri" => "http://github.com/shakacode/cypress-on-rails"
29
+ }
22
30
  end
@@ -6,7 +6,7 @@ module CypressOnRails
6
6
  def self.load(file,command_options = nil)
7
7
  load_cypress_helper
8
8
  file_data = File.read(file)
9
- eval file_data
9
+ eval file_data, binding, file
10
10
  rescue => e
11
11
  logger.error("fail to execute #{file}: #{e.message}")
12
12
  logger.error(e.backtrace.join("\n"))
@@ -4,7 +4,7 @@ require 'cypress_on_rails/middleware'
4
4
 
5
5
  module CypressOnRails
6
6
  class Railtie < Rails::Railtie
7
- initializer :setup_cypress_middleware do |app|
7
+ initializer :setup_cypress_middleware, after: :load_config_initializers do |app|
8
8
  if CypressOnRails.configuration.use_middleware?
9
9
  app.middleware.use Middleware
10
10
  end
@@ -12,5 +12,9 @@ module CypressOnRails
12
12
  create(type,*params)
13
13
  end
14
14
  end
15
+
16
+ # to be API compatible with factorybot
17
+ def self.definition_file_paths=(*); end
18
+ def self.reload; end
15
19
  end
16
20
  end
@@ -3,15 +3,6 @@ require 'cypress_on_rails/simple_rails_factory'
3
3
 
4
4
  module CypressOnRails
5
5
  class SmartFactoryWrapper
6
- module FactoryCleaner
7
- def self.clean(f = FactoryBot)
8
- f.factories.clear if f.respond_to?(:factories)
9
- f.traits.clear if f.respond_to?(:traits)
10
- f.callbacks.clear if f.respond_to?(:callbacks)
11
- f.sequences.clear if f.respond_to?(:sequences)
12
- end
13
- end
14
-
15
6
  def self.instance
16
7
  @instance ||= new(files: [], factory: SimpleRailsFactory)
17
8
  end
@@ -33,21 +24,26 @@ module CypressOnRails
33
24
  attr_accessor :always_reload
34
25
 
35
26
  def initialize(files:, factory:, always_reload: false,
36
- factory_cleaner: FactoryCleaner, kernel: Kernel, file_system: File,
37
- dir_system: Dir)
27
+ kernel: Kernel, file_system: File, dir_system: Dir)
38
28
  self.files = files
39
29
  self.factory = factory
30
+ factory.definition_file_paths = []
40
31
  self.always_reload = always_reload
41
32
  @kernel = kernel
42
33
  @file_system = file_system
43
- @factory_cleaner = factory_cleaner
44
34
  @latest_mtime = nil
45
35
  @dir_system = dir_system
46
36
  end
47
37
 
48
- def create(*args)
38
+ def create(*options)
49
39
  load_files
50
- factory.create(*args)
40
+ factory_name = options.shift
41
+ if options.last.is_a?(Hash)
42
+ args = options.pop
43
+ else
44
+ args = {}
45
+ end
46
+ factory.create(factory_name,*options.map(&:to_sym),args.symbolize_keys)
51
47
  end
52
48
 
53
49
  def create_list(*args)
@@ -77,7 +73,7 @@ module CypressOnRails
77
73
  return unless should_reload?(current_latest_mtime)
78
74
  logger.info 'Loading Factories'
79
75
  @latest_mtime = current_latest_mtime
80
- @factory_cleaner.clean(factory)
76
+ factory.reload
81
77
  files.each do |file|
82
78
  logger.debug "-- Loading: #{file}"
83
79
  @kernel.load(file)
@@ -1,3 +1,3 @@
1
1
  module CypressOnRails
2
- VERSION = '1.5.0'
2
+ VERSION = '1.8.1'
3
3
  end
@@ -12,9 +12,9 @@ module CypressOnRails
12
12
  install_dir = "#{Dir.pwd}/#{directories.join('/')}"
13
13
  command = nil
14
14
  if options.install_cypress_with == 'yarn'
15
- command = "yarn --cwd=#{install_dir} add cypress --dev --silent"
15
+ command = "yarn --cwd=#{install_dir} add cypress --dev"
16
16
  elsif options.install_cypress_with == 'npm'
17
- command = "cd #{install_dir}; npm install cypress --save-dev --silent"
17
+ command = "cd #{install_dir}; npm install cypress --save-dev"
18
18
  end
19
19
  if command
20
20
  say command
@@ -1,4 +1,4 @@
1
1
  {
2
- "baseUrl": "http://localhost:5002",
2
+ "baseUrl": "http://localhost:5017",
3
3
  "defaultCommandTimeout": 10000
4
4
  }
@@ -3,7 +3,7 @@ if defined?(DatabaseCleaner)
3
3
  DatabaseCleaner.strategy = :truncation
4
4
  DatabaseCleaner.clean
5
5
  else
6
- logger.warn "add database_cleaner or update clean_db"
6
+ logger.warn "add database_cleaner or update cypress/app_commands/clean.rb"
7
7
  Post.delete_all if defined?(Post)
8
8
  end
9
9
 
@@ -65,7 +65,7 @@ context('Cypress.Cookies', () => {
65
65
  // now any cookie with the name 'session_id' will
66
66
  // not be cleared before each new test runs
67
67
  Cypress.Cookies.defaults({
68
- whitelist: 'session_id',
68
+ preserve: 'session_id',
69
69
  })
70
70
  })
71
71
  })
@@ -84,8 +84,8 @@ context('Cypress.Server', () => {
84
84
  Cypress.Server.defaults({
85
85
  delay: 0,
86
86
  force404: false,
87
- whitelist (xhr) {
88
- // handle custom logic for whitelisting
87
+ preserve (xhr) {
88
+ // handle custom logic for preserving
89
89
  },
90
90
  })
91
91
  })
@@ -112,7 +112,7 @@ context('Cypress.config()', () => {
112
112
  let myConfig = Cypress.config()
113
113
 
114
114
  expect(myConfig).to.have.property('animationDistanceThreshold', 5)
115
- expect(myConfig).to.have.property('baseUrl', 'http://localhost:5002')
115
+ expect(myConfig).to.have.property('baseUrl', 'http://localhost:5017')
116
116
  expect(myConfig).to.have.property('defaultCommandTimeout', 10000)
117
117
  expect(myConfig).to.have.property('requestTimeout', 5000)
118
118
  expect(myConfig).to.have.property('responseTimeout', 30000)
@@ -1,4 +1,5 @@
1
1
  require 'cypress_on_rails/smart_factory_wrapper'
2
+ require 'factory_bot'
2
3
 
3
4
  RSpec.describe CypressOnRails::SmartFactoryWrapper do
4
5
  FileSystemDummy = Struct.new(:file_hash) do
@@ -10,8 +11,9 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
10
11
  let(:time_now) { Time.now }
11
12
  let(:mtime_hash) { {'file1.rb' => time_now, 'file2.rb' => time_now } }
12
13
  let(:files) { %w(file1.rb file2.rb) }
13
- let(:factory_double) { double('FactoryBot', create: true, create_list: true) }
14
- let(:factory_cleaner) { class_double(CypressOnRails::SmartFactoryWrapper::FactoryCleaner, clean: true) }
14
+ let(:factory_double) do
15
+ class_double(FactoryBot, create: nil, create_list: nil, "definition_file_paths=": nil, reload: nil)
16
+ end
15
17
  let(:kernel_double) { class_double(Kernel, load: true) }
16
18
  let(:file_double) { FileSystemDummy.new(mtime_hash) }
17
19
  let(:dir_double) { class_double(Dir) }
@@ -25,8 +27,7 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
25
27
  factory: factory_double,
26
28
  kernel: kernel_double,
27
29
  file_system: file_double,
28
- dir_system: dir_double,
29
- factory_cleaner: factory_cleaner)
30
+ dir_system: dir_double)
30
31
  end
31
32
 
32
33
  it 'loads all the files on first create it' do
@@ -43,7 +44,22 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
43
44
 
44
45
  it 'it sends delegates create to the factory' do
45
46
  subject.create(:user)
46
- expect(factory_double).to have_received(:create).with(:user)
47
+ expect(factory_double).to have_received(:create).with(:user, {})
48
+ end
49
+
50
+ it 'it sends delegates create to the factory and symbolize keys' do
51
+ subject.create(:user, {'name' => "name"})
52
+ expect(factory_double).to have_received(:create).with(:user, {name: 'name'})
53
+ end
54
+
55
+ it 'it sends delegates create to the factory and symbolize keys with trait' do
56
+ subject.create(:user, 'trait1', {'name' => "name"})
57
+ expect(factory_double).to have_received(:create).with(:user, :trait1, {name: 'name'})
58
+ end
59
+
60
+ it 'it sends delegates create to the factory and symbolize keys with only trait' do
61
+ subject.create(:user, 'trait2')
62
+ expect(factory_double).to have_received(:create).with(:user, :trait2, {})
47
63
  end
48
64
 
49
65
  it 'it sends delegates create_list to the factory' do
@@ -53,7 +69,7 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
53
69
 
54
70
  it 'wont load the files if they have not changed' do
55
71
  subject.create(:user)
56
- subject.create_list(:user)
72
+ subject.create_list(:user, 2)
57
73
  expect(kernel_double).to have_received(:load).with('file1.rb').once
58
74
  expect(kernel_double).to have_received(:load).with('file2.rb').once
59
75
  end
@@ -64,7 +80,7 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
64
80
  expect(kernel_double).to have_received(:load).with('file2.rb').once
65
81
 
66
82
  mtime_hash['file1.rb'] = Time.now
67
- subject.create_list(:user)
83
+ subject.create_list(:user, 2)
68
84
  expect(kernel_double).to have_received(:load).with('file1.rb').twice
69
85
  expect(kernel_double).to have_received(:load).with('file2.rb').twice
70
86
  end
@@ -76,24 +92,24 @@ RSpec.describe CypressOnRails::SmartFactoryWrapper do
76
92
  expect(kernel_double).to have_received(:load).with('file2.rb').once
77
93
 
78
94
  mtime_hash.delete('file1.rb')
79
- subject.create_list(:user)
95
+ subject.create_list(:user, 2)
80
96
  expect(kernel_double).to have_received(:load).with('file1.rb').once
81
97
  expect(kernel_double).to have_received(:load).with('file2.rb').twice
82
98
  end
83
99
 
84
- it 'will reset factory if a has changed' do
100
+ it 'will reset factory if a file has changed' do
85
101
  subject.create(:user)
86
- expect(factory_cleaner).to have_received(:clean).with(factory_double)
102
+ expect(factory_double).to have_received(:reload)
87
103
 
88
104
  mtime_hash['file1.rb'] = Time.now
89
- subject.create_list(:user)
105
+ subject.create_list(:user, 2)
90
106
 
91
- expect(factory_cleaner).to have_received(:clean).with(factory_double).twice
107
+ expect(factory_double).to have_received(:reload).twice
92
108
  end
93
109
 
94
110
  it 'will always reload the files enabled' do
95
111
  subject.always_reload = true
96
- subject.create_list(:user)
112
+ subject.create_list(:user, 2)
97
113
  subject.create(:user)
98
114
  expect(kernel_double).to have_received(:load).with('file1.rb').twice
99
115
  expect(kernel_double).to have_received(:load).with('file2.rb').twice
@@ -1,5 +1,5 @@
1
1
  {
2
- "baseUrl": "http://localhost:5002",
2
+ "baseUrl": "http://localhost:5017",
3
3
  "defaultCommandTimeout": 10000,
4
4
  "projectId": "qvzwep"
5
5
  }
@@ -21,7 +21,7 @@ echo '-- start rails server'
21
21
  # make sure the server is not running
22
22
  (kill -9 `cat tmp/pids/server.pid` || true )
23
23
 
24
- bundle exec ./bin/rails server -p 5002 -e test &
24
+ bundle exec ./bin/rails server -p 5017 -e test &
25
25
  sleep 2 # give rails a chance to start up correctly
26
26
 
27
27
  echo '-- cypress run'
@@ -1,7 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
- gem 'rails', '4.2.10'
4
+ gem 'rails', '~> 4.2.10'
5
+ gem 'sprockets', '~> 3.7.2'
5
6
 
6
7
  group :development, :test do
7
8
  gem 'cypress-on-rails', path: '../../../'
@@ -21,7 +21,7 @@ echo '-- start rails server'
21
21
  # make sure the server is not running
22
22
  (kill -9 `cat tmp/pids/server.pid` || true )
23
23
 
24
- bundle exec ./bin/rails server -p 5002 -e test &
24
+ bundle exec ./bin/rails server -p 5017 -e test &
25
25
  sleep 2 # give rails a chance to start up correctly
26
26
 
27
27
  echo '-- cypress run'
@@ -3,6 +3,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
3
 
4
4
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
5
5
  gem 'rails', '~> 5.2.0'
6
+ gem 'sprockets', '~> 3.7.2'
6
7
  gem 'sqlite3', '~> 1.3.6'
7
8
 
8
9
  # Reduces boot times through caching; required in config/boot.rb
@@ -23,7 +23,7 @@ echo '-- start rails server'
23
23
  # make sure the server is not running
24
24
  (kill -9 `cat tmp/pids/server.pid` || true )
25
25
 
26
- bundle exec ./bin/rails server -p 5002 -e test &
26
+ bundle exec ./bin/rails server -p 5017 -e test &
27
27
  sleep 2 # give rails a chance to start up correctly
28
28
 
29
29
  echo '-- cypress run'
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.5.0
4
+ version: 1.8.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: 2019-10-06 00:00:00.000000000 Z
12
+ date: 2021-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '3.2'
70
+ - !ruby/object:Gem::Dependency
71
+ name: factory_bot
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  description: Integrates cypress with rails or rack applications
71
85
  email:
72
86
  - info@miceportal.de
@@ -75,6 +89,7 @@ executables: []
75
89
  extensions: []
76
90
  extra_rdoc_files: []
77
91
  files:
92
+ - ".github/FUNDING.yml"
78
93
  - ".gitignore"
79
94
  - ".rspec"
80
95
  - ".travis.yml"
@@ -284,9 +299,14 @@ files:
284
299
  - spec/integrations/rails_5_2/tmp/.keep
285
300
  - spec/integrations/rails_5_2/vendor/.keep
286
301
  - spec/spec_helper.rb
287
- homepage: http://github.com/grantspeelman/cypress-on-rails
302
+ homepage: http://github.com/shakacode/cypress-on-rails
288
303
  licenses: []
289
- metadata: {}
304
+ metadata:
305
+ bug_tracker_uri: https://github.com/shakacode/cypress-on-rails/issues
306
+ changelog_uri: https://github.com/shakacode/cypress-on-rails/blob/master/CHANGELOG.md
307
+ documentation_uri: https://github.com/shakacode/cypress-on-rails/blob/master/README.md
308
+ homepage_uri: http://github.com/shakacode/cypress-on-rails
309
+ source_code_uri: http://github.com/shakacode/cypress-on-rails
290
310
  post_install_message: The CypressDev constant is being deprecated and will be completely
291
311
  removed and replaced with CypressOnRails.
292
312
  rdoc_options: []
@@ -303,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
323
  - !ruby/object:Gem::Version
304
324
  version: '0'
305
325
  requirements: []
306
- rubygems_version: 3.0.3
326
+ rubygems_version: 3.2.8
307
327
  signing_key:
308
328
  specification_version: 4
309
329
  summary: Integrates cypress with rails or rack applications