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
|
if RbConfig::CONFIG['target_os'] =~ /linux/i
|
||||||
gem 'rb-inotify', '>= 0.5.1'
|
gem 'rb-inotify', '>= 0.5.1'
|
||||||
gem 'libnotify', '~> 0.1.3'
|
gem 'libnotify', '~> 0.1.3'
|
||||||
|
gem 'therubyracer', '~> 0.9.9'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@ Refinery::User.find(:all).each do |user|
|
||||||
end
|
end
|
||||||
end if defined?(Refinery::User)
|
end if defined?(Refinery::User)
|
||||||
|
|
||||||
if defined?(Refinery::Page)
|
if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
|
||||||
page = Refinery::Page.create(
|
page = Refinery::Page.create(
|
||||||
:title => "Blog",
|
:title => "Blog",
|
||||||
:link_url => "/blog",
|
:link_url => "/blog",
|
||||||
|
|
|
@ -3,12 +3,23 @@ require 'spec_helper'
|
||||||
module Refinery
|
module Refinery
|
||||||
module Blog
|
module Blog
|
||||||
describe Engine do
|
describe Engine do
|
||||||
let(:activity) do
|
describe "plugin activity" do
|
||||||
Refinery::Plugins.registered.find_by_name("refinerycms_blog").activity.first
|
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
|
end
|
||||||
|
|
||||||
it "sets the correct path for activity entries" do
|
describe ".load_seed" do
|
||||||
activity.url.should eq("edit_refinery_admin_blog_posts_path")
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue