Sha256: a3aee91488172794015ac5bceb5969086bd0b545a822ed166d76055b9a34fbe7

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

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

describe NotOnlyButAlso do

  before do
    Object.send(:remove_const, :Post)    if Object.const_defined?(:Post)
    Object.send(:remove_const, :Comment) if Object.const_defined?(:Comment)
    ActiveSupport::Dependencies.loaded = []
  end

  it 'should include only named context' do
    Post.class_eval do
      also_has :validations
    end
    Post.should respond_to(:test_validation_method)
    Post.should_not respond_to(:test_stuff_method)
  end

  it 'should include all named contexts' do
    Post.class_eval do
      also_has :validations, :stuff
    end
    Post.should respond_to(:test_validation_method)
    Post.should respond_to(:test_stuff_method)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
not_only_but_also-0.2.0 spec/not_only_but_also_spec.rb
not_only_but_also-0.1.0 spec/not_only_but_also_spec.rb