Problem Learning Rails

#Help #asap #cucumber #bdd
Hello there. I am learning BDD with Cucumber. I have following problem. If someone can help that would be great.

show_blog_list.feature
Feature: Show blog list
As a blog visitor
I can see list of posted blogs

Scenario: Show blog list
Given there are already 4 posts
And I am on the blog homepage
Then I can see list of 4 posted blogs

show_blog_list_steps.rb
Then /^I can see list of (\d) posted blogs$/ do |count|
page.should have_selector (“table#posts-list>tr:eq(#{count})”)
end

common_steps.rb
Given(/^I am on the blog homepage$/) do
visit(“/posts”)
end

And /^there are already (\d) posts$/ do |count|
count.to_i.times do |n|
Post.create!({ :title => “Title #{n}”, :content =>
“Content #{n}”, :post_time => Time.now })
end
end

index.html.erb

Listing Posts

Title Content Post time

 

Now when I run
cucumber features/show_blog_post.feature

I get error like below:

Using the default profile…
Feature: Show blog list
As a blog visitor
I can see list of posted blogs

Scenario: Show blog list # features/show_blog_list.feature:5
Given there are already 4 posts # features/step_definitions/common_steps.rb:5
And I am on the blog homepage # features/step_definitions/common_steps.rb:1
DEPRECATION: Using `should` from rspec-expectations’ old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }` instead. Called from /home/bishisht/learn/bdd/blog/features/step_definitions/show_blog_list_steps.rb:2:in `block in ‘.
Then I can see list of 4 posted blogs # features/step_definitions/show_blog_list_steps.rb:1
expected to find css “table#posts-list>tr:eq(4)” but there were no matches (RSpec::Expectations::ExpectationNotMetError)
./features/step_definitions/show_blog_list_steps.rb:2:in `/^I can see list of (\d) posted blogs$/’
features/show_blog_list.feature:8:in `Then I can see list of 4 posted blogs’

Failing Scenarios:
cucumber features/show_blog_list.feature:5 # Scenario: Show blog list

1 scenario (1 failed)
3 steps (1 failed, 2 passed)
0m0.309s

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s