我正在尝试这样做:
我的测试如下:
describe "User pages" do
subject { page }
describe "edit" do
let(:user) { FactoryGirl.create(:user) }
before do
log_in user
#visit edit_user_path(user) <-- did not work
end
describe "page" do
it "should render edit page" do
get :edit, :id => user.id
should have_selector('h1', text: "Update")
should have_selector('h2', text: user.username)
should have_selector('title', text: "Edit user")
end
end
describe "with invalid information" do
before { click_button "Save changes" }
it { should have_content('error') }
end
结尾
我尝试添加get :edit, :id => user.id
,但它引发了异常:
Failure/Error: get :edit, :id => user.id
ArgumentError:
bad argument (expected URI object or URI string)
还有什么我想念的吗?