rspec-mocks | RSpec 's 'test double ' framework , with support | Unit Testing library
kandi X-RAY | rspec-mocks Summary
Support
Quality
Security
License
Reuse
- Attempts to instantiate a new mock
- Raises an exception
- Creates a new mock expectation
- Generate a list of foo
- Declare parent method
- Sets up the item .
rspec-mocks Key Features
rspec-mocks Examples and Code Snippets
Trending Discussions on rspec-mocks
Trending Discussions on rspec-mocks
QUESTION
I need to run a ruby project with gems and specs. When I type bundle install I received:
bash-5.1# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/...
Resolving dependencies...
Using bundler 2.3.9
Using diff-lcs 1.5.0
Using rspec-support 3.1.2
Fetching pg 1.3.4
Using rspec-core 3.1.7
Using rspec-expectations 3.1.2
Using rspec-mocks 3.1.3
Using rspec 3.1.0
Installing pg 1.3.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/lib64/ruby/gems/3.0.0/gems/pg-1.3.4/ext
/usr/bin/ruby -I /usr/lib64/ruby/3.0.0 -r ./siteconf20220320-7556-sm89ck.rb
extconf.rb
Calling libpq with GVL unlocked
checking for pg_config... no
checking for libpq per pkg-config... no
Using libpq from
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*****************************************************************************
Unable to find PostgreSQL client library.
Please install libpq or postgresql client package like so:
sudo apt install libpq-dev
sudo yum install postgresql-devel
sudo zypper in postgresql-devel
sudo pacman -S postgresql-libs
or try again with:
gem install pg -- --with-pg-config=/path/to/pg_config
or set library paths manually with:
gem install pg -- --with-pg-include=/path/to/libpq-fe.h/
--with-pg-lib=/path/to/libpq.so/
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-gvl-unlock
--disable-gvl-unlock
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-libpq-config
--without-libpq-config
--with-pkg-config
--without-pkg-config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib64
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/usr/lib64/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/pg-1.3.4/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/lib64/ruby/gems/3.0.0/gems/pg-1.3.4 for
inspection.
Results logged to
/usr/lib64/ruby/gems/3.0.0/extensions/x86_64-linux/3.0.0/pg-1.3.4/gem_make.out
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:93:in `run'
/usr/lib64/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
/usr/lib64/ruby/gems/3.0.0/gems/tempfile-0.1.2/lib/tempfile.rb:317:in `open'
/usr/lib64/ruby/3.0.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:159:in `build_extension'
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:193:in `block in
build_extensions'
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:190:in `each'
/usr/lib64/ruby/3.0.0/rubygems/ext/builder.rb:190:in `build_extensions'
/usr/lib64/ruby/3.0.0/rubygems/installer.rb:845:in `build_extensions'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/source/rubygems.rb:204:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/gem_installer.rb:54:in
`install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:62:in
`apply_func'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:57:in
`block in process_queue'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:54:in
`loop'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:54:in
`process_queue'
/usr/lib64/ruby/gems/3.0.0/gems/bundler-2.3.9/lib/bundler/worker.rb:91:in
`block (2 levels) in create_threads'
An error occurred while installing pg (1.3.4), and Bundler cannot
continue.
In Gemfile:
pg
I am trying to convince them to switch to Slackware as the main OS but I am having trouble installing and running the skeleton program that uses psql, ruby and soon enough ruby on rails.
I installed libpqxx slackbuild, sqlite3 gem, postgresql (14.2) slackbuild and when I run rnu ./import_db.sh it says: bash-5.1# ./import_db.sh dropdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? createdb: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? bash-5.1#
ANSWER
Answered 2022-Mar-21 at 03:29I've just realised that Slackware uses slackpkg
as package manager. Not quite sure if this is the library you need, but try installing with:
slackpkg install libpqxx
QUESTION
I want to test the else
branch of the following ruby code:
SCHEMA_SOURCE = if File.exist? SCHEMA_FILENAME
SCHEMA_FILENAME
else
ContentfulApi::Http
end
I cannot find a way to mock the non-existence of the file SCHEMA_FILENAME
. Here are the simplified versions of the test I have tried, and the error:
it 'fails to find file when it does not exist' do
allow(File).to receive(:exists?).and_return(false)
expect(File.exist?(ContentfulApi::SCHEMA_FILENAME)).to be_falsey
end
it 'fails to find file when it does not exist' do
allow(File).to receive(:exists?).with(ContentfulApi::SCHEMA_FILENAME)\
.and_return(false)
expect(File.exist?(ContentfulApi::SCHEMA_FILENAME)).to be_falsey
end
These both fail with the error
expected: falsey value
got: true
it 'fails to find file when it does not exist' do
File.stub(:exists?) { false }
expect(File.exist?(ContentfulApi::SCHEMA_FILENAME)).to be_falsey
end
it 'fails to find file when it does not exist' do
File.stub!(:exists?).with(ContentfulApi::SCHEMA_FILENAME)\
.and_return(false)
expect(File.exist?(ContentfulApi::SCHEMA_FILENAME)).to be_falsey
end
These both fail with the error
undefined method `stub' for File:Class
My first two attempts follow the example in the Method Stubs documentation, though there may be a distinction between classes and objects that is not explored in that documentation. (Though classes are objects in Ruby, right?)
The second two attempts follow older documentation.
How should I stub File.exist? SCHEMA_FILENAME
so that it returns false
even though the file does actually exist?
N.B. The approaches in these similar questions do not work:
- rspec to stub several File.exists? calls
- Rspec -- need to stub File.open that gets called in another file
- rspec undefined method stub for model
- how to reset expectations on a mocked class method?
- How do I stub out a specific file with rspec?
- Can't stub things with Rspec
- rspec 3 - stub a class method
ANSWER
Answered 2022-Mar-13 at 08:38You're mocking File.exists?
and calling File.exist?
.
Note that if you have verify_partial_doubles
set, and you should, RSpec won't allow you to mock a method which does not exist.
RSpec.configure do |config|
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end
RSpec.describe File do
it 'cannot mock a method whcih does not exist' do
allow(File).to receive(:dslkfjalk).and_return(true)
end
end
Failures:
1) File cannot mock a method whcih does not exist
Failure/Error: allow(File).to receive(:dslkfjalk).and_return(true)
File does not implement: dslkfjalk
But File
does have both exist?
and exists?
methods. File.exists?
is deprecated and removed from the documentation, but I guess it still... exists.
QUESTION
The RSpec documentation shows how to mock a class method. How can I replace an instance method instead. Here is a code example using rspec-mocks
to make this more concrete:
require 'rspec'
class Foo
def foo
"foo"
end
def foobar
foo + "bar"
end
end
RSpec.describe "Foo" do
it "mocks foo" do
allow(Foo).to receive(:foo).and_return("bar")
foo = Foo.new
expect(foo.foobar).to eq("barbar")
end
end
This gives "Foo does not implement: foo". Granted, this is contrived for simplification. In the actual class I'm testing, foo
makes a HTTP request, so I want to mock it while writing a spec for foobar
. I'd like to do this with rspec-mocks
, but if another gem can help here, I'm open to that as well.
ANSWER
Answered 2022-Mar-02 at 23:23Just stub the method on the instance instead of the class:
RSpec.describe "Foo" do
it "mocks foo" do
foo = Foo.new
allow(foo).to receive(:foo).and_return("bar")
expect(foo.foobar).to eq("barbar")
end
end
QUESTION
I'm trying to install slacker so I can do some SQL testing. I've never used Ruby before. I'm on Windows. My dev box only has access to the Internet via a proxy and I have to nominate all URls in advance.
I I downloaded and ran rubyinstaller-devkit-2.7.5-1-x64.exe
(because it requires Ruby 2.4/2.5+ and 2.7.X was recommended at the Ruby site) accepting all of the defaults.
When it got to MSYS2 I hit ENTER (MSYS2 base installation and MINGW development toolchain).
I got errors in the gpg section, e.g. (but not limited to)
==> Updating trust database...
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 6 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 6 signed: 6 trust: 0-, 0q, 0n, 6m, 0f, 0u
gpg: depth: 2 valid: 6 signed: 0 trust: 6-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2022-03-03
gpg: error retrieving 'alexey.pawlow@gmail.com' via WKD: No name
gpg: error reading key: No name
gpg: refreshing 1 key from hkps://keyserver.ubuntu.com
gpg: keyserver refresh failed: No name
==> ERROR: Could not update key: F40D263ECA25678A
Later, it said
MSYS2 seems to be properly installed
I then got a whole bunch of warnings about things being up to date -- skipping
.
Then, it said
Install MSYS2 and MINGW development toolchain succeeded
and the MSYS2 window went back to the installation menu, so I closed the window.
Then, as per the instructions on the slacker site, I tried:
gem install slacker
I got:
ERROR: Could not find a valid gem 'slacker' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://rubygems.org/specs.4.8.gz)
I figured this was a proxy server issue and read around and discovered that if I downloaded the gems to a local folder, I could run the command from that folder and it should work. So, I downloaded slacker-1.0.24.gem
from https://rubygems.org/gems/, unblocked the file and tried the command from that folder. I got a similar error to above for tiny_tds
. I repeated the process until I appeared to have all required gems:
bundler-1.17.3.gem
diff-lcs-1.5.0.gem
rspec-3.10.0.gem
rspec-core-3.10.1.gem
rspec-expectations-3.10.1.gem
rspec-mocks-3.10.2.gem
rspec-support-3.10.3.gem
ruby-odbc-0.99999.gem
slacker-1.0.24.gem
tiny_tds-2.1.5.gem
Finally, it looked like it was working for a few seconds and then I got a whole new bunch of errors. Here are the first few - I can post the lot if it will help:
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-freetds
error: failed retrieving file 'mingw-w64-x86_64-openssl-1.1.1.l-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
warning: too many errors from mirror.msys2.org, skipping for the remainder of this transaction
error: failed retrieving file 'mingw-w64-x86_64-freetds-1.2.6-2-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
error: failed retrieving file 'mingw-w64-x86_64-p11-kit-0.24.0-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
error: failed retrieving file 'mingw-w64-x86_64-ca-certificates-20210119-1-any.pkg.tar.zst' from mirror.msys2.org : Could not resolve host: mirror.msys2.org
then after those, this:
warning: failed to retrieve some files
error: failed to commit transaction (invalid url for server)
pacman failed with the following output:
resolving dependencies...
looking for conflicting packages...
Packages (6) mingw-w64-x86_64-ca-certificates-20210119-1 mingw-w64-x86_64-libffi-3.3-4 mingw-w64-x86_64-libtasn1-4.18.0-1 mingw-w64-x86_64-openssl-1.1.1.l-1 mingw-w64-x86_64-p11-kit-0.24.0-1 mingw-w64-x86_64-freetds-1.2.6-2
Total Download Size: 6.24 MiB
Total Installed Size: 77.14 MiB
:: Proceed with installation? [Y/n]
:: Retrieving packages...
mingw-w64-x86_64-openssl-1.1.1.l-1-any downloading...
mingw-w64-x86_64-freetds-1.2.6-2-any downloading...
mingw-w64-x86_64-p11-kit-0.24.0-1-any downloading...
mingw-w64-x86_64-ca-certificates-20210119-1-any downloading...
mingw-w64-x86_64-libtasn1-4.18.0-1-any downloading...
Errors occurred, no packages were upgraded.
Building native extensions. This could take a while...
ERROR: Error installing slacker:
ERROR: Failed to build gem native extension.
And more. There was also a reference to a log file which contained sections like this:
find_header: checking for sybfront.h... -------------------- no
"gcc -o conftest.exe -IC:/Ruby27-x64/include/ruby-2.7.0/x64-mingw32 -IC:/Ruby27-x64/include/ruby-2.7.0/ruby/backward -IC:/Ruby27-x64/include/ruby-2.7.0 -I. -I/opt/local/include -I/opt/local/include/freetds -I/usr/local/include -I/usr/local/include/freetds -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby27-x64/lib -L/opt/local/lib -L/opt/local/lib/freetds -L/usr/local/lib -L/usr/local/lib/freetds -L. -pipe -s -fstack-protector-strong -m64 -lx64-msvcrt-ruby270 -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include
4: #include
5: int main(int argc, char **argv)
6: {
7: return !!argv[argc];
8: }
/* end */
To my questions:
- Is there any way to resolve this without getting the URLs added to the proxy list? It's basically at least a week per change because of the hoops we have to jump through.
- If I need to get the URLs added to the proxy list, is there a master list or URLs so I can do it once and be sure it will work? I've tried Googling it but I just end up with help getting Ruby code to use proxys not the installer.
ANSWER
Answered 2022-Jan-16 at 16:19I have answered question 1 myself. If anyone else can give me a definitive answer to part two, I will happily mark that as the answer.
I guessed that I needed to download and install the mingw
packages that couldn't be downloaded somewhere. I did a bit of trawling and found this article (Offline installation of packages)which gave me the pointers I needed. I got these four files from https://repo.msys2.org/mingw/mingw64/:
mingw-w64-x86_64-freetds-1.2.6-2-any.pkg.tar.zst
mingw-w64-x86_64-libtasn1-4.18.0-1-any.pkg.tar.zst
mingw-w64-x86_64-openssl-1.1.1.l-1-any.pkg.tar.zst
mingw-w64-x86_64-p11-kit-0.24.0-1-any.pkg.tar.zst
And mingw-w64-x86_64-ca-certificates-20210119-1-any.pkg.tar.zst
from https://ftp.acc.umu.se/mirror/msys2.org/mingw/mingw64/.
I copied them to: C:\Ruby27-x64\msys64\home\myUserId\freetds
which is in my home dir in msys
. (From errors I got the first time, it looks like the folder name has to match the database name.) Then I started msys
by running: C:\Ruby27-x64\msys64\msys2.exe
.
In msys
, I ran:
cd freetds/
then, to create a repository database just for freetds:
$ repo-add freetds.db.tar.gz *.pkg.tar.zst
I got a bunch of messages telling me it was ==> Adding package 'ming...
I needed to edit the pacman.conf file to point to my temp database, so I made a copy of the pacman.conf file:
cp /etc/pacman.conf /etc/pacman.conf.old
I edited pacman.conf
in Notepad++, changing SigLevel
to = Never
, commenting out the other repositories, and adding this to the end:
[freetds]
Server = file:///home/myUserId/freetds
Then, I made pacman
synchronise with the database I created:
pacman -Sy
:: Synchronizing package databases...
freetds 1676.0 B 7.54 KiB/s 00:00 [#####################] 100%
I tried gem install slacker
again but there was another missing package "mingw-w64-x86_64-libffi
, so I downloaded mingw-w64-x86_64-libffi-3.3-4-any.pkg.tar.zst
and put it in the same place, re-ran the repo-add
command and pacman Sy
and then gem install slacker
.
This worked and I got 10 gems installed
. I've run the test project documented in the slacker GitHub pages and it worked.
QUESTION
For below code in spec:
let(:my_model) { instance_double(MyModel, is_happy: true) }
I want to confirm what is_happy: true
does exactly.
I think it stub the is_happy
instance method of MyModel
double and make it always return true
in the spec, but I want to see official RSpec doc confirming this.
I can see this RSpec doc, but it doesn't mention the method stubbing part.
Where in the doc is this documented and how should I navigate docs around RSpec?
ANSWER
Answered 2021-Dec-13 at 11:25From the Yard documentation:
instance_double(doubled_class, stubs)
Parameters:
- doubled_class (String, Class)
- stubs (Hash) — hash of message/return-value pairs
is_happy: true
will make the double return true
when sent the the message is_happy
.
RSpec has both the normal API documentation which is generated by Yard from the code and the guide style documenation that you have linked. Its quite common to have both in a well documented project since they serve different purposes.
QUESTION
I'm seeing the following error it only is appearing in cron jobs using the whenever gem. The application is working correctly otherwise. The scheduled job doesn't run. But I can run it manually and it does work.
/usr/local/bundle/gems/bundler-2.2.27/lib/bundler/definition.rb:496:in `materialize': Could not find rails-5.2.6, rake-12.3.3, puma-4.3.8, mysql2-0.5.3, sass-rails-5.1.0, uglifier-4.2.0, coffee-rails-4.2.2, jquery-rails-4.4.0, jbuilder-2.11.2, sdoc-0.4.2, bootsnap-1.8.1, blacklight_oai_provider-6.1.1, whenever-1.0.0, active-fedora-13.2.4, active-triples-1.1.1, blacklight-6.24.0, hydra-head-12.0.1, ldp-1.0.3, nokogiri-1.12.4-x86_64-linux, solrizer-4.1.0, rsolr-2.3.0, devise-4.8.0, devise-guests-0.7.0, rdf-3.1.13, byebug-11.1.3, rspec-rails-5.0.2, jettywrapper-2.0.5, listen-3.7.0, fcrepo_wrapper-0.9.0, solr_wrapper-2.2.0, factory_bot_rails-6.2.0, web-console-2.3.0, spring-3.0.0, actioncable-5.2.6, actionmailer-5.2.6, actionpack-5.2.6, actionview-5.2.6, activejob-5.2.6, activemodel-5.2.6, activerecord-5.2.6, activestorage-5.2.6, activesupport-5.2.6, railties-5.2.6, sprockets-rails-3.2.2, nio4r-2.5.8, sass-3.7.4, sprockets-3.7.2, tilt-2.0.10, execjs-2.8.1, coffee-script-2.4.1, rails-dom-testing-2.0.3, thor-1.1.0, json-1.8.6, rdoc-4.3.0, msgpack-1.4.2, oai-1.1.0, chronic-0.10.2, deprecation-1.1.0, faraday-0.17.4, faraday-encoding-0.0.5, ruby-progressbar-1.11.0, rdf-vocab-3.1.14, bootstrap-sass-3.4.1, globalid-0.5.2, kaminari-1.2.1, twitter-typeahead-rails-0.11.1.pre.corejavascript, hydra-access-controls-12.0.1, hydra-core-12.0.1, http_logger-0.6.0, json-ld-3.1.9, rdf-isomorphic-3.1.1, rdf-turtle-3.1.3, slop-4.9.1, racc-1.5.2, xml-simple-1.1.9, builder-3.2.4, bcrypt-3.1.16, orm_adapter-0.5.0, responders-3.0.1, warden-1.2.9, hamster-3.0.0, link_header-0.0.8, rspec-core-3.10.1, rspec-expectations-3.10.1, rspec-mocks-3.10.2, rspec-support-3.10.2, childprocess-4.1.0, i18n-1.8.10, rubyzip-1.3.0, rb-fsevent-0.11.0, rb-inotify-0.10.1, retriable-3.1.2, factory_bot-6.2.0, binding_of_caller-1.0.0, websocket-driver-0.7.5, mail-2.7.1, rack-2.2.3, rack-test-1.1.0, rails-html-sanitizer-1.4.2, erubi-1.10.0, arel-9.0.0, marcel-1.0.1, concurrent-ruby-1.1.9, minitest-5.14.4, tzinfo-1.2.9, method_source-1.0.0, sass-listen-4.0.0, coffee-script-source-1.12.2, faraday_middleware-0.14.0, multipart-post-2.1.1, autoprefixer-rails-10.3.3.0, sassc-2.4.0, kaminari-actionview-1.2.1, kaminari-activerecord-1.2.1, kaminari-core-1.2.1, blacklight-access_controls-6.0.0, cancancan-1.17.0, htmlentities-4.3.4, json-canonicalization-0.2.1, multi_json-1.15.0, ebnf-2.2.1, rexml-3.2.5, diff-lcs-1.4.4, ffi-1.15.4, debug_inspector-1.1.0, websocket-extensions-0.1.5, mini_mime-1.1.1, loofah-2.12.0, thread_safe-0.3.6, amazing_print-1.3.0, sxp-1.1.0, unicode-types-1.7.0, crass-1.0.6 in any of the sources (Bundler::GemNotFound)
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/definition.rb:234:in `specs_for'
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/runtime.rb:18:in `setup'
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler.rb:149:in `setup'
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/setup.rb:20:in `block in '
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/ui/shell.rb:136:in `with_level'
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/ui/shell.rb:88:in `silence'
from /usr/local/bundle/gems/bundler-2.2.27/lib/bundler/setup.rb:20:in `'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/commands.rb:33:in `'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/commands.rb:4:in `'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/server.rb:9:in `'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client/server.rb:9:in `call'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client/command.rb:7:in `call'
from /usr/local/bundle/gems/spring-3.0.0/lib/spring/client.rb:30:in `run'
from /usr/local/bundle/gems/spring-3.0.0/bin/spring:49:in `'
Update: Whenever sets up the crontab using the file /config/schedule.rb relevant section
every 1.hour do command 'cd /home/hydra && bin/rails r import/cron_import.rb folklife' end
We are running this inside docker the dockerfile
FROM ruby:2.6.8
# Install our dependencies and rails
RUN \
gem install bundler \
&& gem install rails \
&& mkdir -p /home/hydra
# update and install dependencies
RUN apt-get update && apt-get -y install cron
# Node.js
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs
WORKDIR /home/hydra
ADD ./hydra /home/hydra
RUN bundle install
ADD ./startup.sh /usr/bin/
RUN chmod -v +x /usr/bin/startup.sh
ENTRYPOINT ["/usr/bin/startup.sh"]
startup.sh
#!/bin/bash
# set terminal
export TERM=vt100
# start cron and update whenever
service cron start
bundle exec whenever
whenever --update-crontab
# remove PID and start the server
file="/home/hydra/tmp/pids/server.pid"
if [ -f $file ] ; then
rm $file
fi
bin/rails s -p 3000 -b '0.0.0.0'
output from crontab -l (relevant sections)
# Begin Whenever generated tasks for:
/home/hydra/config/schedule.rb at: 2021-09-21 18:38:41 +0000
PATH=\
GEM_HOME=/usr/local/bundle
BUNDLE_APP_CONFIG=/usr/local/bundle
RUBY_MAJOR=2.6
RUBYGEMS_VERSION=""
BUNDLE_BIN=""
BUNDLE_PATH=""
RUBY_VERSION=2.6.8
BUNDLER_VERSION=2.2.27
{section omitted}
* * * * * /bin/bash -l -c 'cd /home/hydra && bin/rails r import/cron_import.rb folklife >> /home/hydra/log/cron.log 2>> /home/hydra/log/cron_error.log'
# End Whenever generated tasks for: /home/hydra/config/schedule.rb at: 2021-08-20 20:22:02 +0000
Gemfile
source 'https://rubygems.org'
# Rails Dependencies
# =====================================================
gem 'rails', '~> 5.2.6'
gem 'bundler'
gem 'rake', '~> 12.3'
gem 'puma', '~> 4.3'
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.5'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bootsnap', '>= 1.1.0', require: false
# OAI-PMH
# =====================================================
gem 'blacklight_oai_provider'
# Automatic Import
# =====================================================
gem 'whenever', require: false
# Hydra Dependencies
# =====================================================
gem 'active-fedora'
gem 'active-triples'
gem 'blacklight'
gem 'hydra-head'
gem 'ldp'
gem 'nokogiri'
gem 'solrizer'
gem 'rsolr'
gem 'devise'
gem 'devise-guests', '~> 0.5'
gem 'rdf', '<= 3.1.13'
# Capistrano
# =====================================================
# gem 'capistrano-rails'
# DEVELOPMENT AND TESTS ONLY
# =====================================================
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'jettywrapper'
gem 'listen'
gem 'fcrepo_wrapper', '~> 0.4'
gem 'solr_wrapper', '~> 2.0'
end
group :test do
gem 'factory_bot_rails'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
ANSWER
Answered 2021-Sep-23 at 15:08The issue was related to environment variables and not being able to find the correct path for the gems. I found a solution and updated the schedule.rb file.
ENV.each { |k, v| env(k, v) }
# set logs and environment
set :output, {:standard => "#{path}/log/cron.log", :error => "#{path}/log/cron_error.log"}
set :environment, ENV['RAILS_ENV']
every 1.minutes do
command "cd #{path} && bin/rails r import/cron_import.rb folklife"
end
QUESTION
I’m using Rails 4.2.10. I have the following version of spec …
$ bin/rspec --version
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
3.4.4
In my Gemfile, I have
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
…
rspec-rails (3.4.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
How do I upgrade spec to a specific version (I want 3.10.0). I tried changing my Gemfile.lock version to look like
rspec (3.10.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
And then re-ran “bundle install”, but I still show “3.4.4” when I check the version of bin/rspec.
Edit: In response to answer given in comment ...
Tried changing my Gemfile “spec-rails” dependency to
gem 'rspec-rails', '~> 3.9.1'
And then running the below but I guess there are a series of dependencies that result in things like the below
$ bundle install
…
deprecated
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies........
Bundler could not find compatible versions for gem "rspec-support":
In snapshot (Gemfile.lock):
rspec-support (= 3.4.1)
In Gemfile:
guard-rspec was resolved to 4.6.4, which depends on
rspec (>= 2.99.0, < 4.0) was resolved to 3.10.0, which depends on
rspec-mocks (~> 3.4.0) was resolved to 3.4.1, which depends on
rspec-support (~> 3.4.0)
rspec-rails (~> 3.9.1) was resolved to 3.9.1, which depends on
rspec-support (~> 3.9.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Not quite sure how to proceed with the upgrade.
ANSWER
Answered 2021-Sep-13 at 20:16Upgrade all gems that are mentioned and might collide with their required RSpec-version. The output tells you, that guard-rspec collides with a newer RSpec-version. Try with:
bundle update rspec rspec-rails guard-rspec
If then there is another error with new Gems, try adding those to the command, too. Transitive dependencies, that are not listed in your Gemfile are generally not required to list (rspec-mocks etc.).
Summary: Try upgrading all related offending Gems at once.
Also, as Les said, you are not supposed to update Gemfile.lock manually (except in case of Merge Conflicts), but only through bundle update [GEMNAME]
.
Deleting Gemfile.lock is a last resort, as you will lose your current, maybe well-functioning, dependency situation and upgrade all Gems at once to their newest version, as specified in the Gemfile.
QUESTION
I am trying to setup our Rails project to use rspec. But I am getting 'No examples found' when I run rspec. How can I get rspec to run the example(s)?
I am just using the command rspec
with any options or settings.
Rails: 6.0.3.4 Ruby: 2.7.2
My spec file is in the spec/requests
folder and has the following content
require 'rails_helper'
RSpec.describe "Posts", type: :request do
describe "GET /index unauthenticated" do
it "returns http 403" do
get "/posts"
expect(response).to have_http_status(403)
end
end
end
My 'spec_helper.rb' is
require File.expand_path("../../config/environment", __FILE__)
require 'byebug'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
# inherited by the metadata hash of host groups and examples, rather than
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = "doc"
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
Dir["./spec/support/**/*.rb"].each {|f| require f}
My 'rails_helper.rb' file is
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../config/environment', __dir__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
require 'database_cleaner/active_record'
require 'capybara/rspec'
require "shoulda/matchers"
Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f }
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
# Checks for pending migrations and applies them before tests are run.
# If you are not using ActiveRecord, you can remove these lines.
begin
ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
puts e.to_s.strip
exit 1
end
RSpec.configure do |config|
config.include FactoryBot::Syntax::Methods
config.include Devise::Test::ControllerHelpers, type: :controller
config.fixture_path = "#{::Rails.root}/spec/fixtures"
config.use_transactional_fixtures = false
config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace!
config.include Devise::Test::ControllerHelpers, type: :controller
config.extend ControllerMacros, type: :controller
config.include RequestSpecHelper, type: :request
config.include FactoryBot::Syntax::Methods
end
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :active_record
with.library :active_model
with.library :action_controller
with.library :rails
end
end
RSpec.configure do |config|
config.before(:each) do
DatabaseCleaner.strategy = :transaction
DatabaseCleaner.clean_with(:truncation)
end
config.around(:each) do |example|
DatabaseCleaner.cleaning do
example.run
end
end
end
And my '.rspec' file is
--require spec_helper
I've pushed the complete project code to https://github.com/marksack/rspec-test
EDIT: I did some debugging by stepping through the rspec core code. At some points in the code, I can that it has found the spec files. But it seems to break for some reason when it gets to the point of loading them - perhaps in the load_file_handling_errors
method. The invocation of that method passes in the correct file and I don't see any exceptions though.
ANSWER
Answered 2021-Jun-01 at 22:16It seems that you have a cache configuration issue with stimulus_reflex
gem when you run the rspec
command:
Stimulus Reflex requires caching to be enabled. Caching allows the session to be modified during ActionCable requests. To enable caching in development, run: rails dev:cache
If you know what you are doing and you want to start the application anyway, you can create a StimulusReflex initializer with the command:
bundle exec rails generate stimulus_reflex:config
Then open your initializer at
/config/initializers/stimulus_reflex.rb
and then add the following directive:
StimulusReflex.configure do |config| config.on_failed_sanity_checks = :warn end
No examples found.
Try replacing this part of config/environments/test.rb:
config.action_controller.perform_caching = false
config.cache_store = :null_store
with:
config.action_controller.perform_caching = true
config.cache_store = :memory_store
Then it should work as expected
QUESTION
Im running ruby version 2.6.1 with docker. Rake gem is version 13.0.1.
Whenever I tried docker-compose up, it always fails and throws this error everytime:
This error did not exist before.
redis_1 | WARNING: no logs are available with the 'none' log driver
db_1 | WARNING: no logs are available with the 'none' log driver
web_1 | bundler: failed to load command: rails (/bundle/bin/rails)
web_1 | Bundler::GemNotFound: Could not find rake-13.0.1 in any of the sources
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:91:in `block in materialize'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:85:in `map!'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/spec_set.rb:85:in `materialize'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:170:in `specs'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:237:in `specs_for'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/definition.rb:226:in `requested_specs'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:108:in `block in definition_method'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/runtime.rb:20:in `setup'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler.rb:107:in `setup'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/bundler/setup.rb:20:in `'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
web_1 | /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
Here is my Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '~> 2.6.1'
gem 'rails', '~> 5.2.2'
gem 'mysql2'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'webpacker'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'rake'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'active_hash'
gem 'active_hash-like'
gem 'devise'
gem 'devise-i18n'
gem 'devise_invitable' # deviseに招待機能を追加
gem 'simple_form'
gem 'kaminari'
gem 'paperclip'
gem 'ransack'
gem 'active_link_to'
gem 'gretel'
gem 'whenever'
gem 'meta-tags'
gem 'kakurenbo-puti'
gem 'jpmobile'
# gem 'geokit' # 測地系
gem 'slim-rails'
gem 'sitemap_generator'
# gem 'font-awesome-rails'#railsでfont-awesome仕様
gem 'exception_notification'
gem 'slack-notifier'
gem 'easy_settings'
gem 'enum_help'
gem 'i18n_generators'
gem 'inline_svg'
# gem 'select2-rails'
gem 'draper'
# gem 'cancancan'#権限管理(パックラインユーザーなど)
# gem 'cocoon' # nested form
# gem 'wicked_pdf'#キャプチャ用gem3
# gem 'wkhtmltopdf-binary'#キャプチャ用gem2
# AWS S3など用
# gem 'aws-sdk', '~> 3'
gem 'aws-sdk-s3', '~> 1'
gem 'aws-ses', '~> 0.6'
# 並列処理用
gem 'parallel'
gem 'ruby-progressbar'
# gem 'rambulance' # このGemのBugが多いので、廃止
gem 'premailer-rails'
gem 'maxminddb'
gem 'counter_culture', '~> 2.0'
gem 'recaptcha'
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
group :development do
gem 'letter_opener' # dev mail
gem 'letter_opener_web' # http://localhost:8001/letter_opener
gem 'rubocop', require: false
gem 'rubocop-airbnb'
end
group :development do
gem 'foreman'
end
group :development, :test, :staging do
gem 'pry-rails'
gem 'pry-doc'
gem 'pry-byebug'
gem 'pry-stack_explorer'
end
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'dotenv-rails'
end
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0', group: :development
group :development, :staging do
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'webdrivers'
end
# TEST Tools
group :development, :test do
gem 'rspec'
gem 'rspec-rails'
gem 'factory_bot_rails'
gem 'faker'
gem 'database_cleaner'
gem 'timecop'
gem 'spring-commands-rspec'
gem 'launchy'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Here is my lockfile:
GIT
remote: https://github.com/mimemagicrb/mimemagic.git
revision: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
ref: 01f92d86d15d85cfd0f20dabd025dcbd36a8a60f
specs:
mimemagic (0.3.5)
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.4.3)
actionpack (= 5.2.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.3)
actionview (= 5.2.4.3)
activesupport (= 5.2.4.3)
rack (~> 2.0, >= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.4.3)
activesupport (= 5.2.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_hash (3.1.0)
activesupport (>= 5.0.0)
active_hash-like (0.1.0)
active_hash
active_link_to (1.0.5)
actionpack
addressable
activejob (5.2.4.3)
activesupport (= 5.2.4.3)
globalid (>= 0.3.6)
activemodel (5.2.4.3)
activesupport (= 5.2.4.3)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.2.4.3)
activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3)
arel (>= 9.0)
activestorage (5.2.4.3)
actionpack (= 5.2.4.3)
activerecord (= 5.2.4.3)
marcel (~> 0.3.1)
activesupport (5.2.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
after_commit_action (1.1.0)
activerecord (>= 3.0.0)
activesupport (>= 3.0.0)
arel (9.0.0)
ast (2.4.1)
aws-eventstream (1.1.0)
aws-partitions (1.360.0)
aws-sdk-core (3.105.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.37.0)
aws-sdk-core (~> 3, >= 3.99.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.79.1)
aws-sdk-core (~> 3, >= 3.104.3)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-ses (0.6.0)
builder
mail (> 2.2.5)
mime-types
xml-simple
aws-sigv4 (1.2.2)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.15)
bindex (0.8.1)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.4.8)
msgpack (~> 1.0)
builder (3.2.4)
byebug (11.1.3)
capybara (3.33.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
childprocess (3.0.0)
chronic (0.10.2)
climate_control (0.2.0)
coderay (1.1.3)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.7)
counter_culture (2.6.0)
activerecord (>= 4.2)
activesupport (>= 4.2)
after_commit_action (~> 1.0)
crass (1.0.6)
css_parser (1.7.1)
addressable
database_cleaner (1.8.5)
debug_inspector (0.0.3)
devise (4.7.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.9.2)
devise (>= 4.7.1)
devise_invitable (2.0.2)
actionmailer (>= 5.0)
devise (>= 4.6)
diff-lcs (1.4.4)
dotenv (2.7.6)
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
draper (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
activemodel-serializers-xml (>= 1.0)
activesupport (>= 5.0)
request_store (>= 1.0)
easy_settings (0.1.2)
hashie (~> 3.4.3)
enum_help (0.0.17)
activesupport (>= 3.0.0)
erubi (1.9.0)
exception_notification (4.4.3)
actionmailer (>= 4.0, < 7)
activesupport (>= 4.0, < 7)
execjs (2.7.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.1.0)
factory_bot (~> 6.1.0)
railties (>= 5.0.0)
faker (2.13.0)
i18n (>= 1.6, < 2)
ffi (1.13.1)
ffi (1.13.1-x86-mingw32)
foreman (0.87.2)
globalid (0.4.2)
activesupport (>= 4.2.0)
gretel (4.0.2)
rails (>= 5.1)
hashie (3.4.6)
htmlentities (4.3.4)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
i18n_generators (2.2.2)
activerecord (>= 3.0.0)
railties (>= 3.0.0)
inline_svg (1.7.1)
activesupport (>= 3.0)
nokogiri (>= 1.6)
jaro_winkler (1.5.4)
jbuilder (2.10.0)
activesupport (>= 5.0.0)
jmespath (1.4.0)
jpmobile (6.0.0)
mail (~> 2.7.0)
json (2.3.1)
kakurenbo-puti (0.5.0)
activerecord (>= 4.1.0)
kaminari (1.2.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.2.1)
kaminari-activerecord (= 1.2.1)
kaminari-core (= 1.2.1)
kaminari-actionview (1.2.1)
actionview
kaminari-core (= 1.2.1)
kaminari-activerecord (1.2.1)
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
launchy (2.5.0)
addressable (~> 2.7)
letter_opener (1.7.0)
launchy (~> 2.2)
letter_opener_web (1.4.0)
actionmailer (>= 3.2)
letter_opener (~> 1.0)
railties (>= 3.2)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.7.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
maxminddb (0.1.22)
meta-tags (2.13.0)
actionpack (>= 3.2.0, < 6.1)
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0512)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
msgpack (1.3.3)
msgpack (1.3.3-x86-mingw32)
mysql2 (0.5.3)
mysql2 (0.5.3-x86-mingw32)
nio4r (2.5.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.10.10-x86-mingw32)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
paperclip (6.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
mime-types
mimemagic (~> 0.3.0)
terrapin (~> 0.6.0)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
polyamorous (2.3.2)
activerecord (>= 5.2.1)
premailer (1.13.1)
addressable
css_parser (>= 1.6.0)
htmlentities (>= 4.0.0)
premailer-rails (1.11.1)
actionmailer (>= 3)
premailer (~> 1.7, >= 1.7.9)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pry-doc (1.1.0)
pry (~> 0.11)
yard (~> 0.9.11)
pry-rails (0.3.9)
pry (>= 0.10.4)
pry-stack_explorer (0.5.1)
binding_of_caller (~> 0.7)
pry (~> 0.13)
public_suffix (4.0.5)
puma (3.12.6)
rack (2.2.3)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.3)
actioncable (= 5.2.4.3)
actionmailer (= 5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
activemodel (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (= 5.2.4.3)
activesupport (= 5.2.4.3)
bundler (>= 1.3.0)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
railties (5.2.4.3)
actionpack (= 5.2.4.3)
activesupport (= 5.2.4.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
ransack (2.3.2)
activerecord (>= 5.2.1)
activesupport (>= 5.2.1)
i18n
polyamorous (= 2.3.2)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
recaptcha (5.5.0)
json
regexp_parser (1.7.1)
request_store (1.5.0)
rack (>= 1.4)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-rails (4.0.1)
actionpack (>= 4.2)
activesupport (>= 4.2)
railties (>= 4.2)
rspec-core (~> 3.9)
rspec-expectations (~> 3.9)
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rubocop (0.76.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-airbnb (3.0.2)
rubocop (~> 0.76.0)
rubocop-performance (~> 1.5.0)
rubocop-rails (~> 2.3.2)
rubocop-rspec (~> 1.30.0)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
rubocop-rails (2.3.2)
rack (>= 1.1)
rubocop (>= 0.72.0)
rubocop-rspec (1.30.1)
rubocop (>= 0.60.0)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
rubyzip (2.3.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.1.0)
railties (>= 5.2.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
semantic_range (2.3.0)
simple_form (5.0.2)
actionpack (>= 5.0)
activemodel (>= 5.0)
sitemap_generator (6.1.2)
builder (~> 3.0)
slack-notifier (2.3.2)
slim (4.1.0)
temple (>= 0.7.6, < 0.9)
tilt (>= 2.0.6, < 2.1)
slim-rails (3.2.0)
actionpack (>= 3.1)
railties (>= 3.1)
slim (>= 3.0, < 5.0)
spring (2.1.1)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
temple (0.8.2)
terrapin (0.6.0)
climate_control (>= 0.0.3, < 1.0)
thor (1.0.1)
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.9.1)
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.7)
thread_safe (~> 0.1)
tzinfo-data (1.2021.1)
tzinfo (>= 1.0.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.6.1)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webdrivers (4.4.1)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webpacker (5.2.1)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
whenever (1.0.0)
chronic (>= 0.6.3)
xml-simple (1.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.25)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
active_hash
active_hash-like
active_link_to
aws-sdk-s3 (~> 1)
aws-ses (~> 0.6)
bootsnap (>= 1.1.0)
byebug
capybara (>= 2.15)
coffee-rails (~> 4.2)
counter_culture (~> 2.0)
database_cleaner
devise
devise-i18n
devise_invitable
dotenv-rails
draper
easy_settings
enum_help
exception_notification
factory_bot_rails
faker
foreman
gretel
i18n_generators
inline_svg
jbuilder (~> 2.5)
jpmobile
kakurenbo-puti
kaminari
launchy
letter_opener
letter_opener_web
listen (>= 3.0.5, < 3.2)
maxminddb
meta-tags
mimemagic!
mysql2
paperclip
parallel
premailer-rails
pry-byebug
pry-doc
pry-rails
pry-stack_explorer
puma (~> 3.11)
rails (~> 5.2.2)
rake
ransack
recaptcha
rspec
rspec-rails
rubocop
rubocop-airbnb
ruby-progressbar
sass-rails (~> 5.0)
selenium-webdriver
simple_form
sitemap_generator
slack-notifier
slim-rails
spring
spring-commands-rspec
spring-watcher-listen (~> 2.0.0)
timecop
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
webdrivers
webpacker
whenever
RUBY VERSION
ruby 2.6.1p33
BUNDLED WITH
1.17.3
I have tried removing my lockfile then running bundle install and docker-compose up but still won't work. I have tried almost all of the solutions I found online and they are the following:
- bundle --full-index
- gem install bundler
- bundle install --path vendor/cache
- bundle install --system
- gem install rake && bundle install
- gem update --system && bundle install
- bundle install --path vendor/bundle
- bundle update rake
- gem install rack command and run bundle update rake
- gem uninstall rake then gem install rake -v 13.0.1
- I even tried deleting my docker container then creating a new one.
But none of them works for me and its kind of frustrating.
It would be nice if someone can finally have a solution for this.
Thanks in advance.
UPDATE: Here is my docker-compose.yml
version: "3.7"
services:
db:
image: "mysql:5.7"
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_USERNAME: root
MYSQL_PASSWORD: root
- '3308:3306'
expose:
- '3306'
volumes:
- db:/var/run/mysqld
logging:
driver: none
ports:
- "3307:3306"
redis:
image: redis:4.0-alpine
command: redis-server
volumes:
- redis:/data
ports:
- 6379
logging:
driver: none
web:
build:
context: ../
dockerfile: Dockerfile
command: bundle exec rails s -p 3000 -e development -b '0.0.0.0'
environment:
DB_USERNAME: root
DB_PASSWORD: root
DB_NAME: rs_db_dev
DB_PORT: 3306
DB_HOST: db
RAILS_ENV: development
RAILS_MAX_THREADS: 5
REDIS_HOST: redis
REDIS_PORT: 6379
BUNDLE_PATH: /bundle
volumes:
- ../:/project
- bundle:/bundle
ports:
- "3002:3000"
depends_on:
- "db"
- "redis"
volumes:
db:
bundle:
redis:
ANSWER
Answered 2021-May-23 at 12:27I'm not really sure what happened and why but I tried doing this on my rails container and I was no longer receiving the said error.
docker-compose run --rm bash
cd to project directory
bundle install
QUESTION
I'm trying to revive an old Rails application I worked on several years ago. I'm using ruby 2.3.3 and rails 3.2.15 on the Heroku-16 stack with ClearDB for my MySQL database with the mysql2 adapter. When deploying to Heroku it succeeds on the deploy but crashes when it tries to start the app.
Full stack trace from the Heroku log (updated after fixing activerecord-import gem version per suggestion in first answer):
2021-02-09T04:42:26.851155+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2021-02-09T04:42:27.370829+00:00 app[web.1]: Exiting
2021-02-09T04:42:30.584256+00:00 app[web.1]: /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:17:in `': undefined method `version' for ActiveModel:Module (NoMethodError)
2021-02-09T04:42:30.584311+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:6:in `'
2021-02-09T04:42:30.584336+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:3:in `'
2021-02-09T04:42:30.584380+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:2:in `'
2021-02-09T04:42:30.584424+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/orm/active_record.rb:1:in `'
2021-02-09T04:42:30.584467+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584499+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.584532+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.584595+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.584621+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `block in load_orms'
2021-02-09T04:42:30.584647+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `each'
2021-02-09T04:42:30.584674+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness.rb:59:in `load_orms'
2021-02-09T04:42:30.584701+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:7:in `block (2 levels) in '
2021-02-09T04:42:30.584758+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
2021-02-09T04:42:30.584787+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
2021-02-09T04:42:30.584813+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:26:in `block in on_load'
2021-02-09T04:42:30.584843+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `each'
2021-02-09T04:42:30.584924+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/lazy_load_hooks.rb:25:in `on_load'
2021-02-09T04:42:30.584985+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/validates_timeliness-4.1.1/lib/validates_timeliness/railtie.rb:4:in `block in '
2021-02-09T04:42:30.585018+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `instance_exec'
2021-02-09T04:42:30.585058+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:30:in `run'
2021-02-09T04:42:30.585108+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:55:in `block in run_initializers'
2021-02-09T04:42:30.585158+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `each'
2021-02-09T04:42:30.585189+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/initializable.rb:54:in `run_initializers'
2021-02-09T04:42:30.585220+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/application.rb:136:in `initialize!'
2021-02-09T04:42:30.585255+00:00 app[web.1]: from /app/config/environment.rb:6:in `'
2021-02-09T04:42:30.585334+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585368+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `block in require'
2021-02-09T04:42:30.585401+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:236:in `load_dependency'
2021-02-09T04:42:30.585432+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/dependencies.rb:251:in `require'
2021-02-09T04:42:30.585511+00:00 app[web.1]: from /app/config.ru:3:in `block in '
2021-02-09T04:42:30.585548+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
2021-02-09T04:42:30.585579+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
2021-02-09T04:42:30.585659+00:00 app[web.1]: from /app/config.ru:in `new'
2021-02-09T04:42:30.585692+00:00 app[web.1]: from /app/config.ru:in `'
2021-02-09T04:42:30.585723+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
2021-02-09T04:42:30.585764+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
2021-02-09T04:42:30.585837+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
2021-02-09T04:42:30.585868+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:46:in `app'
2021-02-09T04:42:30.585900+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
2021-02-09T04:42:30.585930+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
2021-02-09T04:42:30.585977+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands/server.rb:70:in `start'
2021-02-09T04:42:30.586026+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:55:in `block in '
2021-02-09T04:42:30.586055+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `tap'
2021-02-09T04:42:30.586087+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.3.0/gems/railties-3.2.22.5/lib/rails/commands.rb:50:in `'
2021-02-09T04:42:30.586120+00:00 app[web.1]: from script/rails:6:in `require'
2021-02-09T04:42:30.588043+00:00 app[web.1]: from script/rails:6:in `'
2021-02-09T04:42:30.758954+00:00 heroku[web.1]: Process exited with status 1
2021-02-09T04:42:30.840167+00:00 heroku[web.1]: State changed from starting to crashed
Line 6 from environment.rb as referenced in the stack trace:
Rails.application.initialize!
Heroku Config Vars:
CLEARDB_DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
DATABASE_URL: mysql2://user:pw@us-cdbr-east-03.cleardb.com/db?reconnect=true
RACK_ENV: production
RAILS_ENV: production
LANG: en_US.UTF-8
From database.yml:
production:
url: <%= ENV['DATABASE_URL'] %>
adapter: mysql2
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
From Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.15)
actionpack (= 3.2.15)
mail (~> 2.5.4)
actionpack (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
activerecord (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activerecord-import (0.4.1)
activerecord (>= 3.0)
activeresource (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.4)
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
arel (3.0.2)
atomic (1.1.14)
attr_encrypted (1.2.1)
encryptor (>= 1.1.1)
audited (3.0.0)
audited-activerecord (3.0.0)
activerecord (~> 3.0)
audited (= 3.0.0)
axlsx (2.0.1)
htmlentities (~> 4.3.1)
nokogiri (>= 1.4.1)
rubyzip (~> 1.0.0)
axlsx_rails (0.3.0)
axlsx (>= 2.0.1)
rails (>= 3.1)
bcrypt-ruby (3.1.2)
bcrypt-ruby (3.1.2-x86-mingw32)
better_errors (0.8.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.0.4)
bumbler (0.3.1)
byebug (5.0.0)
columnize (= 0.9.0)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
capistrano-log_with_awesome (0.0.2)
capistrano (>= 2.5.14)
capistrano-sidekiq (0.5.3)
capistrano
sidekiq
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
celluloid (0.16.0)
timers (~> 4.0.0)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (0.0.7)
nokogiri
chronic (0.10.2)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.3)
climate_control (>= 0.0.3, < 1.0)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
columnize (0.9.0)
connection_pool (2.2.0)
crack (0.4.2)
safe_yaml (~> 1.0.0)
curb (0.9.7)
d3-rails (3.5.5)
railties (>= 3.1)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (3.1.1)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
devise_security_extension (0.7.2)
devise (>= 2.0.0)
rails (>= 3.1.1)
diff-lcs (1.2.5)
encryptor (1.1.3)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
faker (1.1.2)
i18n (~> 0.5)
ffi (1.9.10)
ffi (1.9.10-x86-mingw32)
font-awesome-rails (4.3.0.0)
railties (>= 3.2, < 5.0)
gpgme (2.0.2)
gyoku (1.1.0)
builder (>= 2.1.2)
handlebars_assets (0.20.2)
execjs (~> 2.0)
multi_json (~> 1.0)
sprockets (>= 2.0.0, < 4.0)
tilt (~> 1.2)
hashie (3.4.1)
highline (1.6.20)
hike (1.2.3)
hitimes (1.2.2)
hitimes (1.2.2-x86-mingw32)
htmlentities (4.3.4)
httpi (2.1.0)
rack
rubyntlm (~> 0.3.2)
i18n (0.7.0)
imgkit (1.6.1)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
launchy (2.4.3)
addressable (~> 2.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_request (0.2.3)
rack-contrib
railties
mime-types (1.25)
multi_json (1.11.2)
mysql2 (0.3.17)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
newrelic_rpm (3.13.0.299)
nguyen (1.0.1)
nokogiri (~> 1.5.6)
nokogiri (1.5.10)
nokogiri (1.5.10-x86-mingw32)
nori (2.3.0)
orm_adapter (0.4.0)
paperclip (3.5.2)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
mime-types
polyglot (0.3.3)
rack (1.4.7)
rack-cache (1.2)
rack (>= 0.4)
rack-contrib (1.1.0)
rack (>= 0.9.1)
rack-protection (1.5.3)
rack
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.15)
actionmailer (= 3.2.15)
actionpack (= 3.2.15)
activerecord (= 3.2.15)
activeresource (= 3.2.15)
activesupport (= 3.2.15)
bundler (~> 1.0)
railties (= 3.2.15)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (3.2.15)
actionpack (= 3.2.15)
activesupport (= 3.2.15)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
redis (3.2.1)
redis-namespace (1.5.2)
redis (~> 3.0, >= 3.0.4)
rolify (3.2.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-ole (1.2.11.7)
rubyXL (3.1.0)
nokogiri (>= 1.4.4)
rubyzip (>= 1.0.0)
rubyntlm (0.3.4)
rubyzip (1.0.0)
rvm-capistrano (1.5.1)
capistrano (~> 2.15.4)
safe_yaml (1.0.4)
sass (3.2.12)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
savon (2.3.0)
akami (~> 1.2.0)
builder (>= 2.1.2)
gyoku (~> 1.1.0)
httpi (~> 2.1.0)
nokogiri (>= 1.4.0, < 1.6)
nori (~> 2.3.0)
wasabi (~> 3.2.0)
selenium-webdriver (2.46.2)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
shoulda-matchers (2.2.0)
activesupport (>= 3.0.0)
sidekiq (3.4.2)
celluloid (~> 0.16.0)
connection_pool (~> 2.2, >= 2.2.0)
json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
redis-namespace (~> 1.5, >= 1.5.2)
sidekiq-failures (0.4.5)
sidekiq (>= 2.16.0)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
soda-ruby (0.2.13)
hashie
spreadsheet (0.9.4)
ruby-ole (>= 1.0)
spring (1.3.6)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (2.2.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
teaspoon (1.0.2)
railties (>= 3.2.5, < 5)
teaspoon-mocha (2.2.4)
teaspoon (>= 1.0.0)
thor (0.19.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
timeliness (0.3.7)
timers (4.0.1)
hitimes
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
uglifier (2.2.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
validates_timeliness (3.0.14)
timeliness (~> 0.3.6)
vcr (2.9.3)
warden (1.2.3)
rack (>= 1.0)
wasabi (3.2.0)
httpi (~> 2.0)
nokogiri (>= 1.4.0, < 1.6)
wash_out (0.8.4)
nori (>= 2.0.0)
webmock (1.17.4)
addressable (>= 2.2.7)
crack (>= 0.3.2)
websocket (1.2.2)
whenever (0.8.4)
activesupport (>= 2.3.4)
chronic (>= 0.6.3)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
activerecord-import (= 0.4.1)
addressable
attr_encrypted
audited-activerecord (~> 3.0)
axlsx_rails (= 0.3.0)
better_errors
binding_of_caller
bumbler
bundler
byebug
capistrano
capistrano-ext
capistrano-sidekiq
capistrano-slack!
capybara
chromedriver-helper
coffee-rails (~> 3.2.1)
curb (= 0.9.7)
d3-rails
database_cleaner
devise
devise_security_extension
factory_girl_rails
faker
font-awesome-rails
gpgme
handlebars_assets
imgkit
jquery-rails
kaminari
launchy
meta_request (= 0.2.3)
mysql2 (= 0.3.17)
newrelic_rpm
nguyen
paperclip
rails (~> 3.2.14)
rails_12factor
rolify
rspec-expectations
rspec-rails
rubyXL
rvm-capistrano
sass-rails (~> 3.2.3)
savon
selenium-webdriver
shoulda-matchers
sidekiq
sidekiq-failures
sinatra
soda-ruby
spreadsheet
spring
spring-commands-rspec
teaspoon-mocha
uglifier (>= 1.0.3)
validates_timeliness
vcr
wash_out
webmock
whenever
wkhtmltoimage-binary!
RUBY VERSION
ruby 2.3.3p222
BUNDLED WITH
1.17.3
I've been beating my head against this all day, reading every Stack Overflow and support article I could find and haven't figured out where my configuration is wrong.
ANSWER
Answered 2021-Feb-09 at 01:07Looks like you're running into compatibility issues trying to use the latest version of the activerecord-import gem at the time of writing (released in October 2020) with activerecord 3.2.22.5 (released in September 2016). You do mention it's a rails 3.2.15 app but you're not using activerecord 3.2.15 which is confusing.
Try using activerecord-import 0.4.1 (released in July 2013) and activerecord 3.2.15 which should be compatible with rails 3.2.15.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rspec-mocks
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page