From 1b7268f456de9709da66439a90d7c3a8b0975c26 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sat, 15 Feb 2014 01:46:22 -0500 Subject: [PATCH] Improve layout flow / tests --- app/views/layouts/application.html.erb | 4 +--- app/views/pastes/index.html.erb | 3 ++- app/views/pastes/show.html.erb | 4 +++- spec/features/lists_pastes_spec.rb | 16 ++++++++++++++++ 4 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 spec/features/lists_pastes_spec.rb diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b97625a..23a61f0 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -17,9 +17,7 @@ diff --git a/app/views/pastes/index.html.erb b/app/views/pastes/index.html.erb index 91d18f3..d45f3b7 100644 --- a/app/views/pastes/index.html.erb +++ b/app/views/pastes/index.html.erb @@ -1,3 +1,4 @@ +

Pastes

<% @pastes.each do |paste| %> - <%= link_to paste.id, paste %>
+ <%= link_to paste.created_at, paste %>
<% end %> diff --git a/app/views/pastes/show.html.erb b/app/views/pastes/show.html.erb index b8088ab..49d9a74 100644 --- a/app/views/pastes/show.html.erb +++ b/app/views/pastes/show.html.erb @@ -1 +1,3 @@ -<%= @paste.content %> +
+  <%= @paste.content %>
+
diff --git a/spec/features/lists_pastes_spec.rb b/spec/features/lists_pastes_spec.rb new file mode 100644 index 0000000..55a04ff --- /dev/null +++ b/spec/features/lists_pastes_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +feature 'Lists pastes' do + let(:paste) { FactoryGirl.create(:paste) } + before do + visit new_paste_path + fill_in 'Content', with: paste.content + click_button 'Paste it!' + visit pastes_path + end + subject { page } + + scenario 'shows paste on index' do + should have_content(paste.created_at) + end +end