Sha256: 7458d45007159f169698b0905b9d6e52c2c6bc3e34c202a96800bbf9578ca697

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

require "spec_helper"

module Refinery
  describe "search" do
    login_refinery_user

    context "when searched item exists" do
      describe "image extension" do
        before(:each) { FactoryGirl.create(:image) }

        it "returns found image" do
          visit refinery.admin_images_path
          fill_in "search", :with => "beach"
          click_button "Search"
          page.should have_selector("img[src*='beach.jpeg']")
        end
      end

      describe "resource extension" do
        before(:each) { FactoryGirl.create(:resource) }

        it "returns found resource" do
          visit refinery.admin_resources_path
          fill_in "search", :with => "refinery"
          click_button "Search"
          page.should have_content("Refinery Is Awesome.txt")
        end
      end

      describe "page extension" do
        before(:each) { FactoryGirl.create(:page, :title => "Ugis Ozols") }

        it "returns found page" do
          visit refinery.admin_pages_path
          fill_in "search", :with => "ugis"
          click_button "Search"
          page.should have_content("Ugis Ozols")
        end
      end
    end

    context "when searched item don't exist" do
      def shared_stuff
        fill_in "search", :with => "yada yada"
        click_button "Search"
        page.should have_content("Sorry, no results found")
      end

      describe "image extension" do
        it "returns no results" do
          visit refinery.admin_images_path
          shared_stuff
        end
      end

      describe "resource extension" do
        it "returns no results" do
          visit refinery.admin_resources_path
          shared_stuff
        end
      end

      describe "page extension" do
        it "returns no results" do
          visit refinery.admin_pages_path
          shared_stuff
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinerycms-core-2.0.5 spec/requests/refinery/search_spec.rb
refinerycms-core-2.0.4 spec/requests/refinery/search_spec.rb
refinerycms-core-2.0.3 spec/requests/refinery/search_spec.rb
refinerycms-core-2.0.2 spec/requests/refinery/search_spec.rb
refinerycms-core-2.0.1 spec/requests/refinery/search_spec.rb
refinerycms-core-2.0.0 spec/requests/refinery/search_spec.rb