Sha256: 1fd8c82de3ceaaf7f149e1c266ebd7f20870a64583e6dc7c89bb4be9a62ccd68

Contents?: true

Size: 1006 Bytes

Versions: 5

Compression:

Stored size: 1006 Bytes

Contents

require 'model/spec_helper'
require 'model/models/licensed_model'

require 'ronin/model/has_license'

describe Model::HasLicense do
  subject { LicensedModel }

  before(:all) do
    subject.auto_migrate!
  end

  it "should define a license relationship" do
    relationship = subject.relationships['license']

    relationship.should_not be_nil
    relationship.parent_model.should == License
  end

  it "should define relationships with License" do
    relationship = License.relationships['licensed_models']
    
    relationship.should_not be_nil
    relationship.child_model.should == subject
  end

  it "should have a license" do
    model = subject.create!(
      :content => 'bla',
      :license => License.gpl2
    )

    model.license.should == License.gpl2
  end

  it "should provide helper methods for querying licensed models" do
    model = subject.create!(
      :content => 'stuff here',
      :license => License.gpl2
    )

    subject.licensed_under(:gpl2).first == model
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ronin-1.0.0.rc1 spec/model/has_license_spec.rb
ronin-1.0.0.pre4 spec/model/has_license_spec.rb
ronin-1.0.0.pre3 spec/model/has_license_spec.rb
ronin-1.0.0.pre2 spec/model/has_license_spec.rb
ronin-1.0.0.pre1 spec/model/has_license_spec.rb