Skip to content

Instantly share code, notes, and snippets.

@amite
Last active December 11, 2015 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amite/4535863 to your computer and use it in GitHub Desktop.
Save amite/4535863 to your computer and use it in GitHub Desktop.
Project Spec Rspec test
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment