writing cells specs + restore the bushido.json file

This commit is contained in:
did 2011-07-26 02:00:35 +02:00
parent ffb780238b
commit 0a8321ad3d
7 changed files with 235 additions and 83 deletions

View File

@ -47,6 +47,8 @@ group :development do
gem 'unicorn' # Using unicorn_rails instead of webrick (default server)
gem 'rspec-rails', '2.6.1' # in order to have rspec tasks and generators
gem 'rspec-cells'
end
group :test, :development do

View File

@ -228,6 +228,10 @@ GEM
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-cells (0.0.5)
cells (~> 3.4)
rails (~> 3.0)
rspec-rails (~> 2.2)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
@ -327,6 +331,7 @@ DEPENDENCIES
rails (= 3.0.9)
rake (= 0.9.2)
rmagick (= 2.12.2)
rspec-cells
rspec-rails (= 2.6.1)
ruby-debug
ruby-debug19

View File

@ -1,9 +1,9 @@
{
'platform': 'rails',
'platform_version': 3,
'ruby_version': '1.9.2',
'sql': false,
'mongodb': true,
'start_page': 'admin/pages#guider=welcome',
'project_name': 'locomotive'
"platform": "rails",
"platform_version": 3,
"ruby_version": "1.9.2",
"sql": false,
"mongodb": true,
"start_page": "admin/pages#guider=welcome",
"project_name": "locomotive"
}

150
doc/TODO
View File

