I am currently stuck on the rails tutorial from Michael Hartl (railstutorial.org), Chapter 13

and getting the following two errors:

```
1) Error:
MicropostsControllerTest#test_should_redirect_create_when_not_logged_in:
ActionController::UrlGenerationError: No route matches {:action=>"/microposts", :controller=>"microposts", :params=>{:micropost=>{:content=>"Lorem ipsum"}}}
    test/controllers/microposts_controller_test.rb:11:in 'block (2 levels) in <class:MicropostsControllerTest>'
    test/controllers/microposts_controller_test.rb:10:in 'block in <class:MicropostsControllerTest>'

  2) Error:
MicropostsControllerTest#test_should_redirect_destroy_when_not_logged_in:
ActionController::UrlGenerationError: No route matches {:action=>"/microposts/499495288", :controller=>"microposts"}
    test/controllers/microposts_controller_test.rb:18:in 'block (2 levels) in <class:MicropostsControllerTest>'
    test/controllers/microposts_controller_test.rb:17:in 'block in <class:MicropostsControllerTest>'

```

As far as i know, 'action' should be something like get, post, delete etc.
But i don't know, why it says 'micropost' here.

Content of microposts\_controller\_test.rb:

```
require 'test_helper'

class MicropostsControllerTest < ActionController::TestCase

  def setup
    @micropost = microposts(:orange)
  end

  test 'should redirect create when not logged in' do
    assert_no_difference 'Micropost.count' do
      post microposts_path, params: {micropost: {content: 'Lorem ipsum'}}
    end
    assert_redirected_to login_url
  end

  test 'should redirect destroy when not logged in' do
    assert_no_difference 'Micropost.count' do
      delete micropost_path(@micropost)
    end
    assert_redirected_to login_url
  end
end

```

Content of micropost\_controller.rb:

```
class MicropostsController < ApplicationController
  before_action :logged_in_user, only: [:create, :destroy]

  def create
    @micropost = current_user.microposts.build(micropost_params)
    if @micropost.save
      flash[:success] = 'Micropost created!'
      redirect_to root_url
    else
      render 'static_pages/home'
    end
  end

  def destroy
  end

  private

  def micropost_params
    params.require(:micropost).permit(:content)
  end

end

```

Content of routes.rb: 

```
Rails.application.routes.draw do
  root 'static_pages#home'
  get '/help' => 'static_pages#help'
  get '/about' => 'static_pages#about'
  get '/contact' => 'static_pages#contact'
  get '/signup' => 'users#new'
  get '/login' => 'sessions#new'
  post '/login' => 'sessions#create'
  delete '/logout' => 'sessions#destroy'
  resources :users
  resources :account_activations, only: [:edit]
  resources :password_resets, only:     [:new, :create, :edit, :update]
  resources :microposts, only:           [:create, :destroy]
end

```

Any help is appreciated.

Thanks

Edit: 

In micropost\_controller\_test.rb, it should've been:

```
class MicropostsControllerTest < ActionDispatch::IntegrationTest

```

instead of

```
class MicropostControllerTest < ActionCntroller::TestCase

```