Sha256: e14ce1e273d7c50af065e5d3ae0545585d2ae3152d6c92c8978c5444b7716e9f

Contents?: true

Size: 1.53 KB

Versions: 18

Compression:

Stored size: 1.53 KB

Contents

require 'spec_helper'

module Deface
  describe Search do
    include_context "mock Rails.application"

    before(:each) do
      @override = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#index", :replace => "h1",
                                       :text => "<h1>Argh!</h1>")
    end

    describe "#find" do
      it "should find by virtual_path" do
        expect(Deface::Override.find({:virtual_path => "posts/index"}).size).to eq(1)
        expect(Deface::Override.find({:virtual_path => "/posts/index"}).size).to eq(1)
        expect(Deface::Override.find({:virtual_path => "/posts/index.html"}).size).to eq(1)
        expect(Deface::Override.find({:virtual_path => "posts/index.html"}).size).to eq(1)
      end

      it "should return empty array when no details hash passed" do
        expect(Deface::Override.find({})).to eq([])
      end
    end

    describe "#find_using" do
      before do
        @override_partial = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#edit", :replace => "h1",
                                                 :partial => "shared/post")

        @override_template = Deface::Override.new(:virtual_path => "posts/index", :name => "Posts#show", :replace => "h1",
                                                  :template => "shared/person")
      end

      it "should find by virtual_path" do
        expect(Deface::Override.find_using("shared/post").size).to eq(1)
        expect(Deface::Override.find_using("shared/person").size).to eq(1)
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
deface-1.8.2 spec/deface/search_spec.rb
deface-1.8.1 spec/deface/search_spec.rb
deface-1.8.0 spec/deface/search_spec.rb
deface-1.7.0 spec/deface/search_spec.rb
deface-1.6.2 spec/deface/search_spec.rb
deface-1.6.1 spec/deface/search_spec.rb
deface-1.6.0 spec/deface/search_spec.rb
deface-1.5.3 spec/deface/search_spec.rb
deface-1.5.2 spec/deface/search_spec.rb
deface-1.5.1 spec/deface/search_spec.rb
deface-1.5.0 spec/deface/search_spec.rb
deface-1.4.0 spec/deface/search_spec.rb
deface-1.3.2 spec/deface/search_spec.rb
deface-1.3.1 spec/deface/search_spec.rb
deface-1.3.0 spec/deface/search_spec.rb
deface-1.2.0 spec/deface/search_spec.rb
deface-1.1.0 spec/deface/search_spec.rb
deface-1.0.2 spec/deface/search_spec.rb