RSpec: the simplest test with an error: the expected block to return the true value

I test water with Rails and I stick to this simple test:

I have this code in spec / routing / routing_spec.rb

  require 'spec_helper'

  describe "Accessing the root domain" do
    it "should route to home#index" do
      { :get => '/' }.
        should route_to(:controller => 'home', :action=>'index')
    end 
 end

This fails with the following error:

 Failure/Error: { :get => '/' }.
       Expected block to return true value.
     # ./spec/routing/routing_spec.rb:7:in `block (3 levels) in <top (required)>'

What is wrong in my code?

+3
source share
3 answers

, Rails 3 Ruby 1.9.2. , MiniTest, Ruby, assert_block ( assert_recognizes ActionDispatch:: Assertions:: RoutingAssertions) ( params ). minitest Gemfile bundler:

group :test do
  gem "minitest", ">= 2.6.1" # The minitest version that ships with Ruby is old and has bugs
end

:

The recognized options <{"action"=>"index",
"controller"=>"publish/product_versions",
"product_id"=>"ipad_app"}> did not match <{"controller"=>"publish/product_versions",
"action"=>"indexx",
"product_id"=>"ipad_app"}>, difference: <{"action"=>"indexx"}>.
Expected block to return true value.
+1

, , , . , , . , , 7, 5 , - .

, , . , . , , { :get => '/' } .

,

0

, . , .

-1
source

All Articles