Sha256: 63f1094e09e1777edceef8d736f0012d295ff9b5dfc77266f2115e865bfefd9a

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require 'rails_helper'
require 'rails_magic_renamer'
describe Micropost do

  let(:user) { FactoryGirl.create(:user) }
  before do
    # This code is not idiomatically correct.
    @micropost = Micropost.new(content: "Lorem ipsum", user_id: user.id)
  end

  subject { @micropost }

  it { should respond_to(:content) }
  it { should respond_to(:user_id) }

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

  describe "with blank content" do
    before { @micropost.content = " " }
    it { should_not be_valid }
  end

  describe "with content that is too long" do
    before { @micropost.content = "a" * 141 }
    it { should_not be_valid }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_magic_renamer-2.0.0.pre.alpha spec/support/sample_app_rails_4/spec/models/micropost_spec.rb