Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Order Discount Breakdown #193

Conversation

jakemumu
Copy link

@jakemumu jakemumu commented Mar 14, 2023

Summary

Patches an erroneous order breakdown

More info: #191

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@jakemumu
Copy link
Author

jakemumu commented Mar 14, 2023

Hey @kennyadsl -- Re-opened this PR on a new repo where I could write the tests locally, but I am indeed having trouble.

I followed the steps in the readme and ran bin/rake from the root of the extension directory -- this created the dummy-app for me.

When I run bin/rake again from the root I get 0 tests to run. If I cd into the dummy app and run rspec same issue, I tried something like rspec ../spec from within the dummy app and appears to pick up the tests but doesn't run them / they fail.

Apologies but -- how do I run the tests on a Solidus extension I would absolutely love to know so I can be of better help to the project : )

@kennyadsl
Copy link
Member

I can run specs with bin/rspec spec from the root. Sorry for the confusion in the README, I'm going to update it.

@kennyadsl
Copy link
Member

BTW, bin/rake also works for me from the root. It executes all specs correctly after creating the dummy app. Can you please post the full output of the command? Better if you remove the dummy-app folder before trying again to have the full logs. Thanks!

@jakemumu
Copy link
Author

Hmm -- that's so weird, here are my results:

solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rspec spec
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.


Finished in 0.00079 seconds (files took 0.05221 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform

Here's my bin/rake output:

solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rake
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
bin/rspec
Creating the dummy-app app...
      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  Gemfile
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/assets/images
      create  bin
      create  bin/rails
      create  bin/rake
      create  bin/setup
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_0.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/assets
      create  log
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/apple-touch-icon-precomposed.png
      create  public/apple-touch-icon.png
      create  public/favicon.ico
      create  public/robots.txt
      create  tmp
      create  tmp/pids
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor
      create  storage
      create  tmp/storage
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_0.rb
         run  bundle install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies....
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using thor 1.2.1
Using zeitwerk 2.6.7
Using sqlite3 1.6.1 (x86_64-darwin)
Using i18n 1.12.0
Using tzinfo 2.0.6
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using date 3.3.3
Using timeout 0.3.2
Using bindex 0.8.1
Using net-protocol 0.2.1
Using io-console 0.6.0
Using net-imap 0.3.4
Using reline 0.3.2
Using builder 3.2.4
Using irb 1.6.3
Using crass 1.0.6
Using debug 1.7.1
Using activesupport 7.0.4.3
Using websocket-driver 0.7.5
Using puma 5.6.5
Using bundler 2.2.27
Using net-pop 0.1.2
Using net-smtp 0.3.3
Using method_source 1.0.0
Using mail 2.8.1
Using erubi 1.12.0
Using rack 2.2.6.4
Using globalid 1.1.0
Using rack-test 2.1.0
Using activejob 7.0.4.3
Using sprockets 4.2.0
Using activemodel 7.0.4.3
Using racc 1.6.2
Using activerecord 7.0.4.3
Using nokogiri 1.14.2 (x86_64-darwin)
Using rails-dom-testing 2.0.3
Using loofah 2.19.1
Using rails-html-sanitizer 1.5.0
Using actionview 7.0.4.3
Using actionpack 7.0.4.3
Using jbuilder 2.11.5
Using actioncable 7.0.4.3
Using activestorage 7.0.4.3
Using actionmailer 7.0.4.3
Using actionmailbox 7.0.4.3
Using sprockets-rails 3.4.2
Using actiontext 7.0.4.3
Using railties 7.0.4.3
Using importmap-rails 1.1.5
Using rails 7.0.4.3
Using stimulus-rails 1.2.1
Using turbo-rails 1.4.0
Using web-console 4.2.0
Bundle complete! 11 Gemfile dependencies, 59 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
       rails  importmap:install
Add Importmap include tags in application layout
      insert  app/views/layouts/application.html.erb
Create application.js module as entrypoint
      create  app/javascript/application.js
Use vendor/javascript for downloaded pins
      create  vendor/javascript
      create  vendor/javascript/.keep
Ensure JavaScript files are in the Sprocket manifest
      append  app/assets/config/manifest.js
Configure importmap paths in config/importmap.rb
      create  config/importmap.rb
Copying binstub
      create  bin/importmap
       rails  turbo:install stimulus:install
Import Turbo
      append  app/javascript/application.js
Pin Turbo
      append  config/importmap.rb
Enable redis in bundle
        gsub  Gemfile
         run  bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.2.2
Using minitest 5.18.0
Using builder 3.2.4
Using erubi 1.12.0
Using racc 1.6.2
Using crass 1.0.6
Using rack 2.2.6.4
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using marcel 1.0.2
Using mini_mime 1.1.2
Using date 3.3.3
Using timeout 0.3.2
Using bindex 0.8.1
Using bundler 2.2.27
Using io-console 0.6.0
Using method_source 1.0.0
Using reline 0.3.2
Using zeitwerk 2.6.7
Using irb 1.6.3
Using sqlite3 1.6.1 (x86_64-darwin)
Using debug 1.7.1
Using tzinfo 2.0.6
Using nokogiri 1.14.2 (x86_64-darwin)
Using rack-test 2.1.0
Using loofah 2.19.1
Using net-protocol 0.2.1
Using rails-html-sanitizer 1.5.0
Using net-imap 0.3.4
Using sprockets 4.2.0
Using redis 4.8.1
Using i18n 1.12.0
Using websocket-driver 0.7.5
Using activesupport 7.0.4.3
Using net-pop 0.1.2
Using rails-dom-testing 2.0.3
Using thor 1.2.1
Using actionview 7.0.4.3
Using globalid 1.1.0
Using actionpack 7.0.4.3
Using activejob 7.0.4.3
Using actioncable 7.0.4.3
Using railties 7.0.4.3
Using activemodel 7.0.4.3
Using importmap-rails 1.1.5
Using activerecord 7.0.4.3
Using puma 5.6.5
Using activestorage 7.0.4.3
Using stimulus-rails 1.2.1
Using actiontext 7.0.4.3
Using net-smtp 0.3.3
Using web-console 4.2.0
Using mail 2.8.1
Using jbuilder 2.11.5
Using actionmailbox 7.0.4.3
Using sprockets-rails 3.4.2
Using actionmailer 7.0.4.3
Using turbo-rails 1.4.0
Using rails 7.0.4.3
Bundle complete! 12 Gemfile dependencies, 60 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Switch development cable to use redis
        gsub  config/cable.yml
Create controllers directory
      create  app/javascript/controllers
      create  app/javascript/controllers/index.js
      create  app/javascript/controllers/application.js
      create  app/javascript/controllers/hello_controller.js
Import Stimulus controllers
      append  app/javascript/application.js
Pin Stimulus
Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true"
      append  config/importmap.rb
Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
      append  config/importmap.rb
Pin all controllers
Appending: pin_all_from "app/javascript/controllers", under: "controllers"
      append  config/importmap.rb
Unknown switches "--github"
Did you mean?  "--git"
Dropped database 'db/development.sqlite3'
Database 'db/test.sqlite3' does not exist
Created database 'db/development.sqlite3'
Created database 'db/test.sqlite3'
Could not find generator 'solidus:install'.
Run `bin/rails generate --help` for more options.
Unknown switches "--path"
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.


Finished in 0.00087 seconds (files took 0.05113 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform

Still results in:

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) ✗ bin/rspec spec
Could not find generator 'solidus_paypal_commerce_platform:install'.
Run `bin/rails generate --help` for more options.
No examples found.


Finished in 0.0008 seconds (files took 0.0507 seconds to load)
0 examples, 0 failures

/Users/jacobpenn/jacobpenn/Development/Minimal/solidus_extensions/solidus_paypal_commerce_platform

@kennyadsl
Copy link
Member

That's so weird... Just to be sure, is bug/order_discount_breakdown based against the latest code in master?

@waiting-for-dev
Copy link
Contributor

waiting-for-dev commented Mar 15, 2023

What are which bin/rspec & which bin/rake return? Maybe you have those aliased to bundle exec ...?

@jakemumu
Copy link
Author

Yeah... I'm still stumped, I rebased this off of master and then deleted and redid the process locally, bin/rake still resulted in 0 tests being run.

➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) which bin/rake
bin/rake
➜  solidus_paypal_commerce_platform git:(bug/order_discount_breakdown) which bin/rspec
bin/rspec

