Sha256: 04c58674352429860f9949f0de3a9f37865ebd8c1c2260be66af724732c99d28

Contents?: true

Size: 573 Bytes

Versions: 8

Compression:

Stored size: 573 Bytes

Contents

require "rails_helper"

RSpec.describe JobPosting, type: :model do
  include ActiveSupport::Testing::TimeHelpers

  it { should have_many :comments }
  it { should validate_presence_of(:title) }
  it { should define_enum_for(:status).with([:new_post, :pending, :complete]) }

  describe "defaults" do
    subject(:posting) { build :job_posting }
    let(:posted_time) { Time.zone.local(2017, 4, 21, 4, 44) }

    before { travel_to(posted_time) }

    after { travel_back }

    its(:posted_at) { should eq posted_time }
    its(:status) { should eq "new_post" }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gnarails-3.0.1 test-app/spec/models/job_posting_spec.rb
gnarails-3.0.0 test-app/spec/models/job_posting_spec.rb
gnarails-2.0.0 test-app/spec/models/job_posting_spec.rb
gnarails-1.0.0 test-app/spec/models/job_posting_spec.rb
gnarails-0.9.3 test-app/spec/models/job_posting_spec.rb
gnarails-0.9.2 test-app/spec/models/job_posting_spec.rb
gnarails-0.9.1 test-app/spec/models/job_posting_spec.rb
gnarails-0.9.0 test-app/spec/models/job_posting_spec.rb