describe "Profile page" do
let(:demo_user) { FactoryGirl.create(:user) }
before { visit user_path(demo_user) }
it {should have_selector('h1', text: demo_user.name)}
it {should have_selector('title', text: demo_user.name)}
end
before 那一句我不是太理解 FactoryGirl.create(:user)
是直接拿 girl 里面定义的 user 信息去 create 了一个 user 信息吗?
{ visit user_path(demo_user) }
参数是一个 id 吗?
FactoryGirl.define do
factory :user do
name "Factory Girl"
email "[email protected]"
password "foobar"
password_confirmation "foobar"
end
end