Sha256: cda1d20b399ecc649351910772f18133b16cd3c3c3bc92998d07981eb38a3428

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 Bytes

Contents

require "spec_helper"

RSpec.describe JamJar do
  describe "#model" do
    subject { JamJar.model }

    specify { expect_it.to be < ActiveRecord::Base }
    specify { expect_it.to be_connected }

    context "with block" do
      subject { JamJar.model { def self.a; true; end } }

      specify { expect(subject.a).to be_truthy }
    end

    context "with columns" do
      subject { JamJar.model { column :foo, :string } }

      specify { expect(subject.new).to respond_to(:foo) }

      context "with options" do
        subject { JamJar.model { column :foo, :string, default: "bar" } }
        
        specify { expect(subject.new.foo).to eq "bar" }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jamjar-1.2.0 spec/jamjar_spec.rb