Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'spec_helper'
  2.  
  3. describe FeaturePool do
  4.   it "creates a new instance given valid attributes" do
  5.     Fabricate :feature_pool
  6.   end
  7.  
  8.   it "is not valid without a name" do
  9.     Fabricate.build(:feature_pool, :name => "").should_not be_valid
  10.   end
  11.  
  12.   describe "#current" do
  13.     it "returns the feature appearance whose position corresponds with #head" do
  14.       pool = Fabricate :populated_feature_pool
  15.       pool.current.featurable.user.name.should == "John Gruber"
  16.     end
  17.  
  18.     it "has some feature appearances" do
  19.       pool = Fabricate :populated_feature_pool
  20.       pool.should have(5).feature_appearances
  21.     end
  22.  
  23.     it "persists its appearances" do
  24.       Fabricate :populated_feature_pool, :name => "foo/bar"
  25.  
  26.       pool = FeaturePool.find_by_name("foo/bar")
  27.       pool.should have(5).feature_appearances
  28.     end
  29.   end
  30. end