我剛開始使用Cucumber,我不確定如何測試視圖中的部分內容。
這裏是我的特點
黃瓜:posting.feature使用Cucumber測試Ruby on Rails嵌套視圖
Scenario: After having created job posting
Given I am authenticated as "administrator"
Given I am on the new posting page
When I press "Create Posting"
Then I should see "Back to list of all postings"
(這是網頁,我目前)
我new.html.haml
= link_to 'Logout', logged_out_url(@user)
%h1 New posting
= render 'form'
%br/
= link_to 'Cancel', postings_path
(這是在new.html.haml其「創建發佈」加載視圖按鈕,我想測試)
_form.html.haml
= form_for(@postings) do |posting_builder|
- if @postings.errors.any?
#error_explanation
%h2
= pluralize(@postings.errors.count, "error")
prohibited this posting from being saved:
%ul
- @postings.errors.full_messages.each do |msg|
%li= msg
.field
%b= posting_builder.label :title
%br/
= posting_builder.text_field :title
.field
%b= posting_builder.label :description
%br/
= posting_builder.text_field :description
.field
%b= posting_builder.label :requirements
%br/
= posting_builder.text_field :requirements
.field
%b= posting_builder.label :location
%br/
= posting_builder.text_field :location
.field
%b= posting_builder.label :Admin
%br/
= select("posting", "user_id", User.order('last_name ASC').collect {|u| [u.fullname, u.id]})
%br/
%br/
/Submit
.actions
= posting_builder.submit
有任何建議至於我應該如何處理這個或與我的問題相關的資源/例子?