aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorUģis Ozols <ugis.ozolss@gmail.com>2011-08-03 13:54:07 +0300
committerUģis Ozols <ugis.ozolss@gmail.com>2011-08-03 13:54:07 +0300
commitfddcebd878a03f579bb3c1a3265fa9cc9ef427c0 (patch)
tree1f4a20daf9e6251aad23223da70aa3aea70ce66d /spec
parent476ad3f15810455fd40cc8374af1a253471b296c (diff)
downloadrefinerycms-blog-fddcebd878a03f579bb3c1a3265fa9cc9ef427c0.tar.gz
refinerycms-blog-fddcebd878a03f579bb3c1a3265fa9cc9ef427c0.tar.bz2
refinerycms-blog-fddcebd878a03f579bb3c1a3265fa9cc9ef427c0.zip
Make those specs green again.
Diffstat (limited to 'spec')
-rw-r--r--spec/models/refinery/blog_category_spec.rb1
-rw-r--r--spec/models/refinery/blog_comment_spec.rb1
-rw-r--r--spec/models/refinery/blog_post_spec.rb1
-rw-r--r--spec/requests/blog_categories_spec.rb6
-rw-r--r--spec/requests/blog_posts_spec.rb6
-rw-r--r--spec/requests/manage_blog_posts_spec.rb11
-rw-r--r--spec/support/refinery/factories/blog_categories.rb3
-rw-r--r--spec/support/refinery/factories/blog_comments.rb6
-rw-r--r--spec/support/refinery/factories/blog_posts.rb7
9 files changed, 19 insertions, 23 deletions
diff --git a/spec/models/refinery/blog_category_spec.rb b/spec/models/refinery/blog_category_spec.rb
index 9a6e2e4..9c92d14 100644
--- a/spec/models/refinery/blog_category_spec.rb
+++ b/spec/models/refinery/blog_category_spec.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
module Refinery
describe BlogCategory do
diff --git a/spec/models/refinery/blog_comment_spec.rb b/spec/models/refinery/blog_comment_spec.rb
index 455ea4a..5337958 100644
--- a/spec/models/refinery/blog_comment_spec.rb
+++ b/spec/models/refinery/blog_comment_spec.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
module Refinery
describe BlogComment do
diff --git a/spec/models/refinery/blog_post_spec.rb b/spec/models/refinery/blog_post_spec.rb
index deb1409..d5000f1 100644
--- a/spec/models/refinery/blog_post_spec.rb
+++ b/spec/models/refinery/blog_post_spec.rb
@@ -1,5 +1,4 @@
require 'spec_helper'
-Dir[File.expand_path('../../../features/support/factories/*.rb', __FILE__)].each{|factory| require factory}
module Refinery
describe BlogPost do
diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb
index d0682b6..2ba5f82 100644
--- a/spec/requests/blog_categories_spec.rb
+++ b/spec/requests/blog_categories_spec.rb
@@ -1,11 +1,7 @@
require "spec_helper"
describe "blog categories" do
- before(:all) do
- # destroy all existing (if any) users before creating new one
- Refinery::User.destroy_all
- Factory(:refinery_user)
- end
+ login_refinery_user
before(:each) do
@blog_post = Factory(:blog_post, :title => "Refinery CMS blog post")
diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb
index 284bd07..e7ab573 100644
--- a/spec/requests/blog_posts_spec.rb
+++ b/spec/requests/blog_posts_spec.rb
@@ -1,11 +1,7 @@
require "spec_helper"
describe "blog" do
- before(:all) do
- # destroy all existing (if any) users before creating new one
- Refinery::User.destroy_all
- Factory(:refinery_user)
- end
+ login_refinery_user
it "displays the blog rss feed" do
get blog_rss_feed_path
diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb
index 2e44c53..724cc59 100644
--- a/spec/requests/manage_blog_posts_spec.rb
+++ b/spec/requests/manage_blog_posts_spec.rb
@@ -1,16 +1,7 @@
require "spec_helper"
describe "manage blog posts" do
- # TODO: share this with other request specs
- before(:each) do
- Factory(:refinery_user, :username => "refinerycms",
- :password => "123456",
- :password_confirmation => "123456")
- visit new_refinery_user_session_url
- fill_in "Login", :with => "refinerycms"
- fill_in "Password", :with => "123456"
- click_button "Sign in"
- end
+ login_refinery_user
let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") }
diff --git a/spec/support/refinery/factories/blog_categories.rb b/spec/support/refinery/factories/blog_categories.rb
new file mode 100644
index 0000000..c3701dd
--- /dev/null
+++ b/spec/support/refinery/factories/blog_categories.rb
@@ -0,0 +1,3 @@
+Factory.define :blog_category, :class => 'refinery/blog_category' do |f|
+ f.sequence(:title) { |n| "Shopping #{n}" }
+end
diff --git a/spec/support/refinery/factories/blog_comments.rb b/spec/support/refinery/factories/blog_comments.rb
new file mode 100644
index 0000000..d738cac
--- /dev/null
+++ b/spec/support/refinery/factories/blog_comments.rb
@@ -0,0 +1,6 @@
+Factory.define :blog_comment, :class => 'refinery/blog_comment' do |f|
+ f.name "Joe Commenter"
+ f.sequence(:email) { |n| "person#{n}@example.com" }
+ f.body "Which one is the best for picking up new shoes?"
+ f.association :post, :factory => :blog_post
+end
diff --git a/spec/support/refinery/factories/blog_posts.rb b/spec/support/refinery/factories/blog_posts.rb
new file mode 100644
index 0000000..548636d
--- /dev/null
+++ b/spec/support/refinery/factories/blog_posts.rb
@@ -0,0 +1,7 @@
+Factory.define :blog_post, :class => 'refinery/blog_post' do |f|
+ f.sequence(:title) { |n| "Top #{n} Shopping Centers in Chicago" }
+ f.body "These are the top ten shopping centers in Chicago. You're going to read a long blog post about them. Come to peace with it."
+ f.draft false
+ f.tag_list "chicago, shopping, fun times"
+ f.published_at Time.now
+end