@ -1,79 +1,5 @@
BOARD:
x bushido version
x default template
~ editable_elements: inheritable: false (Mattias) => seems to be fixed by Dirk's last pull request (#44) => content tag
x resizing images on the fly
x locomedia tinyMCE plugin (Bernd)
x remove asset_collections
x site templates
x tinyMCE plugin
x vignette.rb
x code
x helpers
x ui
x rake task
x internal collection
x assign same _id
x pick up a theme_asset
x pull request locomedia
x refactor slugify method (use parameterize + create a module)
x contents permalink (UI)
x BUG: has_one / has_many. Delete an author
x bushido changes in the master
? edit sidebar (inline editor). Unable to reset it
x SEO: support and support/ should be 2 different pages. Remove trailing slash
x issue #91: httparty
x issue #90: seo metadata
x issue #57: seo page title
x issue #56
x tweak ui: form, quick link to edit a model in the popup menu
x Has_one => group by in the select
x better hints:
x notify the user that after changing the page title, they still have to click "update" for the change to be saved
x created_by ASC => "Creation date ascending"
x cancan: (authors / designers / admin)
x model
x ui
x controllers / views:
x page
x content / content type
x asset
x site
x account
x snippet
x theme asset
x features / specs
x enable rack-cache only for a specific url
x more cucumber tests for the content types
x check hosting:
x heroku
x bushi.do
x unable to reach the console
x deploy => okay
x unable to set a new subdomain
x liquid tag: Date.today (now), add a test to compare 2 dates
? better ui: increase text field length (auto sizable ?) + refactor error message
- trigger refresh at startup
x bugs
x heroku: unable to upload a new file => okay
x import => okay
x delete an item => okay
x bug: duplicate fields (new entry) when errors in the content type form
x tinyMCE => fullscreen
x export site
x rake task to import a remote template
x MERGE
x remove withelist for assets since we've got now roles
x admin role is not correctly set when creating a new website
x the required star for file field is not shown
x Rights to set roles (ticket #104)
x export: problems with templatized pages (source => multi levels pages)
x do not rename files for fonts
x icon for redirection page in the pages section (back-office)
x installed on heroku with source
x test and/or convert existing templates (the 2 of the themes section)
BACKLOG:
- custom_fields:
@ -99,7 +25,6 @@ BACKLOG:
- tooltip to explain the difference between 1.) Admin 2.) Author 3.) Designer?
- [bushido] guiders / welcome page / devise cas authentication (SSO)
REFACTORING:
- move content_type and content_instances in the CustomFields plugin (much more appropriate)
@ -289,4 +214,77 @@ x integrate new locomotivecms home
x seo section for the page form: seo title, seo keywords, seo description
x bugs: #50, #51
x 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
! asset collections: custom resizing if image
! asset collections: custom resizing if image
x bushido version
x default template
~ editable_elements: inheritable: false (Mattias) => seems to be fixed by Dirk's last pull request (#44) => content tag
x resizing images on the fly
x locomedia tinyMCE plugin (Bernd)
x remove asset_collections
x site templates
x tinyMCE plugin
x vignette.rb
x code
x helpers
x ui
x rake task
x internal collection
x assign same _id
x pick up a theme_asset
x pull request locomedia
x refactor slugify method (use parameterize + create a module)
x contents permalink (UI)
x BUG: has_one / has_many. Delete an author
x bushido changes in the master
? edit sidebar (inline editor). Unable to reset it
x SEO: support and support/ should be 2 different pages. Remove trailing slash
x issue #91: httparty
x issue #90: seo metadata
x issue #57: seo page title
x issue #56
x tweak ui: form, quick link to edit a model in the popup menu
x Has_one => group by in the select
x better hints:
x notify the user that after changing the page title, they still have to click "update" for the change to be saved
x created_by ASC => "Creation date ascending"
x cancan: (authors / designers / admin)
x model
x ui
x controllers / views:
x page
x content / content type
x asset
x site
x account
x snippet
x theme asset
x features / specs
x enable rack-cache only for a specific url
x more cucumber tests for the content types
x check hosting:
x heroku
x bushi.do
x unable to reach the console
x deploy => okay
x unable to set a new subdomain
x liquid tag: Date.today (now), add a test to compare 2 dates
? better ui: increase text field length (auto sizable ?) + refactor error message
- trigger refresh at startup
x bugs
x heroku: unable to upload a new file => okay
x import => okay
x delete an item => okay
x bug: duplicate fields (new entry) when errors in the content type form
x tinyMCE => fullscreen
x export site
x rake task to import a remote template
x MERGE
x remove withelist for assets since we've got now roles
x admin role is not correctly set when creating a new website
x the required star for file field is not shown
x Rights to set roles (ticket #104)
x export: problems with templatized pages (source => multi levels pages)
x do not rename files for fonts
x icon for redirection page in the pages section (back-office)
x installed on heroku with source
x test and/or convert existing templates (the 2 of the themes section)

View File

@ -0,0 +1,143 @@
require 'spec_helper'
module Resetter
@@original_settings_menu_cell_klass = Admin::SettingsMenuCell
def self.original_settings_menu_cell_klass
@@original_settings_menu_cell_klass
end
def self.reset_settings_menu_cell_klass
::Admin.send(:remove_const, 'SettingsMenuCell')
::Admin.const_set('SettingsMenuCell', self.original_settings_menu_cell_klass.clone)
::Admin::SettingsMenuCell.any_instance.stubs(:sections).returns({ :main => 'settings', :sub => 'site' })
end
end
# puts "initial object_id = #{@original_settings_menu_cell_klass.object_id}"
# def reset_settings_menu_cell!
# ::Admin.send(:remove_const, 'SettingsMenuCell') rescue nil
# load 'admin/settings_menu_cell.rb'
# # ::Admin.const_set('SettingsMenuCell', @original_settings_menu_cell_klass)
# end
describe Admin::SettingsMenuCell, :type => :cells do
render_views
# before(:each) do
# puts "1...#{Admin::SettingsMenuCell.object_id}"
# # @original_settings_menu_cell_klass = Admin::SettingsMenuCell.clone
# # ::Admin.send(:remove_const, 'SettingsMenuCell')
# # ::Admin.const_set('SettingsMenuCell', @original_settings_menu_cell_klass.clone)
# # @cell_klass = Class.new(Admin::SettingsMenuCell)
# # reset_settings_menu_cell!
#
# # Resetter.reset_settings_menu_cell_klass
#
# # Admin::SettingsMenuCell.any_instance.stubs(:sections).returns({ :main => 'settings', :sub => 'site' })
# end
#
# after(:each) do
# puts "2....#{Admin::SettingsMenuCell.object_id} (polluted) / clone: #{Resetter.original_settings_menu_cell_klass.object_id} (cleaned)"
# # ::Admin.send(:remove_const, 'SettingsMenuCell')
# # ::Admin.const_set('SettingsMenuCell', @original_settings_menu_cell_klass)
# end
let(:menu) { render_cell('admin/settings_menu', :show) }
describe 'show menu' do
before(:all) do
Resetter.reset_settings_menu_cell_klass
end
it 'has 3 items' do
puts "1...#{Admin::SettingsMenuCell.object_id}"
menu.should have_selector('li', :count => 3)
end
it 'has a link to edit the current site' do
puts "2...#{Admin::SettingsMenuCell.object_id}"
menu.should have_link('Site')
end
it 'has a link to edit the template files' do
puts "3...#{Admin::SettingsMenuCell.object_id}"
menu.should have_link('Theme files')
end
it 'has a link to edit my account' do
puts "4...#{Admin::SettingsMenuCell.object_id}"
menu.should have_link('My account')
end
end
describe 'add a new menu item' do
before(:each) do
Resetter.reset_settings_menu_cell_klass
Admin::SettingsMenuCell.update_for(:add) { |m| m.add(:my_link, :label => 'My link', :url => 'http://www.locomotivecms.com') }
end
it 'has 4 items' do
menu.should have_selector('li', :count => 4)
end
it 'has a new link' do
menu.should have_link('My link')
end
end
describe 'remove a new menu item' do
before(:each) do
Resetter.reset_settings_menu_cell_klass
Admin::SettingsMenuCell.update_for(:remove) { |m| m.remove(:theme_assets) }
end
it 'has 2 items' do
menu.should have_selector('li', :count => 2)
end
it 'does not have the link to edit the template files' do
menu.should_not have_link('Theme files')
end
end
# describe 'add / remove / edit menu items' do
#
#
#
#
# end
# describe "search posts" do
# let(:search) { render_cell(:posts, :search) }
#
# it "should have a search field" do
# search.should have_field("Search by Title")
# end
#
# it "should have a search button" do
# search.should have_button("Search")
# end
# end
#
# describe "latest posts" do
# subject { render_cell(:posts, :latest) }
#
# it { should have_css("h3.title", :text => "Latest Posts") }
# it { should have_table("latest_posts") }
# it { should have_link("View all Posts") }
# it { should_not have_button("Create Post") }
# it { should_not have_field("Search by Title") }
# end
end

View File

@ -4,6 +4,7 @@ require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'factory_girl'
Factory.find_definitions
# Requires supporting ruby files with custom matchers and macros, etc,

3
spec/support/cells.rb Normal file
View File

@ -0,0 +1,3 @@
require 'rspec-cells'
require 'cell/test_case'
require 'rspec/rails/example/cell_example_group'