2016-04-25 5 views
0

私が期待しているテーブルの内容を見つけていないような機能テストがあります。私はフィーチャーテストの新人だと言っておかなければなりません。これは私が間違っていることを確認するためのものです。基本的に私はグループ名と応答を両方とるグループテーブルを持っていますが、どちらもテーブルに表示されるべきですが、テストを実行すると表示されません。ここに私のエラーと明確にするためのコードです。Rspecの機能テスト - テーブルの内容を確認しています

TEST

require "rails_helper" 

RSpec.feature "Edit 'Bounce Back' Message" do 
    scenario "Staff can change the response message" do 
    visit "/groups" 

    user = FactoryGirl.create(:user) 
    fill_in "Email", with: user.email 
    fill_in "Password", with: user.password 
    click_button "Sign in" 

    group = Group.create!(name: "Group A") 
    person = Person.create!(groups: [group], phone_number: "+161655555555") 

    expect(page).to have_content("You are now subscribed for updates") 
    expect(page).to have_content("Group A") 
    end 
end 

エラーメッセージが

HERE This is the image

はされているページ

This is the image

あなたはそれが上のレスポンスとグループ名を表示する必要があります見ることができるようにページそれは私が期待している言葉を表示していないと言っている?どんな助けも素晴らしいだろう!あなたが最初のユーザーにログインしてのみ、その後のサブスクリプション・グループを作成しているので、あなたがリフレッシュを行う場合を除き

VIEW

<div class="container text-center"> 
<div class="row"> 
<div class="text-center"> 
    <h3>Edit The "Bounce Back" Subscription Response</h3> 
<table class="table table-striped"> 
    <tbody> 
    <% @group.each do |group| %> 
     <tr> 
     <td class='edit_response'><%= group.name.capitalize %></td> 
     <td class='edit-response'><%= group.response %></td> 
     <td><%= link_to 'Edit', edit_group_path(group) %></td> 
     <tr> 
    <% end %> 
    </tbody> 
</table> 
</div> 
</div> 
</div> 

答えて

1

、それがページに表示されません。ユーザーにログインする前にサブスクリプショングループを作成してみてください。

scenario "Staff can change the response message" do 
    visit "/groups" 

    group = Group.create!(name: "Group A") 
    person = Person.create!(groups: [group], phone_number: "+161655555555") 

    user = FactoryGirl.create(:user) 
    fill_in "Email", with: user.email 
    fill_in "Password", with: user.password 
    click_button "Sign in" 

    expect(page).to have_content("You are now subscribed for updates") 
    expect(page).to have_content("Group A") 
end 
関連する問題