Ive followed the tutorial word by word, and I'm using the Cloud9 platform to follow along.
I'm supposed to run: $ rails test
I'm supposed to get: 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
I'm not sure if i'm running the wrong command since i'm using Cloud9, but when I run the program the pages work, meaning I shouldn't be getting any errors at all. It's almost as if the test's never run at all. Any ideas?
enter code he(static-pages) $ rails test
Running via Spring preloader in process 5822
Run options: --seed 31158
Running:
...
Finished in 0.554944s, 5.4060 runs/s, 5.4060 assertions/s.
/usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:9:in aggregated_results': wrong number of arguments (given 1, expected 0) (ArgumentError)
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:597:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-reporters-1.1.9/lib/minitest/minitest_reporter_plugin.rb:26:in each'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-reporters-1.1.9/lib/minitest/minitest_reporter_plugin.rb:26:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:687:in each'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:687:inreport'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:141:in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/railties-5.0.1/lib/rails/test_unit/minitest_plugin.rb:73:inrun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/minitest-5.10.2/lib/minitest.rb:63:in block in autorun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:infork'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:161:in serve'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:131:inblock in run'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:in loop'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application.rb:125:inrun'
from /usr/local/rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in <top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require'
from -e:1:in're
Ugg just found out this question was already answered elsewhere.
Apparently there is a bug in the Minitest Gem file.
I added the code below to the test/test_helper.rb file to resolve it. However, i'm pretty sure there are other ways to resolve it as well.
Minitest::Reporters.use!
Related
I've got a Redmine 3.4.4 installation running, which uses Ruby 2.2.5-p319 and Rails 4.2.8. We want to upgrade this to Redmine latest (currently 4.0.4) which requires Rails 5.
I'm running the new server using 4.0.4 using Ruby 2.6.3-p62 and Rails 5.2.3. Overall it's OK, but we have a number of plugins installed we would like to migrate. Many of these have had problems because of deprecations in Rails 5. I've managed to muddle my way through 8 of 9 plugins, even though I've not written Ruby on Rails before, but I'm stuck on the last one and just can't figure it out.
The plugin is the My Page Customization plugin and when I attempt to migrate the database and plugins I get this error:
[centos#redmine]$ bundle exec rake db:migrate RAILS_ENV=production
rake aborted!
NoMethodError: undefined method `alias_method_chain' for ActivitiesController:Class
Did you mean? alias_method
/usr/local/src/redmine-4.0.4/plugins/redmine_my_page/lib/my_page_patches/activities_controller_patch.rb:11:in `block in included'
/usr/local/src/redmine-4.0.4/plugins/redmine_my_page/lib/my_page_patches/activities_controller_patch.rb:7:in `class_eval'
/usr/local/src/redmine-4.0.4/plugins/redmine_my_page/lib/my_page_patches/activities_controller_patch.rb:7:in `included'
/usr/local/src/redmine-4.0.4/plugins/redmine_my_page/init.rb:30:in `include'
/usr/local/src/redmine-4.0.4/plugins/redmine_my_page/init.rb:30:in `block (2 levels) in <top (required)>'
So, it's clear that the deprecated 'alias_method_chain' is the issue here. After some digging I found a lot of references online such as this one which is good and clear, but I just can't get code written that works - I keep getting syntax errors and can't figure out what I'm doing wrong.
This is the original snippet from activities_controller_patch.rb:
module ActivitiesControllerPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
helper :issues
helper :queries
alias_method_chain :index, :esi
end
end
We'd like to hang onto this plugin if we can even though it doesn't officially support Redmine 4. I'm hoping someone with better Ruby knowledge will be able to help.
Instead of
alias_method_chain :index, :esi
you'll just use
alias_method :index_without_esi, :index
alias_method :index, :index_with_esi
It was some kind of syntactic sugar.
I am trying to do a bundle install, but I'm getting the following error:
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate': buffer error (Zlib::BufError)
from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate'
from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:536:in `inflate'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:93:in `fetch_spec'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:46:in `_remote_specification'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:51:in `method_missing'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:95:in `block (2 levels) in unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `map'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `block in unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `map'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `unmet_dependency_names'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:240:in `remote_specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/bin/bundle:23:in `load'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#global/bin/bundle:23:in `<main>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#voylla/bin/ruby_noexec_wrapper:14:in `eval'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#voylla/bin/ruby_noexec_wrapper:14:in `<main>'
I tried the following:
gem update --sysytem
But still I'm getting the same error. Please can someone help!. Thanks
SOLUTION
Found out what is causing the problem. In the case we are are using geminabox and the for what ever reason the railties-4.1.6.gemspec.rz was corrupted. Don't know how it happened but it was. So what we did was removed the railties-4.1.6
rm shared/gems/proxy/quick/Marshal.4.8/railties-4.1.6.gemspec.rz
after that the system bundled like normal. If you are having the same problem you are going to have to find a way to watch the network calls and see which one of the GET events it is stopping on.
EXTRA READING does not fix bug only suppresses it in some cases
The reason this worked was because the new version used a different version of railties by happen chance. It only gave the impression that this fixed the problem.
Here is some extra info on this bug. But it doesn't total explain why this is happening.
cannot install ruby gems - zlib error
Now they have removed or fixed this code in the v2.0.0-p451 but the ruby-2.1.0 has yet to merge the patches I have yet to go back threw all the code and check each and every version but here is how you can check.
What you are looking for is this file. lib/rubygems/util.rb in there is a method called inflate this method is responsible for unzipping the gem file. However there is some sort of bug with it where it is being called on things that can't be unzipped.
This is a stable version and you wont find lib/rubygems/util.rb v2.0.0-p481. So this is difficult to find but by looking at the source code you can figure out which ones have this bug and which ones don't.
If you are using rvm use this commands to install the correct version
rvm install ruby-2.0.0-p481
To see all know ruby version avaliable you can run this command below.
$ rvm list known
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p547]
[ruby-]2.0.0-p451
[ruby-]2.0.0[-p481]
[ruby-]2.1.1
[ruby-]2.1[.2]
[ruby-]2.1-head
ruby-head
...
By changing to that patch version you will should be ok. I have also found this bug using ruby-2.0.0-p247 as well.
The above code would suggest that you have the bug as well. However it is strange because the github repo says that it was not introduced until Nov 18, 2013.
https://github.com/ruby/ruby/commit/a7fa4d5d9aab150ad4b0c3f3217fe444df69f527.
Anyway I know there is a lot of information here but this bug is tricky. It seams to only effect some version of ruby but because of organization of the code it is hard to tell some times if it is in your version. Best way is to just check to see if you have the util.rb file and if you do then change versions.
When running this script:
require 'oci8'
conn = OCI8.new('username', 'password', 'tnsname')
cursor = conn.exec('SELECT 1+1 FROM dual')
while r = cursor.fetch()
puts r.join(',')
end
cursor.close
conn.logoff
The following error message occurs:
C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `initi
alize': wrong number of arguments (2 for 0..1) (ArgumentError)
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `new'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:36:in `require'
from C:/tech/Ruby193/lib/ruby/gems/1.9.1/gems/ruby-oci8-2.1.5-x86-mingw3
2/lib/oci8.rb:81:in `<top (required)>'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:60:in `require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:60:in `rescue in require'
from C:/tech/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
:35:in `require'
from u:/Ruby/test_oci_connect.rb:1:in `<main>'
I can use those credentials in SQLPLUS and I have both the gems and devkit installed. Can anyone assist with this issue or provide some clarity regarding the answer below?
The issue is caused by a mismatch in the Oracle DLLs architecture and your Ruby installation, or your System not finding the right DLLs.
Download the Oracle Instant Client. Its important that its the same arch that your Ruby is in, as it contains the necessary DLLs.
Unzip it somewhere on your HDD, such as:
C:/OracleInstantClient Its also convenient to add both
/network/admin/sqlnet.ora
/network/admin/tnsnames.ora to that folder.
Add the Instant Client's location to your System PATH. You should now be able to connect without that error, provided you've added the correct connection information.
I was getting the same error message, using a gem dependent on ruby-oci8 (dm-oracle-adapter for datamapper).
Re-ran the install as per these instructions on a fresh environment :
Installing instant client for ruby-oci8
Double checked the path was set correctly and restarted my ruby console.
And everything worked perfectly.
On the machine it didn't work on (above incorrect arguments error), I have Oracle 64 bit dlls installed for some other services. My theory is that it was conflicting with these dlls (Ruby-oci8 needs 32bit DLLs), even though there was nothing pointing to these in the path.
Also, if you get the warning "ext/oci8 not found" when running 'gem install ruby-oci8', let me save you some time. In my case, this was a red herring and didn't affect the function of the gem at all.
That problem doesn't seem related to OCI8 at all.
You are misleading us a little here by not showing the whole code.
From your error stack trace, I can tell that you have a class that's trying to initialize but you have defined a parameter to that method and you didn't mention it when creating your object.
What this really means is that you mentioned 2 parameters where it was expecting either nothing or just one parameter.
if you create a test.rb fiel and paste the code you show us above all by itself, does it work?
I'm trying to use both of PaperClip and ActiveScaffold with help of as_paperclip_bridge in a rails3.0.5 project.
However, following initialization error is occurred when I launch the project.
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
C:/Users/ken/Documents/NetBeansProjects/fcheck/vendor/plugins/as_paperclip_bridge/init.rb:10: undefined method bridge' for ActiveScaffold:Module (NoMethodError)
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/plugin.rb:81
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:ininstance_exec'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in run'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in each'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:inrun_initializers'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in initialize!'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:insend'
from C:/Ruby187/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in method_missing'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config/environment.rb:7
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inrequire'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in new_constants_in'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:inload_dependency'
from C:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in require'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:3
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:ininstance_eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/builder.rb:46:in initialize'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1:innew'
from C:/Users/ken/Documents/NetBeansProjects/fcheck/config.ru:1
The code in as_paperclip_bridge\init.rb is attempting to call a module method 'ActiveScaffold.bridge' but it coun't be found.
Even though, same code is working without error in rails2.3.8 project.
We can see a big difference of rails initialization code between version 2 and 3.
On rails 2.3.8, plugins are loaded in 'load_plugins' method which is called after 'load_gems' method in initializer.rb. However, rails3 doesn't have initializer.rb and the loading process seems to be totally different.
I also have tried to remove AS gem and install both of AS plugin with as_paperclip_bridge plugin. But, the error haven't disappeared.
Could someone explain why the error is occurring?!
Anyway, I really hope to get any solution or workaround.
Thanks,
Kenichi
Self reply.
I had realized that as_paperclip_bridge was not required for latest ActiveScaffold implementation. (It's including the bridge)
Please make sure to install ImageMagick and RMagick gem to use PaperClip for image files. Or, you may also think 'as_paperclip_bridge should be there'
Thank you,
Kenichi
Hi guys the gem jquery-rails(0.2.7) cant seem to be installed on my machine saying there are too many connections and it times out, I know this is not actualy programming but it is a fundamental for any ROR programmer esp in rails 3, so i'm actually looking for any1 who might have came across this error and resolved it. The error is as follows.
/usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:365:in request': too many connection resets (http://production.cf.rubygems.org/gems/libxml-ruby-1.1.4.gem) (Gem::RemoteFetcher::FetchError)
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:289:inopen_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:298:in open_uri_or_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:172:infetch_path'
from /usr/local/lib/site_ruby/1.8/rubygems/remote_fetcher.rb:110:in download'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:253:indownload_gem_from_uri'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/source.rb:76:in fetch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:45:inrun'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in each'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:ineach'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/installer.rb:8:ininstall'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:insend'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:instart'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.0/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Thanks in advance
~D
This is a connection issue. Try running the command again will install the gem.