Sha256: eec18e2b6460fb8574b25a594d459677792584fc32ca7de03fb49100c3a64fa5

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

require 'spec_helper'
require 'ronin/db/url_scheme'

describe Ronin::DB::URLScheme do
  it "must use the 'ronin_url_schemes' table" do
    expect(described_class.table_name).to eq('ronin_url_schemes')
  end

  let(:name) { 'http' }

  describe "validations" do
    describe "name" do
      subject { described_class.new(name: 'http') }

      it "must require a name attribute" do
        url_scheme = described_class.new
        expect(url_scheme).to_not be_valid
        expect(url_scheme.errors[:name]).to eq(
          ["can't be blank"]
        )

        url_scheme = described_class.new(name: name)
        expect(url_scheme).to be_valid
      end

      it "msst require a unique name" do
        described_class.create(name: name)

        url_scheme = described_class.new(name: name)
        expect(url_scheme).to_not be_valid
        expect(url_scheme.errors[:name]).to eq(
          ["has already been taken"]
        )

        described_class.destroy_all
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-db-activerecord-0.1.0.beta1 spec/url_scheme_spec.rb