Sha256: 7ae956e97e627096cb4e13ce7823ebef5ef4b5624b277a65aa06582c57be1898

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

require  'spec_helper'

PROC = proc { author.reverse }

class BlockAkismetModel
  include Rakismet::Model
  rakismet_attrs :author => PROC
end

describe BlockAkismetModel do

  before do
    @block = BlockAkismetModel.new
    comment_attrs.each_pair { |k,v| @block.stub(k).and_return(v) }
  end

  it "should accept a block" do
    BlockAkismetModel.akismet_attrs[:comment_author].should eql(PROC)
  end

  it "should eval block with self = instance" do
    data = @block.send(:akismet_data)
    data[:comment_author].should eql(comment_attrs[:author].reverse)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rakismet-1.5.4 spec/models/block_params_spec.rb
rakismet-1.5.3 spec/models/block_params_spec.rb
rakismet-1.5.2 spec/models/block_params_spec.rb