Merge pull request #170 from substantial/make_db_seed_idempotent
Make db seed idempotent
This commit is contained in:
commit
bbc6e90939
3 changed files with 17 additions and 5 deletions
1
Gemfile
1
Gemfile
|
@ -29,6 +29,7 @@ group :development, :test do
|
|||
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
||||
gem 'rb-inotify', '>= 0.5.1'
|
||||
gem 'libnotify', '~> 0.1.3'
|
||||
gem 'therubyracer', '~> 0.9.9'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ Refinery::User.find(:all).each do |user|
|
|||
end
|
||||
end if defined?(Refinery::User)
|
||||
|
||||
if defined?(Refinery::Page)
|
||||
if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
|
||||
page = Refinery::Page.create(
|
||||
:title => "Blog",
|
||||
:link_url => "/blog",
|
||||
|
|
|
@ -3,12 +3,23 @@ require 'spec_helper'
|
|||
module Refinery
|
||||
module Blog
|
||||
describe Engine do
|
||||
let(:activity) do
|
||||
Refinery::Plugins.registered.find_by_name("refinerycms_blog").activity.first
|
||||
describe "plugin activity" do
|
||||
let(:activity) do
|
||||
Refinery::Plugins.registered.find_by_name("refinerycms_blog").activity.first
|
||||
end
|
||||
|
||||
it "sets the correct path for activity entries" do
|
||||
activity.url.should eq("edit_refinery_admin_blog_posts_path")
|
||||
end
|
||||
end
|
||||
|
||||
it "sets the correct path for activity entries" do
|
||||
activity.url.should eq("edit_refinery_admin_blog_posts_path")
|
||||
describe ".load_seed" do
|
||||
it "is idempotent" do
|
||||
Refinery::Blog::Engine.load_seed
|
||||
Refinery::Blog::Engine.load_seed
|
||||
|
||||
Refinery::Page.where(:link_url => '/blog').count.should eq(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue