Sha256: 066983f5613dc3bd00aa0eeb7f449eac0a19ba3f955aa45fd66334b01e15b81c

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 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
        Deface::Override.find({:virtual_path => "posts/index"}).size.should == 1
        Deface::Override.find({:virtual_path => "/posts/index"}).size.should == 1
        Deface::Override.find({:virtual_path => "/posts/index.html"}).size.should == 1
        Deface::Override.find({:virtual_path => "posts/index.html"}).size.should == 1
      end

      it "should return empty array when no details hash passed" do
        Deface::Override.find({}).should == []
      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
        Deface::Override.find_using("shared/post").size.should == 1
        Deface::Override.find_using("shared/person").size.should == 1
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/deface-1.0.1/spec/deface/search_spec.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/deface-1.0.1/spec/deface/search_spec.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/deface-1.0.1/spec/deface/search_spec.rb
deface-1.0.1 spec/deface/search_spec.rb
deface-1.0.0 spec/deface/search_spec.rb
deface-1.0.0.rc4 spec/deface/search_spec.rb
deface-1.0.0.rc3 spec/deface/search_spec.rb
deface-1.0.0.rc2 spec/deface/search_spec.rb
deface-1.0.0.rc1 spec/deface/search_spec.rb
deface-0.9.1 spec/deface/search_spec.rb
deface-0.9.0 spec/deface/search_spec.rb