Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed lots of unused /test assets

  • Loading branch information...
commit 3dc967dcb5f1bd5365b0f7309e6a02d2ef38ba66 1 parent bef2f7e
@aiwilliams aiwilliams authored
View
2  app/models/page_part.rb
@@ -15,7 +15,7 @@ class PagePart < ActiveRecord::Base
object_id_attr :filter, TextFilter
def after_initialize
- self.filter_id ||= Radiant::Config['defaults.page.filter']
+ self.filter_id ||= Radiant::Config['defaults.page.filter'] if new_record?
end
end
View
1  spec/controllers/admin/pages_controller_spec.rb
@@ -2,7 +2,6 @@
describe Admin::PagesController do
dataset :users, :pages
- test_helper :pages, :page_parts, :caching
before :each do
login_as :existing
View
1  spec/controllers/admin/preferences_controller_spec.rb
@@ -2,7 +2,6 @@
describe Admin::PreferencesController do
dataset :users
- test_helper :logging
it "should allow you to view your preferences" do
user = login_as(:non_admin)
View
1  spec/controllers/admin/users_controller_spec.rb
@@ -2,7 +2,6 @@
describe Admin::UsersController do
dataset :users
- test_helper :logging
it "should be a ResourceController" do
controller.should be_kind_of(Admin::ResourceController)
View
344 spec/lib/login_system_spec.rb
@@ -14,253 +14,183 @@ def method_missing(method, *args, &block)
end
end
-describe NoLoginRequiredController = StubController.subclass('NoLoginRequiredController') { no_login_required }, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
-
- it "should not require authentication" do
- get :index
- response.should be_success
- end
-end
-
-describe LoginRequiredController = StubController.subclass('LoginRequiredController') { }, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
-
+describe 'Login System:', :type => :controller do
dataset :users
-
- it "should authenticate with user in session" do
- login_as :existing
- get :index
- response.should be_success
- end
-
- it "should not authenicate without user in session" do
- get :index
- response.should redirect_to(login_url)
- end
- it "should store location" do
- session[:return_to] = nil
- get 'protected_action'
- session[:return_to].should match(%r{protected_action})
+ before do
+ map = ActionController::Routing::RouteSet::Mapper.new(ActionController::Routing::Routes)
+ map.connect ':controller/:action/:id'
+ ActionController::Routing::Routes.named_routes.install
end
-end
-describe StubController, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
+ after do
+ ActionController::Routing::Routes.reload
end
-
- after :each do
- teardown_custom_routes
- end
-
- describe ".authenticate" do
- it "should attempt to login from cookie" do
- controller.should_receive(:login_from_cookie)
- get :action
+
+ describe NoLoginRequiredController = StubController.subclass('NoLoginRequiredController') { no_login_required } do
+ it "should not require authentication" do
+ get :index
+ response.should be_success
end
end
- describe ".login_from_cookie" do
-
- before do
- Time.zone = 'UTC'
- Radiant::Config.stub!(:[]).with('session_timeout').and_return(2.weeks)
+ describe LoginRequiredController = StubController.subclass('LoginRequiredController') { }, :type => :controller do
+ it "should authenticate with user in session" do
+ login_as :existing
+ get :index
+ response.should be_success
end
- it "should not login user if no cookie found" do
- controller.should_not_receive(:current_user=)
+ it "should not authenicate without user in session" do
get :index
+ response.should redirect_to(login_url)
end
- describe "with session_token" do
- dataset :users
+ it "should store location" do
+ session[:return_to] = nil
+ get 'protected_action'
+ session[:return_to].should match(%r{protected_action})
+ end
+ end
- before do
- @user = users(:admin)
- User.should_receive(:find_by_session_token).and_return(@user)
- @cookies = { :session_token => 12345 }
- controller.stub!(:cookies).and_return(@cookies)
+ describe StubController do
+
+ describe ".authenticate" do
+ it "should attempt to login from cookie" do
+ controller.should_receive(:login_from_cookie)
+ get :action
end
+ end
- after do
- controller.send :login_from_cookie
+ describe ".login_from_cookie" do
+ before do
+ Time.zone = 'UTC'
+ Radiant::Config.stub!(:[]).with('session_timeout').and_return(2.weeks)
end
- it "should log in user" do
- controller.should_receive(:current_user=).with(@user).and_return {
- # can't mock current_user before current_user= is
- # called, else the method doesn't run
- controller.stub!(:current_user).and_return(@user)
- }
+ it "should not login user if no cookie found" do
+ controller.should_not_receive(:current_user=)
+ get :index
end
- it "should remember user" do
- @user.should_receive(:remember_me)
- end
+ describe "with session_token" do
+ before do
+ @user = users(:admin)
+ User.should_receive(:find_by_session_token).and_return(@user)
+ @cookies = { :session_token => 12345 }
+ controller.stub!(:cookies).and_return(@cookies)
+ end
- it "should update cookie" do
- @cookies.should_receive(:[]=) do |name,content|
- name.should eql(:session_token)
- content[:value].should eql(@user.session_token)
- content[:expires].should be_close((Time.zone.now + 2.weeks).utc, 1.minute) # sometimes specs are slow
+ after do
+ controller.send :login_from_cookie
+ end
+
+ it "should log in user" do
+ controller.should_receive(:current_user=).with(@user).and_return {
+ # can't mock current_user before current_user= is
+ # called, else the method doesn't run
+ controller.stub!(:current_user).and_return(@user)
+ }
end
- end
+ it "should remember user" do
+ @user.should_receive(:remember_me)
+ end
+
+ it "should update cookie" do
+ @cookies.should_receive(:[]=) do |name,content|
+ name.should eql(:session_token)
+ content[:value].should eql(@user.session_token)
+ content[:expires].should be_close((Time.zone.now + 2.weeks).utc, 1.minute) # sometimes specs are slow
+ end
+ end
+
+ end
end
end
-end
-describe NoLoginRequiredChildController = NoLoginRequiredController.subclass('NoLoginRequiredChildController') { }, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
+ describe NoLoginRequiredChildController = NoLoginRequiredController.subclass('NoLoginRequiredChildController') { } do
+ it "should inherit no_login_required" do
+ # StubController.controllers_where_no_login_required.should include(NoLoginRequiredChildController)
+ controller.class.should_not be_login_required
+ end
end
- it "should inherit no_login_required" do
- # StubController.controllers_where_no_login_required.should include(NoLoginRequiredChildController)
- controller.class.should_not be_login_required
+
+ describe LoginRequiredGrandChildController = NoLoginRequiredChildController.subclass('LoginRequiredGrandChildController') {
+ login_required
+ } do
+ it "should override parent with login_required" do
+ controller.class.should be_login_required
+ end
end
-end
-describe LoginRequiredGrandChildController = NoLoginRequiredChildController.subclass('LoginRequiredGrandChildController') {
- login_required
- }, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
+ describe LoginRequiredGreatGrandChildController = LoginRequiredGrandChildController.subclass('LoginRequiredGreatGrandChildController') { } do
+ it "should inherit login_required" do
+ controller.class.should be_login_required
end
+ end
- after :each do
- teardown_custom_routes
+ describe LoginRequiredController.subclass('OnlyAllowAccessToWhenController') {
+ only_allow_access_to :edit, :new,
+ :when => [:admin, :developer],
+ :denied_url => '/login_required',
+ :denied_message => 'Fun.'
+ } do
+ it "should only allow access when user in roles" do
+ login_as :admin
+ get :edit
+ response.should be_success
end
- it "should override parent with login_required" do
- controller.class.should be_login_required
+
+ it "should not allow access when user not in roles" do
+ login_as :non_admin
+ get :edit
+ response.should redirect_to('/login_required')
+ flash[:error].should eql('Fun.')
end
-end
-describe LoginRequiredGreatGrandChildController = LoginRequiredGrandChildController.subclass('LoginRequiredGreatGrandChildController') { }, :type => :controller do
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
- it "should inherit login_required" do
- controller.class.should be_login_required
+ it "should allow access to unrestricted actions when users not in roles" do
+ login_as :non_admin
+ get :another
+ response.should be_success
+ end
end
-end
-describe LoginRequiredController.subclass('OnlyAllowAccessToWhenController') {
- only_allow_access_to :edit, :new,
- :when => [:admin, :developer],
- :denied_url => '/login_required',
- :denied_message => 'Fun.'
- }, :type => :controller do
- dataset :users
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
-
- it "should only allow access when user in roles" do
- login_as :admin
- get :edit
- response.should be_success
- end
-
- it "should not allow access when user not in roles" do
- login_as :non_admin
- get :edit
- response.should redirect_to('/login_required')
- flash[:error].should eql('Fun.')
- end
-
- it "should allow access to unrestricted actions when users not in roles" do
- login_as :non_admin
- get :another
- response.should be_success
+ describe LoginRequiredController.subclass('OnlyAllowAccessToWhenDefaultsController') {
+ only_allow_access_to :edit,
+ :when => :admin,
+ :denied_url => '/login_required',
+ :denied_message => 'Fun.'
+ } do
+ it "should not allow access when user not in default roles" do
+ login_as :non_admin
+ get :edit
+ response.should redirect_to('/login_required')
+ flash[:error].should eql('Fun.')
+ end
end
-end
-describe LoginRequiredController.subclass('OnlyAllowAccessToWhenDefaultsController') {
- only_allow_access_to :edit,
- :when => :admin,
- :denied_url => '/login_required',
- :denied_message => 'Fun.'
- }, :type => :controller do
- dataset :users
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
-
- it "should not allow access when user not in default roles" do
- login_as :non_admin
- get :edit
- response.should redirect_to('/login_required')
- flash[:error].should eql('Fun.')
- end
-end
+ describe LoginRequiredController.subclass('OnlyAllowAccessToIfController') {
+ attr_writer :condition
+ define_method(:condition?, proc { @condition ||= false })
+ only_allow_access_to :edit, :if => :condition?,
+ :denied_url => '/login_required',
+ :denied_message => 'Fun.'
+ } do
-describe LoginRequiredController.subclass('OnlyAllowAccessToIfController') {
- attr_writer :condition
- define_method(:condition?, proc { @condition ||= false })
- only_allow_access_to :edit, :if => :condition?,
- :denied_url => '/login_required',
- :denied_message => 'Fun.'
- }, :type => :controller do
- dataset :users
- test_helper :routing
- before :each do
- setup_custom_routes
- end
-
- after :each do
- teardown_custom_routes
- end
-
- it "should allow access if condition is true" do
- controller.condition = true
- login_as :existing
- get :edit
- response.should be_success
- end
+ it "should allow access if condition is true" do
+ controller.condition = true
+ login_as :existing
+ get :edit
+ response.should be_success
+ end
- it "should not allow access if condition is false" do
- controller.condition = false
- login_as :existing
- get :edit
- response.should redirect_to('/login_required')
+ it "should not allow access if condition is false" do
+ controller.condition = false
+ login_as :existing
+ get :edit
+ response.should redirect_to('/login_required')
+ end
end
end
View
2  spec/models/page_context_spec.rb
@@ -2,7 +2,6 @@
describe PageContext do
dataset :pages
- test_helper :pages
before :each do
@page = pages(:radius)
@@ -46,7 +45,6 @@ def parse(input)
describe PageContext, "when errors are not being raised" do
dataset :pages
- test_helper :pages
before :each do
@page = pages(:radius)
View
18 spec/models/page_part_spec.rb
@@ -1,12 +1,19 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe PagePart do
- test_helper :page_parts, :validations
+ dataset :home_page
- before :all do
- @part = @model = PagePart.new(PagePartTestHelper::VALID_PAGE_PART_PARAMS)
+ test_helper :validations
+
+ before do
+ @original_filter = Radiant::Config['defaults.page.filter']
+ @part = @model = PagePart.new(page_part_params)
end
+ after do
+ Radiant::Config['defaults.page.filter'] = @original_filter
+ end
+
it "should take the filter from the default filter" do
Radiant::Config['defaults.page.filter'] = "Textile"
part = PagePart.new :name => 'new-part'
@@ -14,9 +21,10 @@
end
it "shouldn't override existing page_parts filters with the default filter" do
+ part = PagePart.find(:first, :conditions => {:filter_id => nil})
Radiant::Config['defaults.page.filter'] = "Textile"
- part = PagePart.find(:first, :conditions => "filter_id != 'Textile'") # Find first page part that doesn't have the default filter
- part.filter_id.should_not == "Textile" # Filter shouldn't be the default one, obviously.
+ part.reload
+ part.filter_id.should_not == "Textile"
end
it 'should validate length of' do
View
9 spec/spec_helper.rb
@@ -54,6 +54,14 @@ def test_helper(*names)
module Spec
module Application
+ module ExampleExtensions
+ def rails_log
+ log = IO.read(RAILS_ROOT + '/log/test.log')
+ log.should_not be_nil
+ log
+ end
+ end
+
module IntegrationExampleExtensions
def login(user)
if user.nil?
@@ -76,6 +84,7 @@ def encode_credentials(email_password)
end
Spec::Runner.configure do |config|
+ config.include Spec::Application::ExampleExtensions
config.include Spec::Application::IntegrationExampleExtensions, :type => :integration
config.use_transactional_fixtures = true
View
26 test/fixtures/layouts.yml
@@ -1,26 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-main:
- id: 1
- name: Home Page
- content: |
- <html>
- <head>
- <title><r:title /></title>
- </head>
- <body>
- <r:content />
- </body>
- </html>
-utf8:
- id: 2
- name: UTF-8 Layout
- content_type: text/html;charset=utf8
- content: |
- <html>
- <head>
- <title><r:title /></title>
- </head>
- <body>
- <r:content />
- </body>
- </html>
View
119 test/fixtures/page_parts.yml
@@ -1,119 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-body:
- id: 1
- name: body
- content: This is the body portion of the Ruby home page.
- page_id: 1
-extended:
- id: 2
- name: extended
- content: This is an extended portion of the Ruby home page.
- page_id: 1
-summary:
- id: 3
- name: summary
- content: This is a summary.
- page_id: 1
-sidebar:
- id: 4
- name: sidebar
- content: <r:title /> sidebar.
- page_id: 1
-documentation_body:
- id: 5
- name: body
- content: This is the documentation section.
- page_id: 2
-books_body:
- id: 6
- name: body
- content: This is the books page.
- page_id: 3
-textile_body:
- id: 7
- name: body
- content: Some *Textile* content.
- filter_id: Textile
- page_id: 4
-radius_body:
- id: 8
- name: body
- content: |
- h1. <r:page:title />
-
- <r:page:children:each>* <r:child:title />
- </r:page:children:each>
- filter_id: Textile
- page_id: 5
-radius__extended:
- id: 9
- name: extended
- content: |
- Just a test.
- page_id: 5
-<% for i in 1..3 %>
-radius_child_<%= i %>_body:
- id: <%= 9 + i %>
- name: body
- content: |
- Radius test child <%= i %> body.
- page_id: <%= 5 + i %>
-<% end %>
-radius_child_2_extended:
- id: 13
- name: extended
- content: |
- Extended content for Radius test.
- page_id: 7
-page_with_layout_body:
- id: 14
- name: body
- content: <r:page:title />
- page_id: 9
-custom_tags_body:
- id: 15
- name: body
- content: <r:test1 /> <r:test2 />
- page_id: 35
-custom_tags_child_body:
- id: 16
- name: body
- content: <r:test />
- page_id: 36
-page_with_yaml_config_part:
- id: 17
- name: config
- content: |
- test: true
- cool: beans
- page_id: 37
-small_test_part:
- id: 18
- name: body
- content: test
- page_id: 38
-inheritance_test_part:
- id: 19
- name: body
- content: <r:title /> inherited body.
- page_id: 47
-if_dev_test_part:
- id: 20
- name: if_dev
- content: <r:if_dev>dev</r:if_dev>
- page_id: 60
-unless_dev_test_part:
- id: 21
- name: unless_dev
- content: <r:unless_dev>not dev</r:unless_dev>
- page_id: 60
-another:
- id: 22
- name: body
- content: another page
- page_id: 61
-global_titles:
- id: 23
- name: titles
- page_id: 67
- content: <r:title /> <r:page:title />
View
353 test/fixtures/pages.yml
@@ -1,353 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-homepage:
- id: 1
- title: Ruby Home Page
- breadcrumb: Home
- slug: /
- status_id: 100
- parent_id:
- published_at: 2006-01-30 08:41:07
-documentation:
- id: 2
- title: Documentation
- breadcrumb: Documentation
- slug: documentation
- status_id: 100
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-books:
- id: 3
- title: Books
- breadcrumb: Books
- slug: books
- status_id: 100
- parent_id: 2
- published_at: 2006-01-30 08:41:07
-textile:
- id: 4
- title: Textile
- breadcrumb: Textile
- slug: textile
- status_id: 100
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-radius:
- id: 5
- title: Radius Test Page
- breadcrumb: Radius Test Page
- slug: radius
- status_id: 100
- parent_id: 1
- created_by_id: 3
- published_at: 2006-01-30 08:41:07
- created_at: 2006-01-30 08:40:00
- updated_at: 2006-01-31 08:40:00
-<% for i in 1..3 %>
-radius_child_<%= i %>:
- id: <%= 5 + i %>
- title: Radius Test Child <%= i %>
- breadcrumb: Radius Test Child <%= i %>
- slug: child-<%= i %>
- status_id: 100
- parent_id: 5
- created_by_id: 1
- published_at: 2006-01-30 08:41:07
-<% end %>
-page_with_layout:
- id: 9
- title: Page With Layout
- breadcrumb: Page With Layout
- slug: page-with-layout
- status_id: 100
- layout_id: 1
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-another_page_with_layout:
- id: 52
- title: Another Page With Layout
- breadcrumb: Another Page With Layout
- slug: another-page-with-layout
- status_id: 100
- layout_id: 1
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-child_of_page_with_layout:
- id: 18
- title: Child of Page With Layout
- breadcrumb: Child of Page With Layout
- slug: child-of-page-with-layout
- status_id: 100
- parent_id: 9
- published_at: 2006-01-30 08:47:07
-parent:
- id: 10
- title: Parent
- breadcrumb: Parent
- slug: parent
- status_id: 100
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-child:
- id: 11
- title: Child
- breadcrumb: Child
- slug: child
- status_id: 100
- parent_id: 10
- published_at: 2006-01-30 08:41:07
-draft:
- id: 15
- title: Draft Page
- breadcrumb: Draft Page
- slug: draft
- status_id: 1
- parent_id: 1
-hidden:
- id: 16
- title: Hidden Page
- breadcrumb: Hidden Page
- slug: hidden
- status_id: 101
- parent_id: 1
-no_cache:
- id: 17
- title: No Cache
- breadcrumb: No Cache
- slug: no-cache
- status_id: 100
- parent_id: 1
- class_name: NoCachePage
-assorted:
- id: 19
- title: Assorted Root
- breadcrumb: No Cache
- slug: assorted
- status_id: 100
- parent_id: 1
-<% for i in 1..10 %>
-assorted<%= i %>:
- id: <%= 19 + i %>
- title: Assorted <%= i %>
- breadcrumb: <%= (i + 5) % 10 %>
- slug: <%= (?a + (10 - i)).chr %>
- status_id: 100
- parent_id: 19
- published_at: 2000-06-10 07:<%= '%02d' % (17 - i) %>:<%= '%02d' % (i + 11) %>
-<% end %>
-assorted-draft:
- id: 40
- title: Draft
- breadcrumb: Draft
- slug: draft
- status_id: 1
- parent_id: 19
-news:
- id: 30
- title: News Archives
- breadcrumb: news
- slug: news
- status_id: 100
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-news_child_published:
- id: 31
- title: A Great Day for Ruby
- breadcrumb: news
- slug: a-great-day-for-ruby
- status_id: 100
- parent_id: 30
- published_at: 2006-01-30 08:41:07
-news_child_published_2:
- id: 32
- title: Another Great Day for Ruby
- breadcrumb: news
- slug: another-great-day-for-ruby
- status_id: 100
- parent_id: 30
- published_at: 2006-02-05 08:44:07
-grandchild:
- id: 33
- title: Grandchild
- breadcrumb: Grandchild
- slug: grandchild
- status_id: 100
- parent_id: 11
- published_at: 2006-02-05 08:44:07
-great_grandchild:
- id: 34
- title: Great-Grandchild
- slug: great-grandchild
- status_id: 100
- parent_id: 33
- published_at: 2006-02-05 08:44:07
-test_page:
- id: 35
- title: Test Page
- slug: test-page
- class_name: TestPage
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-custom_tags_child:
- id: 36
- title: Custom Tags Child
- slug: child
- status_id: 100
- parent_id: 35
- published_at: 2006-02-05 08:44:07
-page_with_yaml_config:
- id: 37
- title: Page with YAML config
- slug: page-with-yaml-config
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-small_test:
- id: 38
- title: Small Test
- slug: small-test
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-inheritance_test_page:
- id: 47
- title: Inheritance Test Page
- slug: inheritance-test-page
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-inheritance_test_page_child:
- id: 48
- title: Inheritance Test Page Child
- slug: child
- status_id: 100
- parent_id: 47
- published_at: 2006-02-05 08:44:07
-inheritance_test_page_grandchild:
- id: 49
- title: Inheritance Test Page Grandchild
- slug: grandchild
- status_id: 100
- parent_id: 48
- published_at: 2006-02-05 08:44:07
-gallery:
- id: 50
- title: Gallery
- slug: gallery
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-file_not_found:
- id: 51
- title: File Not Found
- slug: missing
- class_name: FileNotFoundPage
- status_id: 100
- parent_id: 50
- published_at: 2006-02-05 08:44:07
-page_with_content_type_set_on_layout:
- id: 54
- title: Page With Content Type Set On Layout
- slug: page_with_content_type_set_on_layout
- status_id: 100
- layout_id: 2
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-deep_nested_child_for_breadcrumbs:
- id: 55
- title: Deeply nested child for testing breadcrumbs
- slug: deep-nested-child
- breadcrumb: Deeply nested child
- status_id: 100
- parent_id: 6
- published_at: 2006-02-05 08:44:07
-homepage_draft:
- id: 56
- title: Home Page Draft
- breadcrumb: Home Page Draft
- slug: homepage_draft
- status_id: 1
- parent_id: 1
- published_at: 2006-01-30 08:41:07
-gallery_draft:
- id: 57
- title: Gallery Draft
- slug: gallery_draft
- status_id: 1
- parent_id: 50
- published_at: 2006-02-05 08:44:07
-custom_404_root:
- id: 58
- title: Custom 404 Root
- slug: custom_404
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-custom_404:
- id: 59
- title: Custom File Not Found
- slug: missing
- class_name: CustomFileNotFoundPage
- status_id: 100
- parent_id: 58
- published_at: 2006-02-05 08:44:07
-devtags:
- id: 60
- title: Dev Test Page
- slug: devtags
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-another:
- id: 61
- title: Another Page
- slug: another
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-childless:
- id: 62
- title: Childless Page
- slug: childless
- status_id: 100
- parent_id: 1
- published_at: 2006-02-05 08:44:07
-virtual:
- id: 63
- title: Virtual Page
- class_name: VirtualPage
- slug: virtual
- virtual: true
- status_id: 100
- parent_id: 19
- published_at: 2006-02-05 08:44:07
-news_child_published_3:
- id: 65
- title: Later That Day
- breadcrumb: news
- slug: later-that-day
- status_id: 100
- parent_id: 30
- published_at: 2006-02-06 09:44:07
-news_child_published_4:
- id: 66
- title: Next Year in Ruby
- breadcrumb: news
- slug: next-year-in-ruby
- status_id: 100
- parent_id: 30
- published_at: 2007-01-30 08:44:07
-global:
- id: 67
- title: Global
- slug: global
- status_id: 100
- parent_id: 60
- published_at: 2006-02-05 08:44:07
-global_child:
- id: 68
- title: Global Child
- slug: global-child
- status_id: 100
- parent_id: 67
- published_at: 2006-02-05 08:44:07
View
1  test/fixtures/sample.txt
@@ -1 +0,0 @@
-This is a sample text file.
View
26 test/fixtures/snippets.yml
@@ -1,26 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-first:
- id: 1
- name: first
- content: test
-another:
- id: 2
- name: another
- content: another test
-markdown:
- id: 3
- name: markdown
- content: **markdown**
- filter_id: Markdown
-snippet_with_tag:
- id: 4
- name: snippet_with_tag
- content: <r:page:title />
-global_page_cascade:
- id: 5
- name: global_page_cascade
- content: <r:children:each><r:page:title /> </r:children:each>
-recursive_snippet:
- id: 6
- name: recursive
- content: <r:children:each><r:snippet name="recursive" /></r:children:each><r:page:title />
View
35 test/fixtures/users.yml
@@ -1,35 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-existing:
- id: 1
- name: Existing User
- login: existing
- salt: 42ddb5b6479872565981adc78e86ddc50fa21637
- password: 4c5f9d5a0d4cd65d61f6b1505890576d1272986c # password
- email: existing.user@gmail.com
-another:
- id: 2
- name: Another User
- login: another
- salt: 42ddb5b6479872565981adc78e86ddc50fa21637
- password: 4c5f9d5a0d4cd65d61f6b1505890576d1272986c # password
-admin:
- id: 3
- name: Admin User
- login: admin
- salt: 42ddb5b6479872565981adc78e86ddc50fa21637
- password: 4c5f9d5a0d4cd65d61f6b1505890576d1272986c # password
- admin: true
-developer:
- id: 4
- name: Developer User
- login: developer
- salt: 42ddb5b6479872565981adc78e86ddc50fa21637
- password: 4c5f9d5a0d4cd65d61f6b1505890576d1272986c # password
- developer: true
-non_admin:
- id: 5
- name: Non-Admin User
- login: non-admin
- salt: 42ddb5b6479872565981adc78e86ddc50fa21637
- password: 4c5f9d5a0d4cd65d61f6b1505890576d1272986c # password
- admin: false
View
42 test/helpers/caching_test_helper.rb
@@ -1,42 +0,0 @@
-class FakeResponseCache
- attr_accessor :expired_path, :expired_paths
-
- def initialize
- @expired_paths = []
- @cached_responses = {}
- end
-
- def clear
- @cached_responses.clear
- @cleared = true
- end
-
- def cache_response(path, response)
- @cached_responses[path] = response
- response
- end
-
- def update_response(path, response)
- if r = @cached_response[path]
- response.headers.merge!(r.headers)
- response.body = r.body
- end
- response
- end
-
- def expire_response(path)
- @expired_paths << path
- @expired_path = path
- end
-
- def response_cached?(path)
- @cached_responses.keys.include?(path)
- end
-
- def cleared?
- !!@cleared
- end
-end
-
-module CachingTestHelper
-end
View
13 test/helpers/difference_test_helper.rb
@@ -1,13 +0,0 @@
-module DifferenceTestHelper
-
- def assert_difference(object, method = nil, difference = 1)
- initial_value = object.send(method)
- yield
- assert_equal initial_value + difference, object.send(method), "#{object}##{method}"
- end
-
- def assert_no_difference(object, method, &block)
- assert_difference object, method, 0, &block
- end
-
-end
View
40 test/helpers/extension_fixture_test_helper.rb
@@ -1,40 +0,0 @@
-module ExtensionFixtureTestHelper
- def self.included(base)
- unless base < ClassMethods
- base.send :include, InstanceMethods
- base.extend ClassMethods
- base.class_eval do
- class_inheritable_accessor :extension_fixture_table_names, :extension_fixture_path
- self.extension_fixture_table_names = []
- self.extension_fixture_path = ""
- alias_method_chain :load_fixtures, :extensions
- end
- end
- end
-
- module ClassMethods
- def extension_fixtures(*table_names)
- table_names = table_names.flatten.map { |n| n.to_s }
- self.extension_fixture_table_names = table_names
- require_fixture_classes(table_names)
- setup_fixture_accessors(table_names)
- end
- end
-
- module InstanceMethods
- def load_fixtures_with_extensions
- @loaded_fixtures = {}
- fixtures = Fixtures.create_fixtures(fixture_path, fixture_table_names, fixture_class_names),
- extension_fixtures = Fixtures.create_fixtures(extension_fixture_path, extension_fixture_table_names, fixture_class_names)
- [fixtures, extension_fixtures].each do |f|
- unless f.nil?
- if f.instance_of?(Fixtures)
- @loaded_fixtures[f.table_name] = f
- else
- f.each { |x| @loaded_fixtures[x.table_name] = x unless x.nil? }
- end
- end
- end
- end
- end
-end
View
17 test/helpers/extension_tag_test_helper.rb
@@ -1,17 +0,0 @@
-module ExtensionTagTestHelper
- def assert_global_tag_defined(name)
- assert Page.instance_methods.include?("tag:#{name}"), "Global tag #{name} does not exist."
- end
-
- def assert_global_tag_module(mod)
- assert Page.included_modules.include?(mod), "Tag module #{mod} is a global tag module."
- end
-
- def assert_tag_defined(page_model, name)
- assert page_model.instance_methods.include?("tag:#{name}"), "Tag #{name} does not exist in #{page_model}."
- end
-
- def assert_tag_module(page_model, mod)
- assert page_model.included_modules.include?(mod), "Tag module #{mod} is not included in #{page_model}."
- end
-end
View
35 test/helpers/layout_test_helper.rb
@@ -1,35 +0,0 @@
-module LayoutTestHelper
-
- VALID_LAYOUT_PARAMS = {
- :name => 'Test Layout',
- :content => 'Just a test.'
- }
-
- def layout_params(options = {})
- params = VALID_LAYOUT_PARAMS.dup
- params.merge!(:name => @layout_name) if @layout_name
- params.merge!(options)
- end
-
- def destroy_test_layout(name = @layout_name)
- while layout = get_test_layout(name) do
- layout.destroy
- end
- end
-
- def get_test_layout(name = @layout_name)
- Layout.find_by_name(name)
- end
-
- def create_test_layout(name = @layout_name)
- params = layout_params
- params.merge!(:name => name) if name
- layout = Layout.new(params)
- if layout.save
- layout
- else
- raise "layout <#{layout.inspect}> could not be saved"
- end
- end
-
-end
View
20 test/helpers/logging_test_helper.rb
@@ -1,20 +0,0 @@
-module LoggingTestHelper
-
- # used by tests
- def log_matches(regexp)
- result = false
- open(RAILS_ROOT + '/log/test.log') do |f|
- lines = f.readlines.to_s
- result = true if regexp.match(lines)
- end
- result
- end
-
- #used by specs
- def rails_log
- log = IO.read(RAILS_ROOT + '/log/test.log')
- log.should_not be_nil
- log
- end
-
-end
View
23 test/helpers/login_test_helper.rb
@@ -1,23 +0,0 @@
-module LoginTestHelper
- def self.included(base)
- base.class_eval{ fixtures :users }
- end
-
- def login_as(user)
- logged_in_user = user.is_a?(User) ? user : users(user)
- flunk "Can't login as non-existing user #{user.to_s}." unless logged_in_user
- @request ||= ActionController::TestRequest.new
- @request.session['user_id'] = logged_in_user.id
- end
-
- def logout
- @request ||= ActionController::TestRequest.new
- @request.session['user_id'] = nil
- end
-
- def assert_requires_login
- yield if block_given?
- assert_response :redirect
- assert_redirected_to :controller => "admin/welcome", :action => "login"
- end
-end
View
49 test/helpers/page_part_test_helper.rb
@@ -1,49 +0,0 @@
-module PagePartTestHelper
- VALID_PAGE_PART_PARAMS = {
- :name => 'custom',
- :content => 'Some simple content.',
- :page_id => '1'
- }
-
- def part_params(options = {})
- params = VALID_PAGE_PART_PARAMS.dup
- params.delete(:page_id)
- params.merge!(:name => @part_name) if @part_name
- params.merge!(options)
- params
- end
-
- def destroy_test_part(title = @part_name)
- while part = get_test_part(title) do
- part.destroy
- end
- end
-
- def get_test_part(name = @part_name)
- PagePart.find_by_name(name)
- end
-
- def create_test_part(name = @part_name)
- params = part_params
- params.merge!(:name => name)
- part = PagePart.new(params)
- if part.save
- part
- else
- raise "part <#{part.inspect}> could not be saved"
- end
- end
-
- # must be included after PageTestHelper to work
- def create_test_page(options = {})
- no_part = options.delete(:no_part)
- page = super(options)
- unless no_part
- part = PagePart.new part_params(:name => 'body', :content => 'test')
- page.parts << part
- page.save
- part.save
- end
- page
- end
-end
View
19 test/helpers/routing_test_helper.rb
@@ -1,19 +0,0 @@
-module RoutingTestHelper
-
- def setup_custom_routes
- map = ActionController::Routing::RouteSet::Mapper.new(routes)
- map.connect ':controller/:action/:id'
- routes.named_routes.install
- end
-
- def teardown_custom_routes
- routes.reload
- end
-
- private
-
- def routes
- ActionController::Routing::Routes
- end
-
-end
View
32 test/helpers/snippet_test_helper.rb
@@ -1,32 +0,0 @@
-module SnippetTestHelper
- VALID_SNIPPET_PARAMS = {
- :name => 'test-snippet',
- :content => 'Funness'
- }
-
- def snippet_params(options = {})
- params = VALID_SNIPPET_PARAMS.dup
- params.merge!(:name => @snippet_name) if @snippet_name
- params.merge!(options)
- end
-
- def destroy_test_snippet(name = @snippet_name)
- while snippet = get_test_snippet(name) do
- snippet.destroy
- end
- end
-
- def get_test_snippet(name = @snippet_name)
- Snippet.find_by_name(name)
- end
-
- def create_test_snippet(options = {})
- options[:name] ||= @snippet_name if @snippet_name
- snippet = Snippet.new snippet_params(options)
- if snippet.save
- snippet
- else
- raise "snippet <#{snippet.inspect}> could not be saved"
- end
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.