Sha256: 5c7b210a5c2c8b9976f40db5835f9f2f516d48eff8e04364f02c91afbb3344f9
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
require 'spec_helper' unless ActiveRecord::Migration.table_exists? :my_structureables ActiveRecord::Migration.create_table :my_structureables do |t| t.string :name end end describe Navable do before do class MyStructureable < ActiveRecord::Base attr_accessible :name is_structureable( ancestor_class_names: %w(MyStructureable), descendant_class_names: %w(MyStructureable Group User Workflow Page) ) is_navable end @my_structureable = MyStructureable.create( name: "My Structureable" ) end describe "#navable_children" do before do @workflow = create(:workflow) @user = create(:user) @page = create(:page) @group = create(:group) @my_structureable.child_users << @user @my_structureable.child_pages << @page @my_structureable.child_groups << @group @my_structureable.child_workflows << @workflow end subject { @my_structureable.navable_children } specify "prerequisites" do @my_structureable.children.should include @user, @page, @group, @workflow end it "should include only navable children" do subject.each do |child| child.should respond_to :nav_node end end it "should include pages, users and groups" do subject.should include @page, @user, @group end # TODO: Maybe, later, Workflow objects become navables. # Then, this spec has to be changed accordingly. it "should not include workflows" do subject.should_not include @workflow end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
your_platform-1.0.1 | spec/models/navable_spec.rb |
your_platform-1.0.0 | spec/models/navable_spec.rb |
your_platform-0.0.2 | spec/models/navable_spec.rb |