我运行测试rspec并显示错误:
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center"
/>
如何正确设置测试路线?
user_spec.rb :
Failure/Error: before { visit user_path(user) }
NoMethodError:
undefined method `user_path' for #<RSpec::ExampleGroups::UserPages::ProfilePage:0xcd1f7c0>
我的 routes.rb ,其中添加了i route get'/ users /:id',用于:'users#show',:as =&gt; :用户
require 'rails_helper'
describe "User pages" do
subject { page }
describe "profile page" do
let(:user) { FactoryGirl.create(:user) }
before { visit user_path(user) }
it { should have_content(user.name) }
it { should have_title(user.name) }
end
describe "signup page" do
before { visit signup_path }
it { should have_content("Sign up") }
it { should have_title(full_title('Sign up')) }
end
end
请解释一下,如何正确添加测试rspec的路线。我使用rails 4. M