我有一个这样的描述块:
describe "Documents" do
subject { page }
let (:course) { FactoryGirl.create(:course) }
describe "new" do
before do
visit new_course_document_path(course)
fill_in "Name", with: "TestDocument"
attach_file "Original document", "#{Rails.root}/spec/fixtures/03_GUI_concurrency.pdf"
end
it { should have_selector('title', text:"Upload document")}
it { should have_selector('h1', text:"Upload document")}
describe "when clicking upload" do
before { click_button "Upload Document" }
it "should have the document name" do
subject.should have_selector('p', text: "TestDocument")
end
it "should have 22 pages" do
subject.should have_selector('.page', count: 22)
end
describe "when visiting the course …Run Code Online (Sandbox Code Playgroud)