public
Last active

Project Spec Rspec test

  • Download Gist
project_spec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
require 'spec_helper'
 
describe Project do
 
context "while starting up" do
before do
options = {
name: 'Building house',
priority: 2,
tasks: []
}
@project = Project.new(options)
end
 
it "has a name" do
expect(@project.name).to include('Building house')
end
it "has zero tasks" do
@project.tasks.should be_empty
end
end
 
context "manipulating projects" do
before do
options1 = {
name: 'Building house',
priority: 2,
tasks: []
}
 
options2 = {
name: 'Getting a loan from the Bank',
priority: 3,
tasks: []
}
 
@project1 = Project.new(options1)
@project2 = Project.new(options2)
end
 
it "has to return more than 0 projects" do
Project.count.should be > 0
end
 
it "can print all projects" do
Project.all.should eq([@project1, @project2])
end
 
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.