Skip to content

Instantly share code, notes, and snippets.

@keating
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save keating/50ba6138d3d1ac4334c8 to your computer and use it in GitHub Desktop.

Select an option

Save keating/50ba6138d3d1ac4334c8 to your computer and use it in GitHub Desktop.

Revisions

  1. keating revised this gist Jul 11, 2014. 1 changed file with 49 additions and 21 deletions.
    70 changes: 49 additions & 21 deletions sample.rb
    Original file line number Diff line number Diff line change
    @@ -1,32 +1,60 @@
    describe "Dev Admin can download Visit's images" do
    describe "Admin see company list" do
    subject {page}

    describe "when there are no companies" do
    before do
    set_up_complete_dataset_similar_to_seed
    @admin = FactoryGirl.create(:developer_admin)
    admin_login(@admin)
    user_decides_to_manage_company(@company)
    end

    it "can download some of them", js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#download_selection')
    it "displays an empty company list" do
    expect(page).to have_link("New Company")
    expect(page).to have_link("View History")
    within("table#companytable") do
    expect(page).to have_selector('thead')
    expect(page).to have_selector('tbody tr', maximum: 0)
    end
    within('table#companytable thead') do
    expect(page).to have_text "LOGO"
    expect(page).to have_text "NAME"
    expect(page).to have_text "USERNAME"
    expect(page).to have_text "ACTION"
    end
    check('is_tagged', match: :first)
    zip_file_with_selected_image_should_exist
    end
    end

    it "can download all of them",js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#download_all')
    end
    click_link('Download All')
    zip_file_should_exist
    describe "when there are companies" do
    before do
    @admin = FactoryGirl.create(:admin_with_companies_with_company_user)
    admin_login(@admin)
    end

    it "can save them in his dropbox account", js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#dropbox-btn')
    it "displays the company list" do
    expect(page).to have_link("View History")
    within("table#companytable") do
    expect(page).to have_selector('thead')
    expect(page).to have_selector('tbody tr', count: 2)
    end
    within("table#companytable tbody") do
    expect(page).to have_text('company_', count: 2)
    expect(page).to have_selector('a.btn', text: "Manage", count: 2)
    end
    end

    it "can see the company detail in a form", js: true do
    visit_company_show_page
    find("form#admin_form").should be_visible
    end

    it "can update the company information", js: true, driver: :poltergeist do
    visit_company_show_page
    find("form#admin_form").should be_visible
    fill_in "company_name", with: "AnotherName"
    fill_in "company_email", with: "[email protected]"
    fill_in "company_password", with: "password"
    find("input[value=Update]").click

    expect(Company.where(name: "AnotherName").first).not_to be_nil
    end
    end
    end
    end
  2. keating renamed this gist Jul 11, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. keating created this gist Jul 11, 2014.
    32 changes: 32 additions & 0 deletions sample
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    describe "Dev Admin can download Visit's images" do
    before do
    set_up_complete_dataset_similar_to_seed
    admin_login(@admin)
    user_decides_to_manage_company(@company)
    end

    it "can download some of them", js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#download_selection')
    end
    check('is_tagged', match: :first)
    zip_file_with_selected_image_should_exist
    end

    it "can download all of them",js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#download_all')
    end
    click_link('Download All')
    zip_file_should_exist
    end

    it "can save them in his dropbox account", js: true do
    user_decides_to_export_visit_images
    within(:css, 'div#visit_export') do
    expect(page).to have_css('#dropbox-btn')
    end
    end
    end