Skip to content

Commit

Permalink
Add failing spec
Browse files Browse the repository at this point in the history
Ref: #142
  • Loading branch information
tagliala committed Mar 20, 2022
1 parent acae541 commit fafc390
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/chrono_model/time_machine/as_of_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
it { expect(Foo.as_of($t.foo.ts[1]).includes(:bars).first.bars).to eq [] }
it { expect(Foo.as_of($t.foo.ts[2]).includes(:bars).first.bars).to eq [$t.bar] }

it { expect(Foo.as_of($t.foo.ts[0]).includes(:goo).first).to eq $t.foo }

it { expect(Foo.as_of($t.bar.ts[0]).includes(:bars).first.bars.first.name).to eq 'bar' }
it { expect(Foo.as_of($t.bar.ts[1]).includes(:bars).first.bars.first.name).to eq 'foo bar' }
it { expect(Foo.as_of($t.bar.ts[2]).includes(:bars).first.bars.first.name).to eq 'bar bar' }
Expand Down
13 changes: 13 additions & 0 deletions spec/support/time_machine/structure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ module ChronoTest::TimeMachine
adapter.create_table 'foos', :temporal => true do |t|
t.string :name
t.integer :fooity
t.references :goo
end

class ::Foo < ActiveRecord::Base
include ChronoModel::TimeMachine

has_many :bars
has_many :sub_bars, :through => :bars

belongs_to :goo, class_name: 'FooGoo', optional: true
end

class ::FooGoo < ActiveRecord::Base
include ChronoModel::TimeGate

has_many :foos, inverse_of: :goo
end

class ::Boo < ActiveRecord::Base
Expand Down Expand Up @@ -61,6 +70,10 @@ class ::Moo < ActiveRecord::Base
t.references :boo
end

adapter.create_table 'foo_goos' do |t|
t.string :name
end


class ::Bar < ActiveRecord::Base
include ChronoModel::TimeMachine
Expand Down

0 comments on commit fafc390

Please sign in to comment.