Sha256: 17a45cf47cff5a74f46d3dec98d23606067a37fc9f1cf26682cfa0c61bc3a25b

Contents?: true

Size: 1 KB

Versions: 9

Compression:

Stored size: 1 KB

Contents

require_relative "../spec_helper"

describe "Exporting Methods" do
    include TestingModels

    around(:each) do |example|
        with_testing_models do
            example.run
        end
    end

    it 'can use simple delegation' do

        expect(TestModel.new).to_not respond_to(:bt_description)

        TestModel.send :delegate_and_export, "bt_description"

        md = TestModel.new
        expect(md).to respond_to(:bt_description)
        expect(md.bt_description).to be_nil
        md.build_bt( description: "test123")
        expect(md.bt_description).to eq("test123")

        expect(TestModel.has_exported_method?( :bt_description, nil )).to be(true)
    end

    def test_dependancy_calculation
        TestModel.send :delegate_and_export, "bt_description"
        TestModel.send :delegate_and_export, "bt_notes", optional: false
        expect(TestModel.exported_method_dependancies([])).to include(:bt)
        expect(TestModel.exported_method_dependancies(['bt_description'])).to include(:bt)
    end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hippo-fw-0.9.9 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.8 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.7 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.6 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.5 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.4 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.3 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.2 spec/server/concerns/export_methods_spec.rb
hippo-fw-0.9.1 spec/server/concerns/export_methods_spec.rb