Sha256: 22cfa7c6b1f595386828cfb107c143e91b98776dc4d3dd2543dada1cf6608c64

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

require 'minitest_helper'
require 'impressionist/setup_association'

module Impressionist
  describe SetupAssociation do

    let(:mock)  { Minitest::Mock.new }
    let(:set_up) { SetupAssociation.new(mock) }

    before do
      # expects attr_accessible to return true
      # and pass 11 arguments
      mock.
        expect(:attr_accessible, true) do |args|
          args.size == 11
        end

    end

    describe "attr_accessible" do

      it "includes" do
        set_up.stub :toggle, true do
          set_up.include_attr_acc?.must_equal true

          mock.verify
        end
      end

    end

    describe "belongs_to" do

      it "active_record" do
        mock.expect(:belongs_to, true, [Symbol, Hash])
        set_up.define_belongs_to.must_equal true
      end

    end

    describe "#set" do

      it "sets an association" do
        def set_up.include_attr_acc?; true; end

        set_up.stub(:define_belongs_to, true) {
          set_up.set.must_equal true
        }

      end

    end
    # returns done if thruthy

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
impressionist-1.5.1 tests/spec/setup_association_spec.rb
impressionist-1.4.13 tests/spec/setup_association_spec.rb
impressionist-1.4.12 tests/spec/setup_association_spec.rb
impressionist-1.4.11 tests/spec/setup_association_spec.rb
impressionist-1.4.10 tests/spec/setup_association_spec.rb
impressionist-1.4.9 tests/spec/setup_association_spec.rb