Sha256: f42443f9339b65624920e7fc227c0fe0f2868c5be25726e69d65431080da43fa
Contents?: true
Size: 764 Bytes
Versions: 2
Compression:
Stored size: 764 Bytes
Contents
require 'spec_no_rails_helper' require 'pubdraft' class CreateTestData < ActiveRecord::Migration unless table_exists?('fake_things') create_table :fake_things do |t| t.string :state end end end class FakeThing < ActiveRecord::Base pubdraft end describe Pubdraft do before { @class = FakeThing } it "defaults to published state" do obj = @class.create! obj.should be_published end it "changes states" do obj = @class.create! obj.draft! obj.should be_drafted obj.publish! obj.should be_published end it "has scopes" do published = @class.create! drafted = @class.create!(:state => 'drafted') @class.published.should == [published] @class.drafted.should == [drafted] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pubdraft-0.0.2 | spec/pubdraft_spec.rb |
pubdraft-0.0.1 | spec/pubdraft_spec.rb |