#articles.feature
Given an article exists called "Testing Demonstration"
When I visit the list of articles
Then I should see an article called "Testing Demonstration"
#article_steps.rb
Given /^an article exists called "(.+)"$/ do |title|
FactoryGirl.create(:article, title: title)
end
When /^I visit the list of articles$/ do
visit articles_path
end
Then /^I should see an article called "(.+)"$/ do |title|
page.should have_content title
end
R规范
describe "Articles" do
let(:article) { FactoryGirl.create(:article) }
context "Index Page" do
before { visit articles_path }
it { page.should have_content article.title }
end
end