Skip to content

Instantly share code, notes, and snippets.

@ybur-yug
Last active December 14, 2016 16:26
Show Gist options
  • Save ybur-yug/0be1dd8f4555beb6124c00b95c2ded2c to your computer and use it in GitHub Desktop.
Save ybur-yug/0be1dd8f4555beb6124c00b95c2ded2c to your computer and use it in GitHub Desktop.
describe(List) do
describe("#tasks") do
it("tells which tasks are in it") do
test_list = List.create({:name => "list"})
test_task1 = Task.create({:description => "task1", :list_id => test_list.id})
test_task2 = Task.create({:description => "task2", :list_id => test_list.id})
expect(test_list.tasks()).to(eq([test_task1, test_task2]))
end
end
end
describe(List) do
describe "A list with tasks" do
it "has a list of tasks" do
list = List.create({:name => "Times I Farted"}).id
task_one = Task.create({description: "morning", :list_id => list.id })
task_two = Task.create({description: "breakfast", :list_id => list.id })
tasks = list.tasks
expect(tasks.include? task_one).to eq true
expect(tasks.include? task_two).to eq true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment