Skip to content

Instantly share code, notes, and snippets.

@beliar91
Created January 27, 2016 02:41
Show Gist options
  • Save beliar91/7ab8eb9120b2f5e09734 to your computer and use it in GitHub Desktop.
Save beliar91/7ab8eb9120b2f5e09734 to your computer and use it in GitHub Desktop.
spec/models/task_spec.rb
require 'rails_helper'
RSpec.describe Task, type: :model do
let(:task2) {FactoryGirl.create(:task2)}
let(:task) {FactoryGirl.create(:task)}
let(:task_not_valid) {FactoryGirl.create(:task_not_valid, status: "Not valid")}
it "Task with not valid status should not be saved" do
task_not_valid.save
expect(task_not_valid.errors).to eq("is not included in the list")
end
it "A valid Task should be saved" do
task.save
expect(task.save).to eq(true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment