diff options
author | Jamie Winsor <jamie@enmasse.com> | 2011-08-04 03:21:21 -0700 |
---|---|---|
committer | Jamie Winsor <jamie@enmasse.com> | 2011-08-04 03:21:21 -0700 |
commit | c3b7d0b1d2d23f87536078dc8cc2aa367d7730e4 (patch) | |
tree | 1050cfd3783c52dcc8cc494e5dca4c5077afa014 /spec | |
parent | a23689a6aa738f5dd051d65b9e26e5d6bb7fa332 (diff) | |
download | refinerycms-blog-c3b7d0b1d2d23f87536078dc8cc2aa367d7730e4.tar.gz refinerycms-blog-c3b7d0b1d2d23f87536078dc8cc2aa367d7730e4.tar.bz2 refinerycms-blog-c3b7d0b1d2d23f87536078dc8cc2aa367d7730e4.zip |
Add request and controller authentication macros to rspec config
refactor request specs to take advantage of authentication macros
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/blog_categories_spec.rb | 3 | ||||
-rw-r--r-- | spec/requests/blog_posts_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/manage_blog_posts_spec.rb | 9 | ||||
-rw-r--r-- | spec/spec_helper.rb | 2 |
4 files changed, 6 insertions, 12 deletions
diff --git a/spec/requests/blog_categories_spec.rb b/spec/requests/blog_categories_spec.rb index 33d330b..8ac6eff 100644 --- a/spec/requests/blog_categories_spec.rb +++ b/spec/requests/blog_categories_spec.rb @@ -1,8 +1,9 @@ require "spec_helper" describe "blog categories" do + login_refinery_user + before(:each) do - Factory.create(:refinery_user) @blog_post = Factory(:blog_post, :title => "Refinery CMS blog post") @blog_category = Factory(:blog_category, :title => "Video Games") @blog_post.categories << @blog_category diff --git a/spec/requests/blog_posts_spec.rb b/spec/requests/blog_posts_spec.rb index 8695d9a..1eaf27a 100644 --- a/spec/requests/blog_posts_spec.rb +++ b/spec/requests/blog_posts_spec.rb @@ -1,9 +1,7 @@ require "spec_helper" describe "blog posts" do - before(:each) do - Factory.create(:refinery_user) - end + login_refinery_user context "when has blog posts" do let(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/spec/requests/manage_blog_posts_spec.rb b/spec/requests/manage_blog_posts_spec.rb index 8b1097d..724cc59 100644 --- a/spec/requests/manage_blog_posts_spec.rb +++ b/spec/requests/manage_blog_posts_spec.rb @@ -1,14 +1,7 @@ require "spec_helper" describe "manage blog posts" do - # TODO: share this with other request specs - before(:each) do - user = Factory.create(:refinery_user) - visit new_refinery_user_session_url - fill_in "Login", :with => user.username - fill_in "Password", :with => user.password - click_button "Sign in" - end + login_refinery_user let!(:blog_post) { Factory(:blog_post, :title => "Refinery CMS blog post") } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 44506ce..5a8d67c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -42,6 +42,8 @@ Spork.prefork do end config.include Devise::TestHelpers, :type => :controller + config.extend Refinery::ControllerMacros::Authentication, :type => :controller + config.extend Refinery::RequestMacros::Authentication, :type => :request end end |