I know I'm a bit slow here but when I get another chance I'm down to put some binds in places and step through to find the issue, I just don't really know much about how rspec boots.

@jakemumu
Copy link
Author

jakemumu commented May 7, 2023

I'd still love to get this merged.. :/

@waiting-for-dev
Copy link
Contributor

@jakemumu did you try debugging with #193 (comment)?

@jakemumu
Copy link
Author

jakemumu commented May 10, 2023

@waiting-for-dev thanks yeah I tried it here: #193 (comment) - whichever combination with bundle or not wasn't pulling the tests for some reason -- I'll give it another try when I get a chance but I'm surprised others aren't having this issue -- it's a pretty critical patch for us.

--

If I can't get them running though perhaps someone else would be willing to assist with a test?

@kennyadsl
Copy link
Member

@jakemumu I'm looking to see if I can move this forward.

waiting-for-dev and others added 3 commits May 11, 2023 12:09
Ruby v2.7 reached EOL on 2023-03-31 [1].

This also fixes testing against Solidus master, which also dropped Ruby
2.7 support [2].

[1] - https://www.ruby-lang.org/en/downloads/branches/
[2] - solidusio/solidus#5012
@kennyadsl kennyadsl force-pushed the bug/order_discount_breakdown branch from c27ca3f to 5d21e5f Compare May 11, 2023 10:50
@kennyadsl kennyadsl changed the base branch from master to waiting-for-dev/solidus_main May 11, 2023 10:50
@kennyadsl
Copy link
Member

@jakemumu I rebased this PR against a branch that allows specs to pass (locally only, we are still waiting for selenium/capybara to fix their problem) and added a commit with a test for the fix.

I will rebase and squash everything in a single commit once we have the spec green, then I'll craft a release for this. Thanks for your help!

This spec fails with the previous version of the code.
@kennyadsl kennyadsl force-pushed the bug/order_discount_breakdown branch from 5d21e5f to 3cf8e3e Compare May 11, 2023 11:34
@jakemumu
Copy link
Author

🥳 🥳 🥳 🥳 -- thanks so much @kennyadsl -- apologies I wasn't able to fully push that one over the finish line, really appreciate you helping get it there!

@kennyadsl
Copy link
Member

@jakemumu no problem, I'm here to help!

@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/solidus_main branch from 05cefe4 to 5d33b43 Compare May 23, 2023 13:20
@waiting-for-dev waiting-for-dev deleted the branch solidusio:waiting-for-dev/solidus_main May 23, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants