Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6207091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:34:07+00:00 2026-05-24T05:34:07+00:00

In my actual project I use the following gems for testing: capybara from git://github.com/jnicklas/capybara.git

  • 0

In my actual project I use the following gems for testing:

  • capybara from git://github.com/jnicklas/capybara.git in revision 6641fddcfc337a3ddaa84ac59272e884090332c3
  • rails (3.1.0.rc5) (and its requirements)
  • factory_girl (2.0.1)
  • factory_girl_rails (1.1.0)
  • rspec (2.6.0)
  • rspec-core (2.6.4)
  • rspec-rails (2.6.1)

When doing rake spec I get the following error:

...F.....*................*....*.*.*.

Pending:
  <pending snipped out>

Failures:

  1) Articles GET /articles/:id should show the article when clicking it
     Failure/Error: page.should have_content a.body
       expected there to be content "Dieser Artikel ist nur zum testen, erfüllt keinen Sinn und langweilig ist mir ohnehin. Das sollte nur mal so gesagt werden... MfG Euer Admin!\n" in "Stars3\n  \n    Stars!Artikel - 1 - This is an article created just for testing purpose\n  \n  \n    Artikel\n\n    \nDieser Artikel ist nur zum testen, erfüllt keinen Sinn und langweilig ist mir ohnehin. Das sollte nur mal so gesagt werden... MfG Euer Admin!\n\n  \n"              
     # ./spec/requests/articles_spec.rb:46

Finished in 1.96 seconds
37 examples, 1 failure, 5 pending

Failed examples:

rspec ./spec/requests/articles_spec.rb:40 # Articles GET /articles/:id should show the article when clicking it

I cant see any differences between the expectation and the result… Can you point me in the right direction to make this one work?

The spec:

describe "GET /articles/:id" do
  it "should show the article when clicking it", :type => :request do      
    a = Factory.create(:article)#, :user => u)
    a.save
    visit articles_path
    click_link a.title
    page.should have_content a.title
    page.should have_content a.body
  end
end

The factory:

Factory.define :article do |a|
  Factory.sequence :title do |i|
    "#{1} - This is an article created just for testing purpose"
  end

  a.title { Factory.next(:title) }
  a.association :user, :factory => :user #user  { User.first }
  a.body <<eot
Dieser Artikel ist nur zum testen, erfüllt keinen Sinn und langweilig ist mir ohnehin. Das sollte nur mal so gesagt werden... MfG Euer Admin!
eot

end

The view:

<% title "Artikel - #{@article.title}" -%>

<%= @article.compiled -%>

The controller:

class ArticlesController < ApplicationController
  before_filter :login_required, :except => [:index, :show]

  def show
    @article = Article.find_by_title(params[:id])
  end

end

And the model:

class Article < ActiveRecord::Base
  validates_presence_of :body, :message => "Es muss schon Text drin stehen"
  validates_presence_of :title, :message => "Du brauchst nen Titel für den Artikel"
  validates_presence_of :user, :message => "Das hätte nicht passieren dürfen... Es wurde kein Nutzer angegeben"
  belongs_to :user
#  before_save :compile_body

  def compiled
    body
  end

  def to_param
    "#{title}"
  end

end

If something is missing, please feel free to ask, I will put it here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:34:08+00:00Added an answer on May 24, 2026 at 5:34 am

    Setting the article body to a simple oneliner by changing the factory to

    Factory.define :article do |a|
      Factory.sequence :title do |i|
        "#{1} - This is an article created just for testing purpose"
      end
    
      a.title { Factory.next(:title) }
      a.association :user, :factory => :user
      a.body { "Dieser Artikel ist ein Test" }
    
    end
    

    did the test make passing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails project which has a Postgres database for the actual application
I'm using the following menu XML in my project: <?xml version=1.0 encoding=utf-8?> <menu xmlns:android=http://schemas.android.com/apk/res/android>
What is the actual use of TempData collection in asp.net MVC, I need pros
I know in an actual query, you can use auto_increment=1 but how is this
My current project requires extensive use of bit fields. I found a simple, functional
I'm working on a project in which I use Depency Injection. When registering a
The following scenario came up in our project: We have hierarchical business objects. The
I recently installed WAMP for actual local use. I've worked on live development servers
I'm working on a project and I came to the following naming problem .
For my project I am using the integrated Visual Studio unit-testing framework but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.