From 8fc3cfae495f64ff8325aa69452b13e99cda981a Mon Sep 17 00:00:00 2001 From: Grant Date: Tue, 18 Jun 2019 14:51:42 +1000 Subject: [PATCH 1/4] Rename CypressDev to CypressOnRails --- CHANGELOG.md | 4 ++++ README.md | 20 ++++++++-------- Rakefile | 2 +- cypress-on-rails.gemspec | 5 ++-- lib/cypress-on-rails.rb | 6 ++++- lib/cypress/smart_factory_wrapper.rb | 2 +- lib/cypress_dev.rb | 5 +--- lib/cypress_dev/version.rb | 3 --- .../command_executor.rb | 6 ++--- .../configuration.rb | 2 +- .../middleware.rb | 8 +++---- .../railtie.rb | 8 +++---- .../simple_rails_factory.rb | 2 +- .../smart_factory_wrapper.rb | 8 +++---- lib/cypress_on_rails/version.rb | 3 +++ .../install_generator.rb | 4 ++-- .../initializers/cypress_on_rails.rb.erb} | 8 +++---- .../templates/spec/cypress.json | 0 .../app_commands/activerecord_fixtures.rb | 0 .../spec/cypress/app_commands/clean.rb | 0 .../spec/cypress/app_commands/eval.rb | 0 .../spec/cypress/app_commands/factory_bot.rb | 2 +- .../spec/cypress/app_commands/log_fail.rb | 0 .../cypress/app_commands/scenarios/basic.rb | 0 .../templates/spec/cypress/cypress_helper.rb | 6 ++--- .../spec/cypress/fixtures/example.json | 0 .../integration/examples/actions.spec.js | 0 .../integration/examples/aliasing.spec.js | 0 .../integration/examples/assertions.spec.js | 0 .../integration/examples/connectors.spec.js | 0 .../integration/examples/cookies.spec.js | 0 .../integration/examples/cypress_api.spec.js | 0 .../integration/examples/files.spec.js | 0 .../examples/local_storage.spec.js | 0 .../integration/examples/location.spec.js | 0 .../cypress/integration/examples/misc.spec.js | 0 .../integration/examples/navigation.spec.js | 0 .../examples/network_requests.spec.js | 0 .../integration/examples/querying.spec.js | 0 .../examples/spies_stubs_clocks.spec.js | 0 .../integration/examples/traversal.spec.js | 0 .../integration/examples/utilities.spec.js | 0 .../integration/examples/viewport.spec.js | 0 .../integration/examples/waiting.spec.js | 0 .../integration/examples/window.spec.js | 0 .../integration/rails_examples/other_spec.js | 0 .../rails_examples/using_factory_bot.js | 0 .../rails_examples/using_fixtures.js | 0 .../rails_examples/using_scenarios_spec.js | 0 .../spec/cypress/support/commands.js | 0 .../templates/spec/cypress/support/index.js | 0 .../spec/cypress/support/on-rails.js | 4 ++-- spec/cypress_dev/configuration_spec.rb | 23 ------------------- .../command_executor/cypress_helper.rb | 0 .../command_executor/test_command.rb | 0 .../test_command_with_options.rb | 0 .../command_executor_spec.rb | 6 ++--- spec/cypress_on_rails/configuration_spec.rb | 23 +++++++++++++++++++ .../middleware_spec.rb | 6 ++--- .../railtie_spec.rb | 6 ++--- .../simple_rails_factory_spec.rb | 6 ++--- .../smart_factory_wrapper_spec.rb | 6 ++--- spec/spec_helper.rb | 4 ++-- 63 files changed, 97 insertions(+), 91 deletions(-) delete mode 100644 lib/cypress_dev/version.rb rename lib/{cypress_dev => cypress_on_rails}/command_executor.rb (88%) rename lib/{cypress_dev => cypress_on_rails}/configuration.rb (96%) rename lib/{cypress_dev => cypress_on_rails}/middleware.rb (92%) rename lib/{cypress_dev => cypress_on_rails}/railtie.rb (53%) rename lib/{cypress_dev => cypress_on_rails}/simple_rails_factory.rb (93%) rename lib/{cypress_dev => cypress_on_rails}/smart_factory_wrapper.rb (93%) create mode 100644 lib/cypress_on_rails/version.rb rename lib/generators/{cypress_dev => cypress_on_rails}/install_generator.rb (95%) rename lib/generators/{cypress_dev/templates/config/initializers/cypress_dev.rb.erb => cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb} (67%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress.json (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/activerecord_fixtures.rb (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/clean.rb (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/eval.rb (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/factory_bot.rb (81%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/log_fail.rb (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/app_commands/scenarios/basic.rb (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/cypress_helper.rb (79%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/fixtures/example.json (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/actions.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/aliasing.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/assertions.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/connectors.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/cookies.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/cypress_api.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/files.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/local_storage.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/location.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/misc.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/navigation.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/network_requests.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/querying.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/traversal.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/utilities.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/viewport.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/waiting.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/examples/window.spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/rails_examples/other_spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_factory_bot.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_fixtures.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/support/commands.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/support/index.js (100%) rename lib/generators/{cypress_dev => cypress_on_rails}/templates/spec/cypress/support/on-rails.js (95%) delete mode 100644 spec/cypress_dev/configuration_spec.rb rename spec/{cypress_dev => cypress_on_rails}/command_executor/cypress_helper.rb (100%) rename spec/{cypress_dev => cypress_on_rails}/command_executor/test_command.rb (100%) rename spec/{cypress_dev => cypress_on_rails}/command_executor/test_command_with_options.rb (100%) rename spec/{cypress_dev => cypress_on_rails}/command_executor_spec.rb (83%) create mode 100644 spec/cypress_on_rails/configuration_spec.rb rename spec/{cypress_dev => cypress_on_rails}/middleware_spec.rb (95%) rename spec/{cypress_dev => cypress_on_rails}/railtie_spec.rb (71%) rename spec/{cypress_dev => cypress_on_rails}/simple_rails_factory_spec.rb (81%) rename spec/{cypress_dev => cypress_on_rails}/smart_factory_wrapper_spec.rb (94%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7542e91..9d86293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ +## 1.4.0 * Accept an options argument for scenarios +### Tasks +* renamed to CypressOnRails + ## 1.3.0 * send any arguments to simple rails factory, not only hashes ### Tasks diff --git a/README.md b/README.md index 1a4af67..84f0fbb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# CypressDev +# CypressOnRails [![Build Status](https://travis-ci.org/grantspeelman/cypress-on-rails.svg?branch=master)](https://travis-ci.org/grantspeelman/cypress-on-rails) @@ -76,9 +76,9 @@ You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) direct ```ruby # spec/cypress/app_commands/factory_bot.rb -require 'cypress_dev/smart_factory_wrapper' +require 'cypress_on_rails/smart_factory_wrapper' -CypressDev::SmartFactoryWrapper.configure( +CypressOnRails::SmartFactoryWrapper.configure( always_reload: !Rails.configuration.cache_classes, factory: FactoryBot, files: Dir['./spec/factories/**/*.rb'] @@ -141,7 +141,7 @@ You define a scenario in the `spec/cypress/app_commands/scenarios` directory: Profile.create name: "Cypress Hill" # or if you have factory_bot enabled in your cypress_helper -CypressDev::SmartFactoryWrapper.create(:profile, name: "Cypress Hill") +CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill") ``` Then reference the scenario in your test: @@ -183,17 +183,17 @@ describe('My First Test', function() { ## Usage with other rack applications -Add CypressDev to your config.ru +Add CypressOnRails to your config.ru ```ruby # an example config.ru require File.expand_path('my_app', File.dirname(__FILE__)) -require 'cypress_dev/middleware' -CypressDev.configure do |c| +require 'cypress_on_rails/middleware' +CypressOnRails.configure do |c| c.cypress_folder = File.expand_path("#{__dir__}/test/cypress") end -use CypressDev::Middleware +use CypressOnRails::Middleware run MyApp ``` @@ -202,7 +202,7 @@ add the following file to cypress ```js // test/cypress/support/on-rails.js -// CypressDev: dont remove these command +// CypressOnRails: dont remove these command Cypress.Commands.add('appCommands', function (body) { cy.request({ method: 'POST', @@ -224,7 +224,7 @@ Cypress.Commands.add('appScenario', function (name) { Cypress.Commands.add('appFactories', function (options) { cy.app('factory_bot', options) }); -// CypressDev: end +// CypressOnRails: end // The next is optional beforeEach(() => { diff --git a/Rakefile b/Rakefile index 324d713..0187ea3 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = 'spec/cypress/*_spec.rb' + t.pattern = 'spec/cypress_on_rails/*_spec.rb' end task default: %w[spec build] diff --git a/cypress-on-rails.gemspec b/cypress-on-rails.gemspec index 1516767..158480b 100644 --- a/cypress-on-rails.gemspec +++ b/cypress-on-rails.gemspec @@ -1,15 +1,16 @@ # -*- encoding: utf-8 -*- $LOAD_PATH.push File.expand_path("../lib", __FILE__) -require "cypress_dev/version" +require "cypress_on_rails/version" Gem::Specification.new do |s| s.name = "cypress-on-rails" - s.version = CypressDev::VERSION + s.version = CypressOnRails::VERSION s.author = ["miceportal team", 'Grant Petersen-Speelman'] s.email = ["info@miceportal.de", 'grantspeelman@gmail.com'] s.homepage = "http://github.com/grantspeelman/cypress-on-rails" s.summary = "Integrates cypress with rails or rack applications" s.description = "Integrates cypress with rails or rack applications" + s.post_install_message = 'The CypressDev constant is being deprecated and will be completely removed and replaced with CypressOnRails' s.rubyforge_project = s.name s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n") diff --git a/lib/cypress-on-rails.rb b/lib/cypress-on-rails.rb index cdc453f..2473b1e 100644 --- a/lib/cypress-on-rails.rb +++ b/lib/cypress-on-rails.rb @@ -1,3 +1,7 @@ -require 'cypress_dev' +require 'cypress_on_rails/version' +require 'cypress_on_rails/configuration' +require_relative './cypress_on_rails/railtie' if defined?(Rails) +# maintain backward compatibility +CypressDev = CypressOnRails Cypress = CypressDev diff --git a/lib/cypress/smart_factory_wrapper.rb b/lib/cypress/smart_factory_wrapper.rb index d1b27ef..32c2529 100644 --- a/lib/cypress/smart_factory_wrapper.rb +++ b/lib/cypress/smart_factory_wrapper.rb @@ -1,3 +1,3 @@ require 'cypress-on-rails' -require 'cypress_dev/smart_factory_wrapper' +require 'cypress_on_rails/smart_factory_wrapper' # for backward compatibility \ No newline at end of file diff --git a/lib/cypress_dev.rb b/lib/cypress_dev.rb index 717b6b8..75f13d1 100644 --- a/lib/cypress_dev.rb +++ b/lib/cypress_dev.rb @@ -1,4 +1 @@ -require 'cypress_dev/version' -require 'cypress_dev/configuration' -require_relative './cypress_dev/railtie' if defined?(Rails) - +require 'cypress-on-rails' diff --git a/lib/cypress_dev/version.rb b/lib/cypress_dev/version.rb deleted file mode 100644 index 3e0544e..0000000 --- a/lib/cypress_dev/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module CypressDev - VERSION = '1.3.0' -end diff --git a/lib/cypress_dev/command_executor.rb b/lib/cypress_on_rails/command_executor.rb similarity index 88% rename from lib/cypress_dev/command_executor.rb rename to lib/cypress_on_rails/command_executor.rb index d5232c2..13a0d6d 100644 --- a/lib/cypress_dev/command_executor.rb +++ b/lib/cypress_on_rails/command_executor.rb @@ -1,6 +1,6 @@ -require 'cypress_dev/configuration' +require 'cypress_on_rails/configuration' -module CypressDev +module CypressOnRails # loads and evals the command files class CommandExecutor def self.load(file,command_options = nil) @@ -27,7 +27,7 @@ def self.logger end def self.configuration - CypressDev.configuration + CypressOnRails.configuration end end end diff --git a/lib/cypress_dev/configuration.rb b/lib/cypress_on_rails/configuration.rb similarity index 96% rename from lib/cypress_dev/configuration.rb rename to lib/cypress_on_rails/configuration.rb index 74b5d05..a08571c 100644 --- a/lib/cypress_dev/configuration.rb +++ b/lib/cypress_on_rails/configuration.rb @@ -1,6 +1,6 @@ require 'logger' -module CypressDev +module CypressOnRails class Configuration attr_accessor :cypress_folder attr_accessor :use_middleware diff --git a/lib/cypress_dev/middleware.rb b/lib/cypress_on_rails/middleware.rb similarity index 92% rename from lib/cypress_dev/middleware.rb rename to lib/cypress_on_rails/middleware.rb index c53bc4a..a6d4162 100644 --- a/lib/cypress_dev/middleware.rb +++ b/lib/cypress_on_rails/middleware.rb @@ -1,9 +1,9 @@ require 'json' require 'rack' -require 'cypress_dev/configuration' -require 'cypress_dev/command_executor' +require 'cypress_on_rails/configuration' +require 'cypress_on_rails/command_executor' -module CypressDev +module CypressOnRails # Middleware to handle cypress commands and eval class Middleware def initialize(app, command_executor = CommandExecutor, file = ::File) @@ -24,7 +24,7 @@ def call(env) private def configuration - CypressDev.configuration + CypressOnRails.configuration end def logger diff --git a/lib/cypress_dev/railtie.rb b/lib/cypress_on_rails/railtie.rb similarity index 53% rename from lib/cypress_dev/railtie.rb rename to lib/cypress_on_rails/railtie.rb index 8eda650..530ee29 100644 --- a/lib/cypress_dev/railtie.rb +++ b/lib/cypress_on_rails/railtie.rb @@ -1,11 +1,11 @@ require 'rails/railtie' -require 'cypress_dev/configuration' -require 'cypress_dev/middleware' +require 'cypress_on_rails/configuration' +require 'cypress_on_rails/middleware' -module CypressDev +module CypressOnRails class Railtie < Rails::Railtie initializer :setup_cypress_middleware do |app| - if CypressDev.configuration.use_middleware? + if CypressOnRails.configuration.use_middleware? app.middleware.use Middleware end end diff --git a/lib/cypress_dev/simple_rails_factory.rb b/lib/cypress_on_rails/simple_rails_factory.rb similarity index 93% rename from lib/cypress_dev/simple_rails_factory.rb rename to lib/cypress_on_rails/simple_rails_factory.rb index 35043e0..63d71d0 100644 --- a/lib/cypress_dev/simple_rails_factory.rb +++ b/lib/cypress_on_rails/simple_rails_factory.rb @@ -1,6 +1,6 @@ require 'active_support/core_ext/string' -module CypressDev +module CypressOnRails module SimpleRailsFactory def self.create(type, *params) params = [{}] if params.empty? diff --git a/lib/cypress_dev/smart_factory_wrapper.rb b/lib/cypress_on_rails/smart_factory_wrapper.rb similarity index 93% rename from lib/cypress_dev/smart_factory_wrapper.rb rename to lib/cypress_on_rails/smart_factory_wrapper.rb index 0c5bb20..5effbf8 100644 --- a/lib/cypress_dev/smart_factory_wrapper.rb +++ b/lib/cypress_on_rails/smart_factory_wrapper.rb @@ -1,7 +1,7 @@ -require 'cypress_dev/configuration' -require 'cypress_dev/simple_rails_factory' +require 'cypress_on_rails/configuration' +require 'cypress_on_rails/simple_rails_factory' -module CypressDev +module CypressOnRails class SmartFactoryWrapper module FactoryCleaner def self.clean(f = FactoryBot) @@ -69,7 +69,7 @@ def files end def logger - CypressDev.configuration.logger + CypressOnRails.configuration.logger end def load_files diff --git a/lib/cypress_on_rails/version.rb b/lib/cypress_on_rails/version.rb new file mode 100644 index 0000000..5131456 --- /dev/null +++ b/lib/cypress_on_rails/version.rb @@ -0,0 +1,3 @@ +module CypressOnRails + VERSION = '1.4.0' +end diff --git a/lib/generators/cypress_dev/install_generator.rb b/lib/generators/cypress_on_rails/install_generator.rb similarity index 95% rename from lib/generators/cypress_dev/install_generator.rb rename to lib/generators/cypress_on_rails/install_generator.rb index c88a142..2f80aa2 100644 --- a/lib/generators/cypress_dev/install_generator.rb +++ b/lib/generators/cypress_on_rails/install_generator.rb @@ -1,4 +1,4 @@ -module CypressDev +module CypressOnRails class InstallGenerator < Rails::Generators::Base class_option :cypress_folder, type: :string, default: 'spec/cypress' class_option :install_cypress_with, type: :string, default: 'yarn' @@ -31,7 +31,7 @@ def install_cypress end def add_initial_files - template "config/initializers/cypress_dev.rb.erb", "config/initializers/cypress_dev.rb" + template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb" copy_file "spec/cypress/cypress_helper.rb", "#{options.cypress_folder}/cypress_helper.rb" copy_file "spec/cypress/support/on-rails.js", "#{options.cypress_folder}/support/on-rails.js" directory 'spec/cypress/app_commands', "#{options.cypress_folder}/app_commands" diff --git a/lib/generators/cypress_dev/templates/config/initializers/cypress_dev.rb.erb b/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb similarity index 67% rename from lib/generators/cypress_dev/templates/config/initializers/cypress_dev.rb.erb rename to lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb index d8b6c6e..251143a 100644 --- a/lib/generators/cypress_dev/templates/config/initializers/cypress_dev.rb.erb +++ b/lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb @@ -1,9 +1,9 @@ -if defined?(CypressDev) - CypressDev.configure do |c| +if defined?(CypressOnRails) + CypressOnRails.configure do |c| c.cypress_folder = File.expand_path("#{__dir__}/../../<%= options.cypress_folder %>") - # WARNING!! CypressDev can execute arbitrary ruby code + # WARNING!! CypressOnRails can execute arbitrary ruby code # please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0 c.use_middleware = Rails.env.test? c.logger = Rails.logger end -end \ No newline at end of file +end diff --git a/lib/generators/cypress_dev/templates/spec/cypress.json b/lib/generators/cypress_on_rails/templates/spec/cypress.json similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress.json rename to lib/generators/cypress_on_rails/templates/spec/cypress.json diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/activerecord_fixtures.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/clean.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/clean.rb similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/clean.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/clean.rb diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/eval.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/eval.rb similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/eval.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/eval.rb diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/factory_bot.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/factory_bot.rb similarity index 81% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/factory_bot.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/factory_bot.rb index 04525ec..1caab9a 100644 --- a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/factory_bot.rb +++ b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/factory_bot.rb @@ -2,7 +2,7 @@ factory_method = factory_options.shift begin logger.debug "running #{factory_method}, #{factory_options}" - CypressDev::SmartFactoryWrapper.public_send(factory_method, *factory_options) + CypressOnRails::SmartFactoryWrapper.public_send(factory_method, *factory_options) rescue => e logger.error "#{e.class}: #{e.message}" logger.error e.backtrace.join("\n") diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/log_fail.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/log_fail.rb similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/log_fail.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/log_fail.rb diff --git a/lib/generators/cypress_dev/templates/spec/cypress/app_commands/scenarios/basic.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/scenarios/basic.rb similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/app_commands/scenarios/basic.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/scenarios/basic.rb diff --git a/lib/generators/cypress_dev/templates/spec/cypress/cypress_helper.rb b/lib/generators/cypress_on_rails/templates/spec/cypress/cypress_helper.rb similarity index 79% rename from lib/generators/cypress_dev/templates/spec/cypress/cypress_helper.rb rename to lib/generators/cypress_on_rails/templates/spec/cypress/cypress_helper.rb index b3a8cd7..0e49aa2 100644 --- a/lib/generators/cypress_dev/templates/spec/cypress/cypress_helper.rb +++ b/lib/generators/cypress_on_rails/templates/spec/cypress/cypress_helper.rb @@ -17,13 +17,13 @@ end end -require 'cypress_dev/smart_factory_wrapper' +require 'cypress_on_rails/smart_factory_wrapper' -factory = CypressDev::SimpleRailsFactory +factory = CypressOnRails::SimpleRailsFactory factory = FactoryBot if defined?(FactoryBot) factory = FactoryGirl if defined?(FactoryGirl) -CypressDev::SmartFactoryWrapper.configure( +CypressOnRails::SmartFactoryWrapper.configure( always_reload: !Rails.configuration.cache_classes, factory: factory, files: %w(spec/factories.rb ./spec/factories/**/*.rb) diff --git a/lib/generators/cypress_dev/templates/spec/cypress/fixtures/example.json b/lib/generators/cypress_on_rails/templates/spec/cypress/fixtures/example.json similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/fixtures/example.json rename to lib/generators/cypress_on_rails/templates/spec/cypress/fixtures/example.json diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/actions.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/actions.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/actions.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/actions.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/aliasing.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/aliasing.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/aliasing.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/aliasing.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/assertions.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/assertions.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/assertions.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/assertions.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/connectors.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/connectors.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/connectors.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/connectors.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/cookies.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cookies.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/cookies.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cookies.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/cypress_api.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/cypress_api.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/files.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/files.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/files.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/files.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/local_storage.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/local_storage.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/local_storage.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/local_storage.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/location.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/location.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/location.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/location.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/misc.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/navigation.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/navigation.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/navigation.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/navigation.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/network_requests.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/network_requests.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/network_requests.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/network_requests.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/querying.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/querying.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/querying.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/querying.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/traversal.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/traversal.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/traversal.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/traversal.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/utilities.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/utilities.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/utilities.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/utilities.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/viewport.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/viewport.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/viewport.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/viewport.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/waiting.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/waiting.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/waiting.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/waiting.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/examples/window.spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/window.spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/examples/window.spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/window.spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/other_spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/other_spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/other_spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/other_spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_factory_bot.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_factory_bot.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_factory_bot.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_factory_bot.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_fixtures.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_fixtures.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_fixtures.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_fixtures.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js b/lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/support/commands.js b/lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/support/commands.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/support/index.js b/lib/generators/cypress_on_rails/templates/spec/cypress/support/index.js similarity index 100% rename from lib/generators/cypress_dev/templates/spec/cypress/support/index.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/support/index.js diff --git a/lib/generators/cypress_dev/templates/spec/cypress/support/on-rails.js b/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js similarity index 95% rename from lib/generators/cypress_dev/templates/spec/cypress/support/on-rails.js rename to lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js index 6efca6b..2ff6ecb 100644 --- a/lib/generators/cypress_dev/templates/spec/cypress/support/on-rails.js +++ b/lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js @@ -1,4 +1,4 @@ -// CypressDev: dont remove these command +// CypressOnRails: dont remove these command Cypress.Commands.add('appCommands', function (body) { cy.log("APP: " + JSON.stringify(body)) cy.request({ @@ -29,7 +29,7 @@ Cypress.Commands.add('appFactories', function (options) { Cypress.Commands.add('appFixtures', function (options) { cy.app('activerecord_fixtures', options) }); -// CypressDev: end +// CypressOnRails: end // The next is optional // beforeEach(() => { diff --git a/spec/cypress_dev/configuration_spec.rb b/spec/cypress_dev/configuration_spec.rb deleted file mode 100644 index d9c884b..0000000 --- a/spec/cypress_dev/configuration_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'cypress_dev/configuration' - -RSpec.describe CypressDev::Configuration do - it 'has defaults' do - CypressDev.configure { |config| config.reset } - - expect(CypressDev.configuration.cypress_folder).to eq('spec/cypress') - expect(CypressDev.configuration.use_middleware?).to eq(true) - expect(CypressDev.configuration.logger).to_not be_nil - end - - it 'can be configured' do - my_logger = Logger.new(STDOUT) - CypressDev.configure do |config| - config.cypress_folder = 'my/path' - config.use_middleware = false - config.logger = my_logger - end - expect(CypressDev.configuration.cypress_folder).to eq('my/path') - expect(CypressDev.configuration.use_middleware?).to eq(false) - expect(CypressDev.configuration.logger).to eq(my_logger) - end -end diff --git a/spec/cypress_dev/command_executor/cypress_helper.rb b/spec/cypress_on_rails/command_executor/cypress_helper.rb similarity index 100% rename from spec/cypress_dev/command_executor/cypress_helper.rb rename to spec/cypress_on_rails/command_executor/cypress_helper.rb diff --git a/spec/cypress_dev/command_executor/test_command.rb b/spec/cypress_on_rails/command_executor/test_command.rb similarity index 100% rename from spec/cypress_dev/command_executor/test_command.rb rename to spec/cypress_on_rails/command_executor/test_command.rb diff --git a/spec/cypress_dev/command_executor/test_command_with_options.rb b/spec/cypress_on_rails/command_executor/test_command_with_options.rb similarity index 100% rename from spec/cypress_dev/command_executor/test_command_with_options.rb rename to spec/cypress_on_rails/command_executor/test_command_with_options.rb diff --git a/spec/cypress_dev/command_executor_spec.rb b/spec/cypress_on_rails/command_executor_spec.rb similarity index 83% rename from spec/cypress_dev/command_executor_spec.rb rename to spec/cypress_on_rails/command_executor_spec.rb index 2f1dba9..cd47d35 100644 --- a/spec/cypress_dev/command_executor_spec.rb +++ b/spec/cypress_on_rails/command_executor_spec.rb @@ -1,6 +1,6 @@ -require 'cypress_dev/command_executor' +require 'cypress_on_rails/command_executor' -RSpec.describe CypressDev::CommandExecutor do +RSpec.describe CypressOnRails::CommandExecutor do describe '.load' do let(:folder) { "#{__dir__}/command_executor" } subject { described_class } @@ -10,7 +10,7 @@ def executor_load(*values) end before do - CypressDev.configuration.cypress_folder = folder + CypressOnRails.configuration.cypress_folder = folder DummyTest.values.clear if defined?(DummyTest) end diff --git a/spec/cypress_on_rails/configuration_spec.rb b/spec/cypress_on_rails/configuration_spec.rb new file mode 100644 index 0000000..ba65157 --- /dev/null +++ b/spec/cypress_on_rails/configuration_spec.rb @@ -0,0 +1,23 @@ +require 'cypress_on_rails/configuration' + +RSpec.describe CypressOnRails::Configuration do + it 'has defaults' do + CypressOnRails.configure { |config| config.reset } + + expect(CypressOnRails.configuration.cypress_folder).to eq('spec/cypress') + expect(CypressOnRails.configuration.use_middleware?).to eq(true) + expect(CypressOnRails.configuration.logger).to_not be_nil + end + + it 'can be configured' do + my_logger = Logger.new(STDOUT) + CypressOnRails.configure do |config| + config.cypress_folder = 'my/path' + config.use_middleware = false + config.logger = my_logger + end + expect(CypressOnRails.configuration.cypress_folder).to eq('my/path') + expect(CypressOnRails.configuration.use_middleware?).to eq(false) + expect(CypressOnRails.configuration.logger).to eq(my_logger) + end +end diff --git a/spec/cypress_dev/middleware_spec.rb b/spec/cypress_on_rails/middleware_spec.rb similarity index 95% rename from spec/cypress_dev/middleware_spec.rb rename to spec/cypress_on_rails/middleware_spec.rb index 03e0ba7..e93b166 100644 --- a/spec/cypress_dev/middleware_spec.rb +++ b/spec/cypress_on_rails/middleware_spec.rb @@ -1,8 +1,8 @@ -require 'cypress_dev/middleware' +require 'cypress_on_rails/middleware' -RSpec.describe CypressDev::Middleware do +RSpec.describe CypressOnRails::Middleware do let(:app) { ->(env) { [200, {}, ["app did #{env['PATH_INFO']}"]] } } - let(:command_executor) { class_double(CypressDev::CommandExecutor) } + let(:command_executor) { class_double(CypressOnRails::CommandExecutor) } let(:file) { class_double(File) } subject { described_class.new(app, command_executor, file) } diff --git a/spec/cypress_dev/railtie_spec.rb b/spec/cypress_on_rails/railtie_spec.rb similarity index 71% rename from spec/cypress_dev/railtie_spec.rb rename to spec/cypress_on_rails/railtie_spec.rb index ef3edf5..88f61b3 100644 --- a/spec/cypress_dev/railtie_spec.rb +++ b/spec/cypress_on_rails/railtie_spec.rb @@ -1,11 +1,11 @@ -require 'cypress_dev/railtie' +require 'cypress_on_rails/railtie' module Rails def self.env end end -RSpec.describe CypressDev::Railtie do +RSpec.describe CypressOnRails::Railtie do let(:rails_env) { double } let(:middleware) { double('Middleware', use: true) } let(:rails_app) { double('RailsApp', middleware: middleware) } @@ -15,7 +15,7 @@ def self.env end it 'runs the middleware in test mode' do - CypressDev::Railtie.initializers.each do |initializer| + CypressOnRails::Railtie.initializers.each do |initializer| initializer.run(rails_app) end end diff --git a/spec/cypress_dev/simple_rails_factory_spec.rb b/spec/cypress_on_rails/simple_rails_factory_spec.rb similarity index 81% rename from spec/cypress_dev/simple_rails_factory_spec.rb rename to spec/cypress_on_rails/simple_rails_factory_spec.rb index be88e77..c93f0be 100644 --- a/spec/cypress_dev/simple_rails_factory_spec.rb +++ b/spec/cypress_on_rails/simple_rails_factory_spec.rb @@ -1,7 +1,7 @@ -require 'cypress_dev/simple_rails_factory' +require 'cypress_on_rails/simple_rails_factory' -RSpec.describe CypressDev::SimpleRailsFactory do - subject { CypressDev::SimpleRailsFactory } +RSpec.describe CypressOnRails::SimpleRailsFactory do + subject { CypressOnRails::SimpleRailsFactory } class AppRecord def self.create!(*) diff --git a/spec/cypress_dev/smart_factory_wrapper_spec.rb b/spec/cypress_on_rails/smart_factory_wrapper_spec.rb similarity index 94% rename from spec/cypress_dev/smart_factory_wrapper_spec.rb rename to spec/cypress_on_rails/smart_factory_wrapper_spec.rb index 1980d52..fdb4e71 100644 --- a/spec/cypress_dev/smart_factory_wrapper_spec.rb +++ b/spec/cypress_on_rails/smart_factory_wrapper_spec.rb @@ -1,6 +1,6 @@ -require 'cypress_dev/smart_factory_wrapper' +require 'cypress_on_rails/smart_factory_wrapper' -RSpec.describe CypressDev::SmartFactoryWrapper do +RSpec.describe CypressOnRails::SmartFactoryWrapper do FileSystemDummy = Struct.new(:file_hash) do def mtime(filename) file_hash.fetch(filename) @@ -11,7 +11,7 @@ def mtime(filename) let(:mtime_hash) { {'file1.rb' => time_now, 'file2.rb' => time_now } } let(:files) { %w(file1.rb file2.rb) } let(:factory_double) { double('FactoryBot', create: true, create_list: true) } - let(:factory_cleaner) { class_double(CypressDev::SmartFactoryWrapper::FactoryCleaner, clean: true) } + let(:factory_cleaner) { class_double(CypressOnRails::SmartFactoryWrapper::FactoryCleaner, clean: true) } let(:kernel_double) { class_double(Kernel, load: true) } let(:file_double) { FileSystemDummy.new(mtime_hash) } let(:dir_double) { class_double(Dir) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 42e1182..4bd0e1a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -95,8 +95,8 @@ Kernel.srand config.seed config.before(:each) do - require 'cypress_dev/configuration' - CypressDev.configure do |config| + require 'cypress_on_rails/configuration' + CypressOnRails.configure do |config| config.reset config.logger = Logger.new('spec/test.log') end From 9d650b1b9df2e5c6fb864faf6782929d8caa868a Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 19 Jun 2019 14:17:20 +1000 Subject: [PATCH 2/4] add fullstop --- cypress-on-rails.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress-on-rails.gemspec b/cypress-on-rails.gemspec index 158480b..7c1e59d 100644 --- a/cypress-on-rails.gemspec +++ b/cypress-on-rails.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |s| s.homepage = "http://github.com/grantspeelman/cypress-on-rails" s.summary = "Integrates cypress with rails or rack applications" s.description = "Integrates cypress with rails or rack applications" - s.post_install_message = 'The CypressDev constant is being deprecated and will be completely removed and replaced with CypressOnRails' + s.post_install_message = 'The CypressDev constant is being deprecated and will be completely removed and replaced with CypressOnRails.' s.rubyforge_project = s.name s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n") From 0c77e287dc4a77f72ec968ac2c2ef5de99f62319 Mon Sep 17 00:00:00 2001 From: Grant Date: Wed, 19 Jun 2019 14:22:33 +1000 Subject: [PATCH 3/4] fixed some missed renames --- README.md | 8 ++++---- spec/integrations/rails_3_2/.gitignore | 2 +- spec/integrations/rails_3_2/test.sh | 2 +- spec/integrations/rails_4_2/.gitignore | 2 +- spec/integrations/rails_4_2/test.sh | 2 +- spec/integrations/rails_5_2/.gitignore | 2 +- spec/integrations/rails_5_2/test.sh | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 84f0fbb..be73f46 100644 --- a/README.md +++ b/README.md @@ -33,17 +33,17 @@ end The generate the boilerplate code using: ``` -bin/rails g cypress_dev:install +bin/rails g cypress_on_rails:install # if you have/want a different cypress folder (default is spec/cypress) -bin/rails g cypress_dev:install --cypress_folder=test/cypress +bin/rails g cypress_on_rails:install --cypress_folder=test/cypress # if you want to install cypress with npm -bin/rails g cypress_dev:install --install_cypress_with=npm +bin/rails g cypress_on_rails:install --install_cypress_with=npm ``` The generator adds the following files/directory to your application: -* `config/initializers/cypress_dev` used to configure CypressDev +* `config/initializers/cypress_on_rails` used to configure CypressDev * `spec/cypress/integrations/` contains your cypress tests * `spec/cypress/support/on-rails.js` contains CypressDev support code * `spec/cypress/app_commands/scenarios/` contains your CypressDev scenario definitions diff --git a/spec/integrations/rails_3_2/.gitignore b/spec/integrations/rails_3_2/.gitignore index 980d7fe..55daf9b 100644 --- a/spec/integrations/rails_3_2/.gitignore +++ b/spec/integrations/rails_3_2/.gitignore @@ -3,7 +3,7 @@ node_modules cypress.json package-lock.json cypress/ -config/initializers/cypress_dev.rb +config/initializers/cypress_on_rails.rb vendor/bundle tmp/pids tmp/cache diff --git a/spec/integrations/rails_3_2/test.sh b/spec/integrations/rails_3_2/test.sh index ce78016..d8c0815 100755 --- a/spec/integrations/rails_3_2/test.sh +++ b/spec/integrations/rails_3_2/test.sh @@ -14,7 +14,7 @@ bundle --version bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle echo '-- cypress install' -bundle exec ./bin/rails g cypress_dev:install --cypress_folder=cypress --install_cypress_with=npm --no-install-cypress-examples +bundle exec ./bin/rails g cypress_on_rails:install --cypress_folder=cypress --install_cypress_with=npm --no-install-cypress-examples echo '-- start rails server' # make sure the server is not running diff --git a/spec/integrations/rails_4_2/.gitignore b/spec/integrations/rails_4_2/.gitignore index f2b2ff0..aa209f1 100644 --- a/spec/integrations/rails_4_2/.gitignore +++ b/spec/integrations/rails_4_2/.gitignore @@ -4,7 +4,7 @@ spec/cypress.json spec/package.json spec/yarn.lock spec/cypress -config/initializers/cypress_dev.rb +config/initializers/cypress_on_rails.rb vendor/bundle tmp/pids tmp/cache \ No newline at end of file diff --git a/spec/integrations/rails_4_2/test.sh b/spec/integrations/rails_4_2/test.sh index 619ed2a..445cead 100755 --- a/spec/integrations/rails_4_2/test.sh +++ b/spec/integrations/rails_4_2/test.sh @@ -14,7 +14,7 @@ bundle --version bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle echo '-- cypress install' -bundle exec ./bin/rails g cypress_dev:install --no-install-cypress-examples +bundle exec ./bin/rails g cypress_on_rails:install --no-install-cypress-examples echo '-- start rails server' # make sure the server is not running diff --git a/spec/integrations/rails_5_2/.gitignore b/spec/integrations/rails_5_2/.gitignore index e2b42b5..f2209aa 100644 --- a/spec/integrations/rails_5_2/.gitignore +++ b/spec/integrations/rails_5_2/.gitignore @@ -4,7 +4,7 @@ test/cypress.json test/package.json test/yarn.lock test/cypress/ -config/initializers/cypress_dev.rb +config/initializers/cypress_on_rails.rb vendor/bundle tmp/pids db/*.sqlite3 diff --git a/spec/integrations/rails_5_2/test.sh b/spec/integrations/rails_5_2/test.sh index 8942920..7dbe712 100755 --- a/spec/integrations/rails_5_2/test.sh +++ b/spec/integrations/rails_5_2/test.sh @@ -17,7 +17,7 @@ echo '-- migration' bin/rails db:migrate echo '-- cypress install' -bundle exec ./bin/rails g cypress_dev:install --cypress_folder=test/cypress --no-install-cypress-examples +bundle exec ./bin/rails g cypress_on_rails:install --cypress_folder=test/cypress --no-install-cypress-examples echo '-- start rails server' # make sure the server is not running From e772d57f5220613f8f698c7af53291430d063631 Mon Sep 17 00:00:00 2001 From: Grant Date: Fri, 21 Jun 2019 08:19:38 +1000 Subject: [PATCH 4/4] support old require statements --- lib/cypress_dev/middleware.rb | 2 ++ lib/cypress_dev/smart_factory_wrapper.rb | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 lib/cypress_dev/middleware.rb create mode 100644 lib/cypress_dev/smart_factory_wrapper.rb diff --git a/lib/cypress_dev/middleware.rb b/lib/cypress_dev/middleware.rb new file mode 100644 index 0000000..06d6f3f --- /dev/null +++ b/lib/cypress_dev/middleware.rb @@ -0,0 +1,2 @@ +warn "cypress_dev is being deprecated, please require \"cypress_on_rails/middleware\" instead" +require 'cypress_on_rails/middleware' diff --git a/lib/cypress_dev/smart_factory_wrapper.rb b/lib/cypress_dev/smart_factory_wrapper.rb new file mode 100644 index 0000000..5105077 --- /dev/null +++ b/lib/cypress_dev/smart_factory_wrapper.rb @@ -0,0 +1,2 @@ +warn "cypress_dev is being deprecated, please require \"cypress_on_rails/smart_factory_wrapper\" instead" +require 'cypress_on_rails/smart_factory_wrapper'