Sha256: 69234ce1bd7dbd5fac40dd8b26b2c071df8cee24eafe288e070b3a6d31b0f0b8

Contents?: true

Size: 1.2 KB

Versions: 18

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe Volt::ViewScope do
  describe "methodize strings" do
    def methodize(str)
      Volt::ViewScope.methodize_string(str)
    end

    it 'should methodize a method without args' do
      code = methodize('something')
      expect(code).to eq('method(:something)')
    end

    it 'should methodize a method without args2' do
      code = methodize('something?')
      expect(code).to eq('method(:something?)')
    end

    it 'should methodize a method wit args1' do
      code = methodize('set_something(true)')
      expect(code).to eq('set_something(true)')
    end

    it 'should not methodize a method call with args' do
      code = methodize('something(item1, item2)')
      expect(code).to eq('something(item1, item2)')
    end

    it 'should not methodize on assignment' do
      code = methodize('params._something = 5')
      expect(code).to eq('params._something = 5')
    end

    it 'should not methodize on hash lookup' do
      code = methodize('hash[:something]')
      expect(code).to eq('hash[:something]')
    end

    it 'should not methodize on instance variables' do
      code = methodize('@something.call')
      expect(code).to eq('@something.call')
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
volt-0.9.7.pre8 spec/server/html_parser/view_scope_spec.rb
volt-0.9.7.pre7 spec/server/html_parser/view_scope_spec.rb
volt-0.9.7.pre6 spec/server/html_parser/view_scope_spec.rb
volt-0.9.7.pre5 spec/server/html_parser/view_scope_spec.rb
volt-0.9.7.pre3 spec/server/html_parser/view_scope_spec.rb
volt-0.9.7.pre2 spec/server/html_parser/view_scope_spec.rb
volt-0.9.6 spec/server/html_parser/view_scope_spec.rb
volt-0.9.6.pre3 spec/server/html_parser/view_scope_spec.rb
volt-0.9.6.pre2 spec/server/html_parser/view_scope_spec.rb
volt-0.9.6.pre1 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre12 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre11 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre9 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre8 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre7 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre6 spec/server/html_parser/view_scope_spec.rb
volt-0.9.5.pre5 spec/server/html_parser/view_scope_spec.rb