Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Search Gists
Sign in Sign up

Instantly share code, notes, and snippets.

@keating
Last activeAugust 29, 2015 14:03
    • Star(0)You must be signed in to star a gist
    • Fork(0)You must be signed in to fork a gist
    Save keating/50ba6138d3d1ac4334c8 to your computer and use it in GitHub Desktop.
    describe"Admin see company list"do
    subject{page}
    describe"when there are no companies"do
    beforedo
    @admin=FactoryGirl.create(:developer_admin)
    admin_login(@admin)
    end
    it"displays an empty company list"do
    expect(page).tohave_link("New Company")
    expect(page).tohave_link("View History")
    within("table#companytable")do
    expect(page).tohave_selector('thead')
    expect(page).tohave_selector('tbody tr',maximum:0)
    end
    within('table#companytable thead')do
    expect(page).tohave_text"LOGO"
    expect(page).tohave_text"NAME"
    expect(page).tohave_text"USERNAME"
    expect(page).tohave_text"ACTION"
    end
    end
    end
    describe"when there are companies"do
    beforedo
    @admin=FactoryGirl.create(:admin_with_companies_with_company_user)
    admin_login(@admin)
    end
    it"displays the company list"do
    expect(page).tohave_link("View History")
    within("table#companytable")do
    expect(page).tohave_selector('thead')
    expect(page).tohave_selector('tbody tr',count:2)
    end
    within("table#companytable tbody")do
    expect(page).tohave_text('company_',count:2)
    expect(page).tohave_selector('a.btn',text:"Manage",count:2)
    end
    end
    it"can see the company detail in a form",js:truedo
    visit_company_show_page
    find("form#admin_form").shouldbe_visible
    end
    it"can update the company information",js:true,driver::poltergeistdo
    visit_company_show_page
    find("form#admin_form").shouldbe_visible
    fill_in"company_name",with:"AnotherName"
    fill_in"company_email",with:"email@example.com"
    fill_in"company_password",with:"password"
    find("input[value=Update]").click
    expect(Company.where(name:"AnotherName").first).not_tobe_nil
    end
    end
    end
    Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

    [8]ページ先頭

    ©2009-2025 Movatter.jp