```ruby
# == Schema Information
#
# Table name: microposts
#
#  id         :integer         not null, primary key
#  content    :string
#  user_id    :integer
#  created_at :datetime        not null
#  updated_at :datetime        not null
#

require 'spec_helper'

describe Micropost do
  let(:user) { FactoryGirl.create(:user) }
  before { @micropost = user.microposts.build(content: "Lorem ipsum!") } 

  subject { @micropost }

  it { should respond_to(:content) }
  it { should respond_to(:user_id) }
  it { should respond_to(:user) }
  its(:user) { should == user }

  it { should be_valid }

  describe "accessible attributes" do
    it "should not allow access to user_id" do
      expect do
        Micropost.new(user_id: user.id) 
      end.should raise_error
    end
  end

  describe "when user_id is not present" do
    before { @micropost.user_id = nil }

    it { should_not be_valid }
  end

end
```

Remove mass assignmente test, because rails 4 move this funcionality to controller
user
```ruby
# == Schema Information
#
# Table name: microposts
#
#  id         :integer         not null, primary key
#  content    :string
#  user_id    :integer
#  created_at :datetime        not null
#  updated_at :datetime        not null
#

require 'spec_helper'

describe Micropost do
  let(:user) { FactoryGirl.create(:user) }
  before { @micropost = user.microposts.build(content: "Lorem ipsum!") } 

  subject { @micropost }

  it { should respond_to(:content) }
  it { should respond_to(:user_id) }
  it { should respond_to(:user) }
  its(:user) { should == user }

  it { should be_valid }

  describe "when user_id is not present" do
    before { @micropost.user_id = nil }

    it { should_not be_valid }
  end

end
```
assistant