store all data in memory in preperarion for shallow routes
This commit is contained in:
@ -2,6 +2,13 @@ require 'rails_helper'
|
||||
|
||||
module Merged
|
||||
RSpec.describe Card, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
let(:first) {Card.all.values.first}
|
||||
|
||||
it "has Card.all" do
|
||||
expect(Card.all.class).to be Hash
|
||||
end
|
||||
it "has cards" do
|
||||
expect(first.class).to be Card
|
||||
end
|
||||
end
|
||||
end
|
||||
|
17
spec/models/merged/image_spec.rb
Normal file
17
spec/models/merged/image_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
module Merged
|
||||
RSpec.describe Image, type: :model do
|
||||
let(:first) {Image.all.values.first}
|
||||
|
||||
it "has Pages.all" do
|
||||
expect(Image.all.class).to be Hash
|
||||
end
|
||||
it "has image" do
|
||||
expect(first.class).to be Image
|
||||
end
|
||||
it "image has name" do
|
||||
expect(first.name).to eq "large"
|
||||
end
|
||||
end
|
||||
end
|
17
spec/models/merged/page_spec.rb
Normal file
17
spec/models/merged/page_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
module Merged
|
||||
RSpec.describe Page, type: :model do
|
||||
let(:index) {Page.find('index')}
|
||||
|
||||
it "has Pages.all" do
|
||||
expect(Page.all.class).to be Hash
|
||||
end
|
||||
it "has index page" do
|
||||
expect(index.class).to be Page
|
||||
end
|
||||
it "has sections" do
|
||||
expect(index.sections.length).to be 1
|
||||
end
|
||||
end
|
||||
end
|
17
spec/models/merged/section_spec.rb
Normal file
17
spec/models/merged/section_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
module Merged
|
||||
RSpec.describe Section, type: :model do
|
||||
let(:first) {Section.all.values.first}
|
||||
|
||||
it "has Sections.all" do
|
||||
expect(Section.all.class).to be Hash
|
||||
end
|
||||
it "has index page" do
|
||||
expect(first.class).to be Section
|
||||
end
|
||||
it "has sections" do
|
||||
expect(first.cards.length).to be 2
|
||||
end
|
||||
end
|
||||
end
|
@ -1,7 +1,7 @@
|
||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||
require 'spec_helper'
|
||||
ENV['RAILS_ENV'] ||= 'test'
|
||||
require_relative '../config/environment'
|
||||
require_relative '../test/dummy/config/environment'
|
||||
# Prevent database truncation if the environment is production
|
||||
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
||||
require 'rspec/rails'
|
||||
|
Reference in New Issue
Block a user