Sha256: cd6a21ef163123b7bb373927aae70782d6bf5e70ab4cd1cada2cab72fa084224

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper')

describe 'method call matcher' do    
  context "content without method call" do
    not_call = %q{
        def hello
        end}    
    
    it "should not have call hello" do            
      not_call.should_not have_call :hello do |content|
        puts content
      end
    end
  end
  
  context "content with call hello" do  
    call = 'hello'
    it "should have call to hello" do            
      call.should have_call :hello do |content|
        puts "content: #{content}"
      end
    end
  end
  
  context "content with call hello" do  
    call = %q{
      def hello
        x.hello
      end}
    it "should have call to hello" do            
      call.should have_dot_call :hello do |content|
        puts "content: #{content}"
      end
    end
  end  
  context "class User with call role_strategy" do    
    clazz = %q{
  class User < ActiveRecord::Base  
    include RoleModels::Generic 
    role_strategy :admin_flag

    roles :admin,:user

          end}

    it "should have call to role_strategy with args :admin_flag" do            
      call.should have_call :role_strategy, :args => ':admin_flag' do |content|
        puts "content: #{content}"
      end
    end
  end
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generator-spec-0.5.0 spec/generator_spec/matchers/content/have_call_spec.rb