Sha256: d966215f0534ed6a6230889f0263def7938da32c6aa6dc32c9023a5cc9e11bde

Contents?: true

Size: 1.33 KB

Versions: 11

Compression:

Stored size: 1.33 KB

Contents

# Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require 'spec_helper'

describe EntitiesController do

  describe "parse_query_and_tags" do
  
    it "should parse empty string" do
      str = ""
      controller.send(:parse_query_and_tags, str).should == ['', '']
    end
  
    it "should parse #tags" do
      str = "#test"
      controller.send(:parse_query_and_tags, str).should == ['', 'test']
    end
    
    it "should parse no tags" do
      str = "test query"
      controller.send(:parse_query_and_tags, str).should == ['test query', '']
    end
    
    it "should parse tags and query" do
      str = "#real Billy Bones #pirate"
      controller.send(:parse_query_and_tags, str).should == [ "Billy Bones", "real, pirate" ]
    end

    it "should parse strange characters" do
      str = "#this is #a test !@$%^~ #parseme"
      controller.send(:parse_query_and_tags, str).should == ['is test !@$%^~', 'this, a, parseme']
    end
    
    it "should strip whitespace" do
      str = "     test    me    "
      controller.send(:parse_query_and_tags, str).should == ['test me', '']
    end

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fat_free_crm-0.13.6 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.5 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.4 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.3 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.12.3 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.12.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.1 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.12.1 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.13.0 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.12.0 spec/controllers/entities_controller_spec.rb