spec/models/pic_gallery_spec.rb in mokio-0.0.11 vs spec/models/pic_gallery_spec.rb in mokio-0.0.12
- old
+ new
@@ -23,81 +23,84 @@
# gmap_id :integer
#
require 'spec_helper'
-describe PicGallery do
+module Mokio
- describe 'defaults' do
- before(:each) do
- @gallery = PicGallery.new
- end
+ describe PicGallery do
- it 'has PicGallery type' do
- @gallery.type.should == "PicGallery"
- end
+ describe 'defaults' do
+ before(:each) do
+ @gallery = PicGallery.new
+ end
- it 'is invalid without title' do
- @gallery.should_not be_valid
- end
+ it 'has PicGallery type' do
+ @gallery.type.should == "Mokio::PicGallery"
+ end
- #
- # default added PicGallery have to have this values
- #
- it 'is editable' do
- @gallery.editable.should == true
- end
+ it 'is invalid without title' do
+ @gallery.should_not be_valid
+ end
- it 'is deletable' do
- @gallery.deletable.should == true
- end
+ #
+ # default added PicGallery have to have this values
+ #
+ it 'is editable' do
+ @gallery.editable.should == true
+ end
- it 'is active' do
- @gallery.active.should == true
- end
- end
+ it 'is deletable' do
+ @gallery.deletable.should == true
+ end
- describe 'associations and inheritance' do
- #
- # PicGallery < Content
- #
- it 'is Content child' do
- expect(subject).to be_a_kind_of Content
+ it 'is active' do
+ @gallery.active.should == true
+ end
end
- it "should have many data_files" do
- association = PicGallery.reflect_on_association(:data_files)
- association.macro.should == :has_many
- end
+ describe 'associations and inheritance' do
+ #
+ # PicGallery < Content
+ #
+ it 'is Content child' do
+ expect(subject).to be_a_kind_of Content
+ end
- it "should have many menus" do
- association = PicGallery.reflect_on_association(:menus)
- association.macro.should == :has_many
+ it "should have many data_files" do
+ association = PicGallery.reflect_on_association(:data_files)
+ association.macro.should == :has_many
+ end
+
+ it "should have many menus" do
+ association = PicGallery.reflect_on_association(:menus)
+ association.macro.should == :has_many
+ end
+
+ it "should have many content_links" do
+ association = PicGallery.reflect_on_association(:content_links)
+ association.macro.should == :has_many
+ end
end
- it "should have many content_links" do
- association = PicGallery.reflect_on_association(:content_links)
- association.macro.should == :has_many
+ it 'has default_data_file saved as model reference' do
+ gallery = PicGallery.new
+ gallery.default_data_file.should_not == "Photo"
+ gallery.default_data_file.should == Photo
end
- end
- it 'has default_data_file saved as model reference' do
- gallery = PicGallery.new
- gallery.default_data_file.should_not == "Photo"
- gallery.default_data_file.should == Photo
- end
+ describe 'data_files' do
+ it 'saves association with data_file' do
+ gallery = PicGallery.new(:title => "test")
+ gallery.data_files.build(data_file: "test.png", name: "Test")
+ gallery.save!
+ expect(DataFile).to have(1).records
+ end
- describe 'data_files' do
- it 'saves association with data_file' do
- gallery = PicGallery.new(:title => "test")
- gallery.data_files.build(data_file: "test.png", name: "Test")
- gallery.save!
- expect(DataFile).to have(1).records
+ it 'does not save association without data_file' do
+ content = PicGallery.new(:title => "test")
+ content.save!
+ expect(DataFile).to have(0).records
+ end
end
-
- it 'does not save association without data_file' do
- content = PicGallery.new(:title => "test")
- content.save!
- expect(DataFile).to have(0).records
- end
end
-end
+end
\ No newline at end of file