Permalink
Browse files

Test-Script added

  • Loading branch information...
1 parent dfedc34 commit 2cb683ab212355cb4aa302f85f62e2bb9a2e679e @koa committed Apr 27, 2011
Showing with 83 additions and 1 deletion.
  1. +4 −0 readme.md
  2. +1 −1 refinerycms-multisite.gemspec
  3. +18 −0 script/test.sh
  4. +60 −0 spec/Patch_projectzero_for_working_with_refinerycms.patch
View
@@ -0,0 +1,4 @@
+## Simple Multisite-Plugin for refinery-cms
+
+## How to test
+call script/test.sh
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "shoulda-matchers"
- s.files = `git ls-files`.split("\n")
+ s.files = `git ls-files | grep -v ^script`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
View
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+PROJECTZERO=git://github.com/panter/project_zero.git
+
+cd "$(dirname "$0")/.."
+CURRENTPROJECT="$(pwd)"
+
+cd /tmp
+
+rm -rf rickrockstar
+
+git clone "$PROJECTZERO" rickrockstar
+cd rickrockstar
+rvm gemset clear
+echo "gem 'refinerycms-multisite', :git=>'file://$CURRENTPROJECT'">>Gemfile
+. script/init_refinery Rickrockstar
+patch -p0 <"$CURRENTPROJECT/spec/Patch_projectzero_for_working_with_refinerycms.patch"
+rake spec
@@ -0,0 +1,60 @@
+Index: spec/factories.rb
+===================================================================
+--- spec/factories.rb (date 1303883535000)
++++ spec/factories.rb (revision )
+@@ -1,3 +1,20 @@
+ Factory.define :post do |f|
+ f.title 'Post title'
+ end
++
++Factory.define :user do |u|
++ u.sequence(:username) { |n| "person#{n}" }
++ u.sequence(:email) { |n| "person#{n}@example.com" }
++ u.password "greenandjuicy"
++ u.password_confirmation "greenandjuicy"
++end
++
++Factory.define :refinery_user, :parent => :user do |u|
++ u.roles { [ Role[:refinery] ] }
++
++ u.after_create do |user|
++ Refinery::Plugins.registered.each_with_index do |plugin, index|
++ user.plugins.create(:name => plugin.name, :position => index)
++ end
++ end
++end
+\ No newline at end of file
+Index: spec/acceptance/post_create_spec.rb
+===================================================================
+--- spec/acceptance/post_create_spec.rb (date 1303883535000)
++++ spec/acceptance/post_create_spec.rb (revision )
+@@ -6,6 +6,7 @@
+ } do
+
+ scenario "should create new post" do
++ Factory.create(:refinery_user)
+ post = Factory.build(:post)
+ visit '/posts/new'
+
+@@ -19,6 +20,7 @@
+ end
+
+ scenario "should show post index" do
++ Factory.create(:refinery_user)
+ attributes = Factory.attributes_for(:post)
+ Post.create!(attributes)
+
+Index: spec/controllers/posts_controller_spec.rb
+===================================================================
+--- spec/controllers/posts_controller_spec.rb (date 1303883535000)
++++ spec/controllers/posts_controller_spec.rb (revision )
+@@ -1,7 +1,8 @@
+ require 'spec_helper'
+
+ describe PostsController do
+-
++ include Devise::TestHelpers
++ before(:each){Factory.create(:refinery_user)}
+ context 'GET on new' do
+ before(:each) { get :new }
+ it 'assigns a new post record' do

0 comments on commit 2cb683a

Please sign in to comment.