Sha256: d6f8cb3cf5da4e2e3b4e3cb94d9d623a6b01c569a450d66dabffb108a4d512f1

Contents?: true

Size: 1.97 KB

Versions: 1

Compression:

Stored size: 1.97 KB

Contents

require "spec_helper"

describe "Collections list", type: :request, js: true do
  before do
    visit "/"

    within("table.databases") { click_link "first_database" }
  end

  xit "displays the breadcrumb" do
    within ".breadcrumbs" do
      within "li:nth-child(1)" do
        expect(page).to have_link("first_database", href: "/databases/first_database/collections")
      end
    end
  end

  describe "click on delete collection button" do
    xit "deletes a collection" do
      click_delete_button_for("second_collection")
      confirm_dialog

      expect(page).to have_flash_message("Collection second_collection has been deleted.")

      within "table.collections" do
        expect(page).to have_link("first_collection")
        expect(page).to_not have_link("second_collection")
        expect(page).to have_link("third_collection")
      end

      click_delete_button_for("first_collection")
      confirm_dialog
      expect(page).to have_flash_message("Collection first_collection has been deleted.")

      within "table.collections" do
        expect(page).to_not have_link("first_collection")
        expect(page).to_not have_link("second_collection")
        expect(page).to have_link("third_collection")
      end

      click_delete_button_for("third_collection")
      confirm_dialog
      expect(page).to have_flash_message("Collection third_collection has been deleted.")

      should_hide_the_table_and_display_a_notification
    end

    xit "displays error message when the collection cannot be deleted" do
      click_delete_button_for("system.indexes")
      confirm_dialog

      expect(page).to have_flash_message("Database command 'drop' failed")

      within "table.collections" do
        expect(page).to have_link("system.indexes")
      end
    end

    def click_delete_button_for(collection_name)
      collection_row = find(:xpath, %Q{//table//tr//*[contains(text(), "#{collection_name}")]/../..})
      within(collection_row) { click_link "Delete" }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_browser-0.2.0.rc2 spec/features/collections_list_spec.rb