Skip to content

Commit 7183c08

Browse files
author
Ryan Bigg
committed
Section 5.2.1: Implement tickets display
1 parent 80add79 commit 7183c08

File tree

5 files changed

+51
-20
lines changed

5 files changed

+51
-20
lines changed

ticketee/app/views/projects/show.html.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@
1919
<%= link_to "New Ticket",
2020
new_project_ticket_path(@project),
2121
class: "new" %>
22+
23+
<div class='row'>
24+
<ul id='tickets'>
25+
<% @project.tickets.each do |ticket| %>
26+
<li>
27+
#<%= ticket.id %> -
28+
<%= link_to ticket.title, [@project, ticket] %>
29+
</li>
30+
<% end %>
31+
</ul>
32+
</div>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FactoryGirl.define do
2+
factory :ticket do
3+
title "Example ticket"
4+
description "An example ticket, nothing more"
5+
end
6+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
require "rails_helper"
2+
3+
feature "Viewing tickets" do
4+
before do
5+
sublime = FactoryGirl.create(:project, name: "Sublime Text 3")
6+
7+
FactoryGirl.create(:ticket,
8+
project: sublime,
9+
title: "Make it shiny!",
10+
description: "Gradients! Starbursts! Oh my!")
11+
12+
ie = FactoryGirl.create(:project, name: "Internet Explorer")
13+
FactoryGirl.create(:ticket,
14+
project: ie,
15+
title: "Standards compliance",
16+
description: "Isn't a joke.")
17+
18+
visit "/"
19+
end
20+
21+
scenario "Viewing tickets for a given project" do
22+
click_link "Sublime Text 3"
23+
24+
expect(page).to have_content("Make it shiny!")
25+
expect(page).to_not have_content("Standards compliance")
26+
27+
click_link "Make it shiny!"
28+
within("#ticket h2") do
29+
expect(page).to have_content("Make it shiny!")
30+
end
31+
32+
expect(page).to have_content("Gradients! Starbursts! Oh my!")
33+
end
34+
end

ticketee/spec/helpers/tickets_helper_spec.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.

ticketee/spec/models/ticket_spec.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)