Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSasha East
702 Points`named_routes.helpers` is deprecated
when i run rspec spec/
i got lot errors
...DEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (3 levels) in <top (required)> at /home/swest/odot/spec/controllers/todo_lists_controller_spec.rb:156)
....DEPRECATION WARNING: named_routes.helpers
is deprecated, please use route_defined?(route_name)
to see if a named route was defined. (called from block (4 levels) in <top (required)> at /home/swest/odot/spec/controllers/todo_lists_controller_spec.rb:75)
................................
Pending: TodoListsHelper add some examples to (or delete) /home/swest/odot/spec/helpers/todo_lists_helper_spec.rb # No reason given # ./spec/helpers/todo_lists_helper_spec.rb:14 TodoList add some examples to (or delete) /home/swest/odot/spec/models/todo_list_spec.rb # No reason given # ./spec/models/todo_list_spec.rb:4
Deprecation Warnings:
The semantics of RSpec::Core::ExampleGroup.pending
are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how pending
with a block
from within an example already works.
To keep the same skip semantics, change pending
to skip
. Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.
Called from /home/swest/odot/spec/helpers/todo_lists_helper_spec.rb:14:in `block in <top (required)>'.
The semantics of RSpec::Core::ExampleGroup.pending
are changing in RSpec 3.
In RSpec 2.x, it caused the example to be skipped. In RSpec 3, the example will
still be run but is expected to fail, and will be marked as a failure (rather
than as pending) if the example passes, just like how pending
with a block
from within an example already works.
To keep the same skip semantics, change pending
to skip
. Otherwise, if you
want the new RSpec 3 behavior, you can safely ignore this warning and continue
to upgrade to RSpec 3 without addressing it.
Called from /home/swest/odot/spec/models/todo_list_spec.rb:4:in `block in <top (required)>'.
stub_model
is deprecated. Use the rspec-activemodel-mocks
gem instead. Called from /home/swest/odot/spec/views/todo_lists/edit.html.erb_spec.rb:5:in block (2 levels) in <top (required)>'.
stub_modelis deprecated. Use the
rspec-activemodel-mocksgem instead. Called from /home/swest/odot/spec/views/todo_lists/index.html.erb_spec.rb:6:in
block (2 levels) in <top (required)>'.
stub_model
is deprecated. Use the rspec-activemodel-mocks
gem instead. Called from /home/swest/odot/spec/views/todo_lists/index.html.erb_spec.rb:10:in block (2 levels) in <top (required)>'.
Too many uses of deprecated '
stub_model'. Pass
--deprecation-outor set
config.deprecation_stream` to a file for full output.
If you need more of the backtrace for any of these deprecations to
identify where to make the necessary changes, you can configure
config.raise_errors_for_deprecations!
, and it will turn the
deprecation warnings into errors, giving you the full backtrace.
7 deprecation warnings total
Finished in 1.1 seconds 41 examples, 0 failures, 2 pending
2 Answers
Sasha East
702 Pointsspec file: require 'spec_helper'
describe "Editing todo lists" do
let!(:todo_list) {TodoList.create(title: "Groceries", description: "Grocery list.")}
it "is successful when clicking the destroy link" do visit "/todo_lists"
within "#todo_list_#{todo_list.id}" do
click_link "Destroy"
end
expect(page).to_not have_content(todo_list.title)
expect(TodoList.count).to eq(0)
end end
spec_helper.rb
This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", FILE) require 'rspec/rails' require 'capybara/rspec'
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 with the --pattern
option on the command line or in ~/.rspec, .rspec or .rspec-local
.
Dir[Rails.root.join("spec/support/*/.rb")].each { |f| require f }
Checks for pending migrations before tests are run.
If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config| config.expose_current_running_example_as :example
# ## Mock Framework # # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: # # config.mock_with :mocha # config.mock_with :flexmock # config.mock_with :rr
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. config.use_transactional_fixtures = true
# If true, the base class of anonymous controllers will be inferred # automatically. This will be the default behavior in future versions of # rspec-rails. config.infer_base_class_for_anonymous_controllers = false
# 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"
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call get
and
# post
in specs under spec/controllers
.
#
# You can disable this behaviour by removing the line below, and instead
# explictly tag your specs with their type, e.g.:
#
# describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/v/3-0/docs
config.infer_spec_type_from_file_location!
end
Sasha East
702 PointsOnly when i run all tests this errors (messages) appears. If if run one specs they works without messages.
Kevin Egstorf
26,590 PointsKevin Egstorf
26,590 PointsCan you post the spec file?
does it look something like this?