Sha256: 51460405c8841001699cc5fdfcc832a67241d5852fa1ba8e257d40a7158ec239

Contents?: true

Size: 983 Bytes

Versions: 10

Compression:

Stored size: 983 Bytes

Contents

require 'spec_helper'

extended = ActiveRecord::Base.extend(Neutral::Model::ActiveRecordExtension)

class Item < extended
  neutral
end

class Client < extended
  neutral_voter
end

describe Item, type: :model do
  it { should be_a(Neutral::Model::ActiveRecordExtension::Voteable) }

  before do
    @migration = ActiveRecord::Migration.new
    @migration.verbose = false
    @migration.create_table(:items)
  end

  after do
    @migration.drop_table(:items)
  end

  describe "#neutral" do
    it { should have_many(:votes) }
    it { should have_many(:voters) }
    it { should have_one(:voting) }
  end
end

describe Client, type: :model do
  it { should be_a(Neutral::Model::ActiveRecordExtension::Voter) }

  before do
    @migration = ActiveRecord::Migration.new
    @migration.verbose = false
    @migration.create_table(:clients)
  end

  after do
    @migration.drop_table(:clients)
  end

  describe "#neutral_voter" do
    it { should have_many(:votes_given) }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
neutral-0.0.10 spec/models/active_record_extension_spec.rb
neutral-0.0.9 spec/models/active_record_extension_spec.rb
neutral-0.0.8 spec/models/active_record_extension_spec.rb
neutral-0.0.7 spec/models/active_record_extension_spec.rb
neutral-0.0.6 spec/models/active_record_extension_spec.rb
neutral-0.0.5 spec/models/active_record_extension_spec.rb
neutral-0.0.4 spec/models/active_record_extension_spec.rb
neutral-0.0.3 spec/models/active_record_extension_spec.rb
neutral-0.0.2 spec/models/active_record_extension_spec.rb
neutral-0.0.1 spec/models/active_record_extension_spec.rb