mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-24 08:52:14 -04:00
Fix failing specs
- Updated assert_select behaviour given this is now based on nokogiri - Adjust some specs not to look for a specific asset name, but a behaviour - Adjust some specs for HTML5 style attributes instead of xhtml style - Fix tests that did not render before
This commit is contained in:
@@ -231,7 +231,7 @@ feature "Planting a crop", :js do
|
||||
end
|
||||
|
||||
describe "Planting sunniness" do
|
||||
it "should show the image sunniness_sun.png" do
|
||||
it "should show the a sunny image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -244,11 +244,10 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_sun.png']")
|
||||
expect(page).to have_css("img[alt=sun]")
|
||||
expect(page).to have_css("img[alt='sun']")
|
||||
end
|
||||
|
||||
it "should show the image 'not specified.png'" do
|
||||
it "should show a sunniness not specified image" do
|
||||
fill_autocomplete "crop", with: "mai"
|
||||
select_from_autocomplete "maize"
|
||||
within "form#new_planting" do
|
||||
@@ -260,7 +259,6 @@ feature "Planting a crop", :js do
|
||||
click_button "Save"
|
||||
end
|
||||
|
||||
expect(page).to have_css("img[src*='sunniness_not specified.png']")
|
||||
expect(page).to have_css("img[alt='not specified']")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -547,11 +547,11 @@ describe Crop do
|
||||
end
|
||||
|
||||
it "should delete the association between post and the crop(tomato)" do
|
||||
expect(Post.find(post).crops).to eq [maize]
|
||||
expect(Post.find(post.id).crops).to eq [maize]
|
||||
end
|
||||
|
||||
it "should not delete the posts" do
|
||||
expect(Post.find(post)).to_not eq nil
|
||||
expect(Post.find(post.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,13 +158,13 @@ describe Post do
|
||||
end
|
||||
|
||||
it "should delete the association" do
|
||||
expect(Crop.find(tomato).posts).to eq []
|
||||
expect(Crop.find(maize).posts).to eq []
|
||||
expect(Crop.find(tomato.id).posts).to eq []
|
||||
expect(Crop.find(maize.id).posts).to eq []
|
||||
end
|
||||
|
||||
it "should not delete the crops" do
|
||||
expect(Crop.find(tomato)).to_not eq nil
|
||||
expect(Crop.find(maize)).to_not eq nil
|
||||
expect(Crop.find(tomato.id)).to_not eq nil
|
||||
expect(Crop.find(maize.id)).to_not eq nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ describe "crops/new" do
|
||||
end
|
||||
|
||||
it "shows a link to crop wrangling guidelines" do
|
||||
assert_select "a[href^=http://wiki.growstuff.org]", "crop wrangling guide"
|
||||
assert_select "a[href^='http://wiki.growstuff.org']", "crop wrangling guide"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -35,7 +35,7 @@ describe "forums/show" do
|
||||
|
||||
it 'links to new post with the forum id' do
|
||||
render
|
||||
assert_select "a[href=#{new_post_path(forum_id: @forum.id)}]"
|
||||
assert_select "a[href='#{new_post_path(forum_id: @forum.id)}']"
|
||||
end
|
||||
|
||||
it 'has no posts' do
|
||||
|
||||
@@ -66,7 +66,7 @@ describe "gardens/show" do
|
||||
end
|
||||
|
||||
it "links to the right crop in the planting link" do
|
||||
assert_select("a[href=#{new_planting_path}?garden_id=#{@garden.id}]")
|
||||
assert_select("a[href='#{new_planting_path}?garden_id=#{@garden.id}']")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
|
||||
it 'shows crops section' do
|
||||
assert_select 'h2', text: 'Some of our crops'
|
||||
assert_select "a[href=#{crop_path(@crop)}]"
|
||||
assert_select "a[href='#{crop_path(@crop)}']"
|
||||
end
|
||||
|
||||
it 'shows plantings section' do
|
||||
@@ -45,6 +45,6 @@ describe 'home/_crops.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'includes a link to all crops' do
|
||||
assert_select "a[href=#{crops_path}]", text: /View all crops/
|
||||
assert_select "a[href='#{crops_path}']", text: /View all crops/
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'shows the brand logo in the navbar' do
|
||||
assert_select("img[src='/assets/growstuff-brand.png']", href: root_path)
|
||||
assert_select("a.navbar-brand img[src]", href: root_path)
|
||||
end
|
||||
|
||||
it 'should have signup/signin links' do
|
||||
@@ -49,19 +49,19 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'links to members' do
|
||||
assert_select("a[href=#{members_path}]", 'Browse Members')
|
||||
assert_select("a[href='#{members_path}']", 'Browse Members')
|
||||
end
|
||||
|
||||
it 'links to posts' do
|
||||
assert_select("a[href=#{posts_path}]", 'Posts')
|
||||
assert_select("a[href='#{posts_path}']", 'Posts')
|
||||
end
|
||||
|
||||
it 'links to forums' do
|
||||
assert_select("a[href=#{forums_path}]", 'Forums')
|
||||
assert_select("a[href='#{forums_path}']", 'Forums')
|
||||
end
|
||||
|
||||
it 'has a crop search' do
|
||||
assert_select("form[action=#{crops_search_path}]")
|
||||
assert_select("form[action='#{crops_search_path}']")
|
||||
assert_select("input#term")
|
||||
end
|
||||
|
||||
@@ -81,16 +81,16 @@ describe 'layouts/_header.html.haml', type: "view" do
|
||||
rendered.should have_content "#{@member.login_name}"
|
||||
end
|
||||
it "should show link to member's gardens" do
|
||||
assert_select("a[href=#{gardens_by_owner_path(owner: @member.slug)}]", "Gardens")
|
||||
assert_select("a[href='#{gardens_by_owner_path(owner: @member.slug)}']", "Gardens")
|
||||
end
|
||||
it "should show link to member's plantings" do
|
||||
assert_select("a[href=#{plantings_by_owner_path(owner: @member.slug)}]", "Plantings")
|
||||
assert_select("a[href='#{plantings_by_owner_path(owner: @member.slug)}']", "Plantings")
|
||||
end
|
||||
it "should show link to member's seeds" do
|
||||
assert_select("a[href=#{seeds_by_owner_path(owner: @member.slug)}]", "Seeds")
|
||||
assert_select("a[href='#{seeds_by_owner_path(owner: @member.slug)}']", "Seeds")
|
||||
end
|
||||
it "should show link to member's posts" do
|
||||
assert_select("a[href=#{posts_by_author_path(author: @member.slug)}]", "Posts")
|
||||
assert_select("a[href='#{posts_by_author_path(author: @member.slug)}']", "Posts")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -23,17 +23,17 @@ describe 'layouts/_meta.html.haml', type: "view" do
|
||||
|
||||
it 'should have a Posts RSS feed' do
|
||||
posts_rss = url_for(controller: 'posts', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{posts_rss}]"
|
||||
assert_select "head>link[href='#{posts_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a Crops RSS feed' do
|
||||
crops_rss = url_for(controller: 'crops', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{crops_rss}]"
|
||||
assert_select "head>link[href='#{crops_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a Plantings RSS feed' do
|
||||
plantings_rss = url_for(controller: 'plantings', format: 'rss', only_path: false)
|
||||
assert_select "head>link[href=#{plantings_rss}]"
|
||||
assert_select "head>link[href='#{plantings_rss}']"
|
||||
end
|
||||
|
||||
it 'should have a title' do
|
||||
|
||||
@@ -36,7 +36,7 @@ describe "notifications/show" do
|
||||
end
|
||||
|
||||
it "includes a reply button" do
|
||||
assert_select "a[href=#{@reply_link}]", "Reply"
|
||||
assert_select "a", {href: @reply_link}, "Reply"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -36,17 +36,17 @@ describe 'notifier/notify.html.haml', type: "view" do
|
||||
end
|
||||
|
||||
it 'should include a reply link' do
|
||||
assert_select "a[href=#{@reply_link}]", text: /Reply/
|
||||
assert_select "a[href='#{@reply_link}']", text: /Reply/
|
||||
end
|
||||
|
||||
it 'should contain a link to your inbox' do
|
||||
assert_select "a[href*=notifications]"
|
||||
assert_select "a[href*='notifications']"
|
||||
end
|
||||
|
||||
it 'should have fully qualified URLs' do
|
||||
# lots of lovely fully qualified URLs
|
||||
assert_select "a[href^=http]", { minimum: 4 }
|
||||
assert_select "a[href^='http']", { minimum: 4 }
|
||||
# no relative URLs starting with /
|
||||
assert_select "a[href^=/]", { count: 0 }
|
||||
assert_select "a[href^='/']", { count: 0 }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,7 +33,7 @@ describe "orders/index" do
|
||||
it "renders a list of orders" do
|
||||
render
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", text: @order1.id
|
||||
assert_select "tr>td", text: @order2.id
|
||||
assert_select "tr>td a/@href", text: "/orders/#{@order1.id}"
|
||||
assert_select "tr>td a/@href", text: "/orders/#{@order2.id}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ describe "orders/show" do
|
||||
|
||||
it "shows a foreign exchange link for the total" do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=198.00+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=198.00+#{currency}']")
|
||||
end
|
||||
|
||||
it "asks for a referral code" do
|
||||
|
||||
@@ -32,6 +32,7 @@ describe "photos/new" do
|
||||
|
||||
context "user has no photosets" do
|
||||
it "doesn't show a dropdown with sets from Flickr" do
|
||||
render
|
||||
assert_select "select#set", false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -29,7 +29,7 @@ describe "photos/show" do
|
||||
end
|
||||
|
||||
it "shows the image" do
|
||||
assert_select "img[src=#{@photo.fullsize_url}]"
|
||||
assert_select "img[src='#{@photo.fullsize_url}']"
|
||||
end
|
||||
|
||||
it "links to the owner's profile" do
|
||||
@@ -46,7 +46,7 @@ describe "photos/show" do
|
||||
end
|
||||
|
||||
it "has a delete button" do
|
||||
assert_select "a[href=#{photo_path(@photo)}]", 'Delete Photo'
|
||||
assert_select "a[href='#{photo_path(@photo)}']", 'Delete Photo'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ describe "plantings/_form" do
|
||||
end
|
||||
|
||||
it "has a free-form text field containing the planting date in ISO format" do
|
||||
assert_select 'input#planting_planted_at[type=text][value=2013-03-01]'
|
||||
assert_select "input#planting_planted_at[type='text'][value='2013-03-01']"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ describe "plantings/edit" do
|
||||
end
|
||||
|
||||
it 'includes helpful links for crops and gardens' do
|
||||
assert_select "a[href=#{new_garden_path}]", text: "Add a garden."
|
||||
assert_select "a[href='#{new_garden_path}']", text: "Add a garden."
|
||||
end
|
||||
|
||||
it "chooses the right crop" do
|
||||
@@ -64,7 +64,7 @@ describe "plantings/edit" do
|
||||
|
||||
it "chooses the right garden" do
|
||||
assert_select "select#planting_garden_id",
|
||||
html: /option selected="selected" value="#{@garden.id}"/
|
||||
html: /option selected value="#{@garden.id}"/
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -56,12 +56,12 @@ describe "plantings/new" do
|
||||
end
|
||||
|
||||
it 'includes helpful links for crops and gardens' do
|
||||
assert_select "a[href=#{new_garden_path}]", text: "Add a garden."
|
||||
assert_select "a", href: new_garden_path, text: "Add a garden."
|
||||
end
|
||||
|
||||
it "selects a garden given in a param" do
|
||||
assert_select "select#planting_garden_id",
|
||||
html: /option selected="selected" value="#{@garden_z.id}"/
|
||||
html: /option selected value="#{@garden_z.id}"/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ describe "plantings/show" do
|
||||
@photo = FactoryGirl.create(:photo, owner: @member)
|
||||
@p.photos << @photo
|
||||
render
|
||||
assert_select "img[src=#{@photo.thumbnail_url}]"
|
||||
assert_select "img[src='#{@photo.thumbnail_url}']"
|
||||
end
|
||||
|
||||
it "shows a link to add photos" do
|
||||
|
||||
@@ -33,11 +33,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains a permanent link to post" do
|
||||
assert_select "a[href=#{post_path @post}]", "Permalink"
|
||||
assert_select "a[href='#{post_path @post}']", "Permalink"
|
||||
end
|
||||
|
||||
it "doesn't contain a link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", false
|
||||
assert_select("a", {href: new_comment_path(post_id: @post.id)}, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,11 +50,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", "Reply"
|
||||
assert_select("a", {href: new_comment_path(post_id: @post.id)}, "Reply")
|
||||
end
|
||||
|
||||
it "does not contain an edit link" do
|
||||
assert_select "a[href=#{edit_post_path(@post)}]", false
|
||||
assert_select "a[href='#{edit_post_path(@post)}']", false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,7 +68,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "contains an edit link" do
|
||||
assert_select "a[href=#{edit_post_path(@post)}]", "Edit"
|
||||
assert_select "a[href='#{edit_post_path(@post)}']", "Edit"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -78,7 +78,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "0 comments"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "0 comments"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "1 comment"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "1 comment"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,7 +101,7 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "renders the number of comments" do
|
||||
assert_select "a[href=#{post_path(@post)}\#comments]", "2 comments"
|
||||
assert_select "a[href='#{post_path(@post)}\#comments']", "2 comments"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,11 +121,11 @@ describe "posts/_single" do
|
||||
end
|
||||
|
||||
it "does not contain link to post" do
|
||||
assert_select "a[href=#{post_path @post}]", false
|
||||
assert_select "a[href='#{post_path @post}']", false
|
||||
end
|
||||
|
||||
it "does not contain link to new comment" do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", false
|
||||
assert_select "a[href='#{new_comment_path(post_id: @post.id)}']", false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -55,7 +55,7 @@ describe "posts/edit" do
|
||||
end
|
||||
|
||||
it 'creates a hidden field' do
|
||||
assert_select "input#post_forum_id[type=hidden][value=#{@forum.id}]"
|
||||
assert_select "input#post_forum_id[type='hidden'][value='#{@forum.id}']"
|
||||
end
|
||||
|
||||
it 'tells the user what forum it will be posted in' do
|
||||
|
||||
@@ -56,7 +56,7 @@ describe "posts/new" do
|
||||
end
|
||||
|
||||
it 'creates a hidden field' do
|
||||
assert_select "input#post_forum_id[type=hidden][value=#{@forum.id}]"
|
||||
assert_select "input#post_forum_id[type='hidden'][value='#{@forum.id}']"
|
||||
end
|
||||
|
||||
it 'tells the user what forum it will be posted in' do
|
||||
|
||||
@@ -118,7 +118,7 @@ describe "posts/show" do
|
||||
end
|
||||
|
||||
it 'shows a comment button' do
|
||||
assert_select "a[href=#{new_comment_path(post_id: @post.id)}]", "Comment"
|
||||
assert_select "a", {href: new_comment_path(post_id: @post.id)}, "Comment"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -27,6 +27,6 @@ describe "products/index" do
|
||||
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
||||
assert_select "tr>td", text: @product.name, count: 2
|
||||
assert_select "tr>td", text: @product.description, count: 2
|
||||
assert_select "tr>td", text: @product.min_price, count: 2
|
||||
assert_select "tr>td", text: @product.min_price.to_s, count: 2
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,7 +65,7 @@ describe "seeds/show" do
|
||||
|
||||
it "links to profile to set location" do
|
||||
render
|
||||
assert_select "a[href=#{url_for(edit_member_registration_path)}]", text: "Set Location"
|
||||
assert_select "a[href='#{url_for(edit_member_registration_path)}']", text: "Set Location"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ describe 'shop/index.html.haml', type: "view" do
|
||||
|
||||
it 'should contain an exchange rate link' do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=9.99+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=9.99+#{currency}']")
|
||||
end
|
||||
|
||||
it 'shows recommended price for products that have it' do
|
||||
@@ -50,7 +50,7 @@ describe 'shop/index.html.haml', type: "view" do
|
||||
|
||||
it 'should contain an exchange rate link for recommended price' do
|
||||
currency = Growstuff::Application.config.currency
|
||||
assert_select("a[href=http://www.wolframalpha.com/input/?i=12.00+#{currency}]")
|
||||
assert_select("a[href='http://www.wolframalpha.com/input/?i=12.00+#{currency}']")
|
||||
end
|
||||
|
||||
it 'displays the order form' do
|
||||
|
||||
Reference in New Issue
Block a user