Sha256: fd233cb4880661289c353012cc83bb3be140ff44466af09b5b2e279cdce8f357

Contents?: true

Size: 1.33 KB

Versions: 15

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 = ""
      expect(controller.send(:parse_query_and_tags, str)).to eq(['', ''])
    end

    it "should parse #tags" do
      str = "#test"
      expect(controller.send(:parse_query_and_tags, str)).to eq(['', 'test'])
    end

    it "should parse no tags" do
      str = "test query"
      expect(controller.send(:parse_query_and_tags, str)).to eq(['test query', ''])
    end

    it "should parse tags and query" do
      str = "#real Billy Bones #pirate"
      expect(controller.send(:parse_query_and_tags, str)).to eq(["Billy Bones", "real, pirate"])
    end

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

    it "should strip whitespace" do
      str = "     test    me    "
      expect(controller.send(:parse_query_and_tags, str)).to eq(['test me', ''])
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
fat_free_crm-0.14.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.15.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.16.4 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.14.1 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.15.1 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.16.3 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.16.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.16.1 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.16.0 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.15.0 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.15.0.beta.2 spec/controllers/entities_controller_spec.rb
fat_free_crm-0.15.0.beta spec/controllers/entities_controller_spec.rb
fat_free_crm-0.14.0 spec/controllers/entities_controller_spec.rb
reduced_fat_crm-0.15.0.beta spec/controllers/entities_controller_spec.rb
reduced_fat_crm-0.14.0 spec/controllers/entities_controller_spec.rb