From fc0d883eab566b2effa8897fb753bcdc571e3735 Mon Sep 17 00:00:00 2001 From: Skud Date: Fri, 9 Aug 2013 14:19:40 +1000 Subject: [PATCH] Added tests for home/seeds partial --- spec/views/home/_seeds.html.haml_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/views/home/_seeds.html.haml_spec.rb diff --git a/spec/views/home/_seeds.html.haml_spec.rb b/spec/views/home/_seeds.html.haml_spec.rb new file mode 100644 index 000000000..f2f81c60d --- /dev/null +++ b/spec/views/home/_seeds.html.haml_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'home/_seeds.html.haml', :type => "view" do + before(:each) do + @seed = FactoryGirl.create(:tradable_seed) + assign(:seeds, [@seed]) + render + end + + it 'has a heading' do + assert_select 'h2', 'Seeds available to trade' + end + + it 'lists seeds' do + assert_select "table" + assert_select 'a', :href => crop_path(@seed.crop) + assert_select 'a', :href => crop_path(@seed.owner) + assert_select 'td', @seed.tradable_to + assert_select 'td', @seed.owner.location + assert_select 'a', :href => seed_path(@seed) + end +end