I am getting errors when I run: rake cucumber:ok
Can you please tell me how to fix the following error?
Gem versions I am using:
rails Rails 3.0.8.rc4
rspec 2.6.3
cucumber 0.10.3
Errors when I run: rake cucumber:ok
[ticketee (master)]$ rake cucumber:ok
/Users/duser/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S bundle exec cucumber --profile default
Using the default profile...
features/creating_projects.feature: Lexing error on line 12: '%%_FEATURE_END_%%'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information. (Gherkin::Lexer::LexingError)
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/gherkin-2.3.10/lib/gherkin/lexer/i18n_lexer.rb:23:in `scan'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/gherkin-2.3.10/lib/gherkin/lexer/i18n_lexer.rb:23:in `scan'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/gherkin-2.3.10/lib/gherkin/parser/parser.rb:31:in `parse'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/feature_file.rb:37:in `parse'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime/features_loader.rb:28:in `block in load'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime/features_loader.rb:26:in `each'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime/features_loader.rb:26:in `load'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime/features_loader.rb:14:in `features'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime.rb:132:in `features'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/runtime.rb:45:in `run!'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/lib/cucumber/cli/main.rb:20:in `execute'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/gems/cucumber-0.10.3/bin/cucumber:14:in `<top (required)>'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/bin/cucumber:19:in `load'
/Users/duser/.rvm/gems/ruby-1.9.2-p180/bin/cucumber:19:in `<main>'
rake aborted!
Command failed with status (1): [/Users/duser/.rvm/rubies/ruby-1.9.2-p18...]
Tasks: TOP => cucumber:ok
(See full trace by running task with --trace)
[ticketee (master)]$
Contents of features/creating_projects.feature
Feature: Creating projects
In order to have projects to assign tickets to
As a user I want to create them easily
Scenarios: Creating a project
Given I am on the homepage
When I follow "New Project"
And I fill in "Name" with "Text Mate 2"
And I press "Create Project"
Then I should see "Project has been created"
I figured out the problem:
In the features/creating_projects.feature file, I had "Scenarios:", and it should be "Scenario:". This is the reason for the errors.
You have a lexing error on line 12 of features/creating_projects.feature and its most likely at the end of the feature definition. Are you using the correct syntax in the file?
Related
Please help.
I wanted to set up in Redmine 4.1.1 an email read.
This is my code that I am executing in CLI:
bundle exec rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=user#domain.com password=PASSWORD ssl=1 project=mars-test-do-not-delete folder=main move_on_success=completed move_on_failure=failed no_permission_check=1 unknown_user=accept no_account_notice=1 --trace
But I am getting this output when I execute the code:
** Invoke redmine:email:receive_imap (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:email:receive_imap
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:630:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/home/seven/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
Tasks: TOP => redmine:email:receive_imap
This is only half of the output.
Any ideas? Suggestions? Anything :)
The SMTP works without any problems. I am using an Exchange MS server for email.
Thank you.
As an update:
I set up a new server ubuntu 20.04 LTS
Installed redmine 4.0.6
Ruby 2.5.0
rake 13.0.1
Now when I run:
rake -f Rakefile --silent redmine:email:receive_imap RAILS_ENV="production" host=outlook.office365.com port=993 username=EMAIL_USER password=PASSWORD ssl=true project=mars-test-do-not-delete folder=main move_on_success=processed move_on_failure=failed no_permission_check=1 unknown_user=accept 1 > /dev/null
I get this:
Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
rake aborted!
NameError: uninitialized constant Redmine::IMAP
/home/seven/redmine/lib/tasks/email.rake:121:in `block (4 levels) in <top (required)>'
/home/seven/redmine/app/models/mailer.rb:612:in `with_synched_deliveries'
/home/seven/redmine/lib/tasks/email.rake:120:in `block (3 levels) in <top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `eval'
/home/seven/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => redmine:email:receive_imap
(See full trace by running task with --trace)
I didi check the redmine_crm, to mu surprise in the Gemfile I have only one reference to it, so I do not fully understand why I get this error to;/
I found the problem.
In file:
/ROOT_PATH_TO_REDMINE/lib/tasks/email.rake
I needed to add one line on the top of the file:
require 'redmine/imap.rb'
That solved the problem.
I've recently joined a team on a Ruby-on-Rails application, and I try to audit the tests. There were no tests, so I decided to implement them in the app.
After seeing around what was there, I have seen there were no command to run the tests available. I ran the following command:
rails --tasks
In the output, there is no command such as rails test, rails test:system. Surprisingly, I can run the command rails test with success. But the command rails test:system --trace fails with following output:
rails aborted!
Don't know how to build task 'test:system' (see --tasks)
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/task_manager.rb:59:in `[]'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:159:in `invoke_task'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `each'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:116:in `block in top_level'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:125:in `run_with_threads'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:110:in `top_level'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/rake-12.3.1/lib/rake/application.rb:186:in `standard_exception_handling'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/command.rb:48:in `invoke'
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.2.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
I have tried running the command in a freshly created app, and I can see the available commands rails test and rails test:system.
rails --tasks
Any idea why the command rails test:system fails? Thanks.
Ruby version: 2.3.3
Rails version: 5.2.0
EDIT:
I'm using MiniTest
To run all specs in a single go:
rspec
To execute a specific test file:
rspec <path to the file> # rspec spec/controllers/mytest_spec.rb
Use --format documentation for a formatted output.
Prepend bundle exec if rspec throws a dependency error.
I'm on Example 46 of Learn Ruby The Hard Way - Creating a Project Skeleton
Link: http://learnrubythehardway.org/book/ex46.html
So I created all the directories which show up as the following:
skeleton/
NAME.gemspec
Rakefile
data
ext/
tests/
bin/
NAME
doc/
lib/
NAME
NAME.rb
lib/NAME
tests/
test_NAME.rb
I'm in the Skeleton directory in Powershell.
When I run rake test as the tutorial says to I get an error.
Here's the result from Powershell:
PS C:\ruby\learn\projects\skeleton> rake test
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -I"lib;tests" -I"C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4
.2/lib" "C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "tests/test_NAME
.rb"
Warning: you should require 'minitest/autorun' instead.
Warning: or add 'gem "minitest"' before 'require "minitest/autorun"'
From:
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit.rb:1:in `<top (required)>'
C:/ruby/learn/projects/skeleton/tests/test_NAME.rb:2:in `<top (required)>'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:15:in `block in <main>'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `select'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `<main>'
MiniTest::Unit::TestCase is now Minitest::Test. From C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit/testcase.rb:8:
in `<module:Unit>'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit.rb:676:in `<class:Runner>': undefined method `_run_suite' for class
`Test::Unit::Runner' (NameError)
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit.rb:261:in `<module:Unit>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit.rb:15:in `<module:Test>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/test/unit.rb:7:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/ruby/learn/projects/skeleton/tests/test_NAME.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:15:in `block
in <main>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `select'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [ruby -I"lib;tests" -I"C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/
lib" "C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/rake_test_loader.rb" "tests/test_NAME.rb
" ]
Tasks: TOP => test
(See full trace by running task with --trace)
The book says I should get the following response:
Loaded suite tests/test_NAME
Started
.
Finished in 0.000226 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
But instead I get an error. I've search for fixes and using gem install minitest but keep in mind I don't have a gemfile and I don't know if I should for this type of project. If I needed one I assume the tutorial would say so. So what do I do to fix this issue?
You don't need a Gemfile. While you are at skeleton directory, just do:
gem install 'test-unit'
and then from the same directory:
rake test
All tests will pass.
P.S. I just reproduced the whole thing locally following your tutorial and got the error message as yours. Then, I installed the test-unit gem and after that the rake test is working without any error.
I started getting this error and would like a way to fix it:
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
I am running this from within RubyMine. I can see in my Gemfile.lock where it specifies 10.1.0. Can I just manually update my Gemfile.lock to 10.1.1?
If I do:
$gem list
....
rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2)
So I'm not sure why it isn't just working with 10.1.0?
Here's the full output from RubyMine:
/Users/jt/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jt/.rvm/gems/ruby-1.9.3-p448/bin/rake spec
Testing started at 3:15 PM ...
rake aborted!
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
/Users/jt/repos/app/config/boot.rb:6:in `<top (required)>'
/Users/jt/repos/app/config/application.rb:1:in `<top (required)>'
/Users/jt/repos/app/Rakefile:5:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
(See full trace by running task with --trace)
Process finished with exit code 1
You can remove your
Gemfile.lock file
and exec
bundle update
So I've wanted to install RVM for a while on OSX. I finally got it working after figuring out I had to download the latest XCode. I installed ruby 1.9.2 and used these commands to create a new gemset in rvm:
rvm gemset create rails235
rvm 1.9.2#rails235
gem install rails -v 2.3.5
Then I went into one of my old apps that used rails 2.3.5 and tried to run some rakes and any rake I run I seem to get this error:
rake aborted!
no such file to load -- initializer
Also, semi related, right now I'm trying to get rdoc setup. I've never used before and I'm typing in "rake doc::app" and I'm getting that same error.
The full rake with --trace is this:
$ rake doc::app
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'doc::app'
(See full trace by running task with --trace)
brenton-wejrowskis-macbook-pro-2:bizzark wejrowski$ rake doc::app --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'doc::app'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in `[]'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:111:in `invoke_task'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `load'
/Users/wejrowski/.rvm/gems/ruby-1.9.2-p180#global/bin/rake:19:in `<main>'
No idea what to do next!
Your rake doc::app error is most probably due to the fact that rake tasks only use a single colon (":") to separate namespaces and task names. Try running rake doc:app instead.