-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes issue with ActiveStorage::FixtureSet.blob causing a TypeError #2671
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
Conversation
Nice! Would it be possible to add a scenario to |
@pirj I've added a scenario covering the issue. |
Some feature failed. Can you please have a look? |
@pirj thanks for the heads up. The test fails because I added a check around the test. This should fix the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
It seems that RubyGems times out, and causes red ci. |
I don't understand why it won't let me force push. |
From 106cca999d2aa1afff5c478631045c35cf0380df Mon Sep 17 00:00:00 2001
From: Jason Yates <[email protected]>
Date: Wed, 19 Apr 2023 14:27:26 -0400
Subject: [PATCH] fixup!
---
features/file_fixture.feature | 7 +++----
features/support/rails_versions.rb | 15 +++++++++++++++
2 files changed, 18 insertions(+), 4 deletions(-)
create mode 100644 features/support/rails_versions.rb
diff --git features/file_fixture.feature features/file_fixture.feature
index 845c280c..c6a765a5 100644
--- features/file_fixture.feature
+++ features/file_fixture.feature
@@ -37,6 +37,7 @@ Feature: Using `file_fixture`
When I run `rspec spec/lib/file_spec.rb`
Then the examples should all pass
+ @rails_post_7
Scenario: Creating a ActiveStorage::Blob from a file fixture
Given a file named "spec/fixtures/files/sample.txt" with:
"""
@@ -48,11 +49,9 @@ Feature: Using `file_fixture`
RSpec.describe "blob" do
it "creates a blob from a sample file" do
- if ::Rails::VERSION::STRING >= '7'
- expect(ActiveStorage::FixtureSet.blob(filename: "sample.txt")).to include("sample.txt")
- end
+ expect(ActiveStorage::FixtureSet.blob(filename: "sample.txt")).to include("sample.txt")
end
end
"""
When I run `rspec spec/lib/fixture_set_blob.rb`
- Then the examples should all pass
\ No newline at end of file
+ Then the examples should all pass
diff --git features/support/rails_versions.rb features/support/rails_versions.rb
new file mode 100644
index 00000000..3b2e3ef7
--- /dev/null
+++ features/support/rails_versions.rb
@@ -0,0 +1,15 @@
+def rails_version
+ string_version = ENV.fetch("https://github.com/RAILS_VERSION", "~> 7.0.0")
+ if string_version == "main" || string_version.nil?
+ Float::INFINITY
+ else
+ string_version[/\d[\.-]\d/].tr('-', '.')
+ end
+end
+
+Before "@rails_post_7" do |scenario|
+ if rails_version.to_f < 7.0
+ warn "Skipping scenario #{scenario.name} on Rails v#{rails_version}"
+ skip_this_scenario
+ end
+end
--
2.39.1 |
@pirj I was able to add your patch. You're awesome 💯 👍 |
…veStorage::FixtureSet.file_fixture_path is not set.
I fixed the Rubocop issue. Hopefully that is everything 🤞. |
Fixes issue with ActiveStorage::FixtureSet.blob causing a TypeError
Released in 6.0.3 |
This PR fixes an issue where calling
ActiveStorage::FixtureSet.blob
will error withTypeError: no implicit conversion of nil into String
because theblob
method expectsActiveStorage::FixtureSet.file_fixture_path
to be set.This PR adds a default value to
ActiveStorage::FixtureSet.file_fixture_path
, fixing the issue. It checks to see if it is defined because this is a new feature of Rails 7.More information can be found in #2637.
fixes #2637