Sha256: 54ddf3f5a9f3454acebed56cf298bbc1f62da871a201b4c64c5c85151b1e2c49

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Mongoid::Activity do
  before(:each) do
    @task = Task.new
  end
  
  describe "not saved" do
    it "should be activable" do
      @task.activate!
      @task.active?.should be_true
    end
  
    it "should be deactivable" do
      @task.activate!
      @task.deactivate!
      @task.inactive?.should be_true
    end
  end
    
  describe "saved" do
    before(:each) do
      @task.save
    end
    
    it "should be activable" do
      @task.activate!
      @task.active?.should be_true
    end
  
    it "should be deactivable" do
      @task.activate!
      @task.deactivate!
      @task.inactive?.should be_true
    end
    
    it "should have a active scope" do
      @task.activate!
      Task.active.first.should == @task
    end
        
    it "should have a inactive scope" do
      @task.deactivate!
      Task.inactive.first.should == @task
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_activity-0.0.2 spec/mongoid_activity_spec.rb