irwi 0.2.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +1 -1
- data/README.rdoc +9 -9
- data/app/views/base_wiki_pages/_wiki_page_info.html.erb +1 -1
- data/app/views/base_wiki_pages/compare.html.erb +1 -1
- data/app/views/base_wiki_pages/history.html.erb +1 -1
- data/app/views/base_wiki_pages/no.html.erb +1 -1
- data/lib/generators/irwi_wiki/irwi_wiki_generator.rb +29 -0
- data/{generators → lib/generators}/irwi_wiki/templates/controllers/wiki_pages_controller.rb +3 -3
- data/{generators → lib/generators}/irwi_wiki/templates/helpers/wiki_pages_helper.rb +1 -1
- data/{generators → lib/generators}/irwi_wiki/templates/migrate/create_wiki_pages.rb +15 -15
- data/{generators → lib/generators}/irwi_wiki/templates/models/wiki_page.rb +3 -3
- data/{generators → lib/generators}/irwi_wiki/templates/models/wiki_page_version.rb +3 -3
- data/lib/generators/irwi_wiki_attachments/irwi_wiki_attachments_generator.rb +22 -0
- data/{generators → lib/generators}/irwi_wiki_attachments/templates/migrate/create_wiki_page_attachments.rb +6 -6
- data/{generators → lib/generators}/irwi_wiki_attachments/templates/models/wiki_page_attachment.rb +1 -1
- data/lib/generators/irwi_wiki_views/irwi_wiki_views_generator.rb +13 -0
- data/lib/irwi.rb +34 -7
- data/lib/irwi/comparators/base.rb +6 -6
- data/lib/irwi/comparators/diff_lcs.rb +12 -12
- data/lib/irwi/comparators/spans/changed_span.rb +6 -6
- data/lib/irwi/comparators/spans/not_changed_span.rb +7 -7
- data/lib/irwi/config.rb +16 -14
- data/lib/irwi/extensions/controllers.rb +18 -0
- data/lib/irwi/extensions/controllers/wiki_page_attachments.rb +1 -1
- data/lib/irwi/extensions/controllers/wiki_pages.rb +47 -47
- data/lib/irwi/extensions/models.rb +24 -0
- data/lib/irwi/extensions/models/wiki_page.rb +16 -16
- data/lib/irwi/extensions/models/wiki_page_attachment.rb +4 -4
- data/lib/irwi/extensions/models/wiki_page_version.rb +17 -17
- data/lib/irwi/formatters/blue_cloth.rb +4 -4
- data/lib/irwi/formatters/red_cloth.rb +4 -4
- data/lib/irwi/helpers.rb +13 -0
- data/lib/irwi/helpers/wiki_page_attachments_helper.rb +4 -2
- data/lib/irwi/helpers/wiki_pages_helper.rb +36 -36
- data/lib/irwi/paginators/none.rb +6 -4
- data/lib/irwi/paginators/will_paginate.rb +4 -4
- data/lib/irwi/support/route_mapper.rb +22 -18
- data/lib/irwi/support/template_finder.rb +4 -4
- data/lib/irwi/version.rb +9 -0
- metadata +110 -81
- data/.document +0 -4
- data/.gitignore +0 -24
- data/Rakefile +0 -53
- data/VERSION +0 -1
- data/generators/irwi_wiki/irwi_wiki_generator.rb +0 -22
- data/generators/irwi_wiki_attachments/irwi_wiki_attachments_generator.rb +0 -18
- data/generators/irwi_wiki_views/irwi_wiki_views_generator.rb +0 -19
- data/irwi.gemspec +0 -120
- data/rails/init.rb +0 -44
- data/spec/comparators/diff_lcs_spec.rb +0 -45
- data/spec/config_spec.rb +0 -68
- data/spec/extensions/controllers/wiki_pages_spec.rb +0 -69
- data/spec/extensions/models/wiki_page_spec.rb +0 -79
- data/spec/formatters/red_cloth_spec.rb +0 -17
- data/spec/helpers/wiki_page_attachments_helper_spec.rb +0 -45
- data/spec/helpers/wiki_pages_helper_spec.rb +0 -158
- data/spec/paginators/none_spec.rb +0 -24
- data/spec/paginators/will_paginate_spec.rb +0 -28
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -4
- data/spec/spec_helper.rb +0 -15
- data/spec/support/route_mapper_spec.rb +0 -66
- data/spec/support/template_finder_spec.rb +0 -33
- data/tasks/riwiki_tasks.rake +0 -4
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "irwi"
|
8
|
-
gem.summary = %Q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application. }
|
9
|
-
gem.description = %Q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application. }
|
10
|
-
gem.email = "alexey.noskov@gmail.com ravi.bhim@yahoo.com"
|
11
|
-
gem.homepage = "http://github.com/alno/irwi"
|
12
|
-
gem.authors = ["Alexey Noskov", "Ravi Bhim"]
|
13
|
-
gem.add_dependency "diff-lcs", ">= 1.1.2"
|
14
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'spec/rake/spectask'
|
22
|
-
|
23
|
-
desc "Run all specs in spec directory"
|
24
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
desc "Run all specs in spec directory with RCov"
|
30
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
31
|
-
spec.libs << 'lib' << 'spec'
|
32
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
-
spec.rcov = true
|
34
|
-
spec.rcov_opts = lambda do
|
35
|
-
IO.readlines("spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
task :spec => :check_dependencies
|
40
|
-
|
41
|
-
task :default => :spec
|
42
|
-
task :test => :spec
|
43
|
-
|
44
|
-
require 'rake/rdoctask'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
46
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
-
|
48
|
-
rdoc.rdoc_dir = 'rdoc'
|
49
|
-
rdoc.title = "Irwi #{version}"
|
50
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
51
|
-
rdoc.rdoc_files.include('README*')
|
52
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.4
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class IrwiWikiGenerator < Rails::Generator::Base
|
2
|
-
def manifest
|
3
|
-
record do |m|
|
4
|
-
|
5
|
-
# Controllers
|
6
|
-
m.file 'controllers/wiki_pages_controller.rb', 'app/controllers/wiki_pages_controller.rb'
|
7
|
-
|
8
|
-
# Helpers
|
9
|
-
m.file 'helpers/wiki_pages_helper.rb', 'app/helpers/wiki_pages_helper.rb'
|
10
|
-
|
11
|
-
# Models
|
12
|
-
m.file 'models/wiki_page.rb', 'app/models/wiki_page.rb'
|
13
|
-
m.file 'models/wiki_page_version.rb', 'app/models/wiki_page_version.rb'
|
14
|
-
|
15
|
-
# Migrations
|
16
|
-
m.migration_template 'migrate/create_wiki_pages.rb', 'db/migrate', :migration_file_name => "create_wiki_pages"
|
17
|
-
|
18
|
-
# Routes
|
19
|
-
m.gsub_file 'config/routes.rb', /#{Regexp.quote 'ActionController::Routing::Routes.draw do |map|'}\n/, "\\0\n map.wiki_root '/wiki'\n"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
class IrwiWikiAttachmentsGenerator < Rails::Generator::Base
|
2
|
-
|
3
|
-
def manifest
|
4
|
-
record do |m|
|
5
|
-
%w[create_wiki_page_attachments].each do |mig|
|
6
|
-
unless Dir.entries(File.join(Rails.root,'db','migrate')).grep(/#{mig}/).present?
|
7
|
-
puts "Copying migration #{mig}"
|
8
|
-
m.migration_template "migrate/#{mig}.rb", 'db/migrate', :migration_file_name => mig
|
9
|
-
sleep(1) # To avoid migration file version collision.
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
# Models
|
14
|
-
m.file 'models/wiki_page_attachment.rb', 'app/models/wiki_page_attachment.rb'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class IrwiWikiViewsGenerator < Rails::Generator::Base
|
2
|
-
|
3
|
-
def initialize(runtime_args, runtime_options = {})
|
4
|
-
super( runtime_args, runtime_options )
|
5
|
-
|
6
|
-
@source_root = options[:source] || File.join(spec.path, '..', '..', 'app', 'views', 'base_wiki_pages')
|
7
|
-
end
|
8
|
-
|
9
|
-
def manifest
|
10
|
-
record do |m|
|
11
|
-
m.directory 'app/views/base_wiki_pages'
|
12
|
-
|
13
|
-
Dir.foreach source_root do |file| # Searching for files in app/views
|
14
|
-
m.file( file, 'app/views/base_wiki_pages/' + file ) if file != '.' && file != '..'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
data/irwi.gemspec
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{irwi}
|
8
|
-
s.version = "0.2.4"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Alexey Noskov", "Ravi Bhim"]
|
12
|
-
s.date = %q{2010-09-09}
|
13
|
-
s.description = %q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application. }
|
14
|
-
s.email = %q{alexey.noskov@gmail.com ravi.bhim@yahoo.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".document",
|
20
|
-
".gitignore",
|
21
|
-
"MIT-LICENSE",
|
22
|
-
"README.rdoc",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"app/views/base_wiki_pages/_wiki_page_actions.html.erb",
|
26
|
-
"app/views/base_wiki_pages/_wiki_page_history.html.erb",
|
27
|
-
"app/views/base_wiki_pages/_wiki_page_info.html.erb",
|
28
|
-
"app/views/base_wiki_pages/_wiki_page_style.html.erb",
|
29
|
-
"app/views/base_wiki_pages/all.html.erb",
|
30
|
-
"app/views/base_wiki_pages/compare.html.erb",
|
31
|
-
"app/views/base_wiki_pages/edit.html.erb",
|
32
|
-
"app/views/base_wiki_pages/history.html.erb",
|
33
|
-
"app/views/base_wiki_pages/new.html.erb",
|
34
|
-
"app/views/base_wiki_pages/no.html.erb",
|
35
|
-
"app/views/base_wiki_pages/not_allowed.html.erb",
|
36
|
-
"app/views/base_wiki_pages/show.html.erb",
|
37
|
-
"generators/irwi_wiki/irwi_wiki_generator.rb",
|
38
|
-
"generators/irwi_wiki/templates/controllers/wiki_pages_controller.rb",
|
39
|
-
"generators/irwi_wiki/templates/helpers/wiki_pages_helper.rb",
|
40
|
-
"generators/irwi_wiki/templates/migrate/create_wiki_pages.rb",
|
41
|
-
"generators/irwi_wiki/templates/models/wiki_page.rb",
|
42
|
-
"generators/irwi_wiki/templates/models/wiki_page_version.rb",
|
43
|
-
"generators/irwi_wiki_attachments/irwi_wiki_attachments_generator.rb",
|
44
|
-
"generators/irwi_wiki_attachments/templates/migrate/create_wiki_page_attachments.rb",
|
45
|
-
"generators/irwi_wiki_attachments/templates/models/wiki_page_attachment.rb",
|
46
|
-
"generators/irwi_wiki_views/irwi_wiki_views_generator.rb",
|
47
|
-
"irwi.gemspec",
|
48
|
-
"lib/irwi.rb",
|
49
|
-
"lib/irwi/comparators/base.rb",
|
50
|
-
"lib/irwi/comparators/diff_lcs.rb",
|
51
|
-
"lib/irwi/comparators/spans/changed_span.rb",
|
52
|
-
"lib/irwi/comparators/spans/not_changed_span.rb",
|
53
|
-
"lib/irwi/config.rb",
|
54
|
-
"lib/irwi/extensions/controllers/wiki_page_attachments.rb",
|
55
|
-
"lib/irwi/extensions/controllers/wiki_pages.rb",
|
56
|
-
"lib/irwi/extensions/models/wiki_page.rb",
|
57
|
-
"lib/irwi/extensions/models/wiki_page_attachment.rb",
|
58
|
-
"lib/irwi/extensions/models/wiki_page_version.rb",
|
59
|
-
"lib/irwi/formatters/blue_cloth.rb",
|
60
|
-
"lib/irwi/formatters/red_cloth.rb",
|
61
|
-
"lib/irwi/helpers/wiki_page_attachments_helper.rb",
|
62
|
-
"lib/irwi/helpers/wiki_pages_helper.rb",
|
63
|
-
"lib/irwi/paginators/none.rb",
|
64
|
-
"lib/irwi/paginators/will_paginate.rb",
|
65
|
-
"lib/irwi/support/route_mapper.rb",
|
66
|
-
"lib/irwi/support/template_finder.rb",
|
67
|
-
"rails/init.rb",
|
68
|
-
"spec/comparators/diff_lcs_spec.rb",
|
69
|
-
"spec/config_spec.rb",
|
70
|
-
"spec/extensions/controllers/wiki_pages_spec.rb",
|
71
|
-
"spec/extensions/models/wiki_page_spec.rb",
|
72
|
-
"spec/formatters/red_cloth_spec.rb",
|
73
|
-
"spec/helpers/wiki_page_attachments_helper_spec.rb",
|
74
|
-
"spec/helpers/wiki_pages_helper_spec.rb",
|
75
|
-
"spec/paginators/none_spec.rb",
|
76
|
-
"spec/paginators/will_paginate_spec.rb",
|
77
|
-
"spec/rcov.opts",
|
78
|
-
"spec/spec.opts",
|
79
|
-
"spec/spec_helper.rb",
|
80
|
-
"spec/support/route_mapper_spec.rb",
|
81
|
-
"spec/support/template_finder_spec.rb",
|
82
|
-
"tasks/riwiki_tasks.rake"
|
83
|
-
]
|
84
|
-
s.homepage = %q{http://github.com/alno/irwi}
|
85
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
86
|
-
s.require_paths = ["lib"]
|
87
|
-
s.rubygems_version = %q{1.3.7}
|
88
|
-
s.summary = %q{Irwi is Ruby on Rails plugin which adds wiki functionality to your application.}
|
89
|
-
s.test_files = [
|
90
|
-
"spec/support/route_mapper_spec.rb",
|
91
|
-
"spec/support/template_finder_spec.rb",
|
92
|
-
"spec/spec_helper.rb",
|
93
|
-
"spec/comparators/diff_lcs_spec.rb",
|
94
|
-
"spec/extensions/controllers/wiki_pages_spec.rb",
|
95
|
-
"spec/extensions/models/wiki_page_spec.rb",
|
96
|
-
"spec/config_spec.rb",
|
97
|
-
"spec/paginators/will_paginate_spec.rb",
|
98
|
-
"spec/paginators/none_spec.rb",
|
99
|
-
"spec/helpers/wiki_pages_helper_spec.rb",
|
100
|
-
"spec/helpers/wiki_page_attachments_helper_spec.rb",
|
101
|
-
"spec/formatters/red_cloth_spec.rb"
|
102
|
-
]
|
103
|
-
|
104
|
-
if s.respond_to? :specification_version then
|
105
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
106
|
-
s.specification_version = 3
|
107
|
-
|
108
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
109
|
-
s.add_runtime_dependency(%q<diff-lcs>, [">= 1.1.2"])
|
110
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
111
|
-
else
|
112
|
-
s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
|
113
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
114
|
-
end
|
115
|
-
else
|
116
|
-
s.add_dependency(%q<diff-lcs>, [">= 1.1.2"])
|
117
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
data/rails/init.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'irwi' # Main irwi class
|
2
|
-
require 'irwi/support/route_mapper' # Routes
|
3
|
-
|
4
|
-
ActionController::Routing::RouteSet::Mapper.instance_eval do
|
5
|
-
include Irwi::Support::RouteMapper
|
6
|
-
end
|
7
|
-
|
8
|
-
ActiveRecord::Base.instance_eval do
|
9
|
-
|
10
|
-
def acts_as_wiki_page( config = {} )
|
11
|
-
include Irwi::Extensions::Models::WikiPage
|
12
|
-
end
|
13
|
-
|
14
|
-
def acts_as_wiki_page_version( config = {} )
|
15
|
-
include Irwi::Extensions::Models::WikiPageVersion
|
16
|
-
end
|
17
|
-
|
18
|
-
def acts_as_wiki_page_attachment
|
19
|
-
include Irwi::Extensions::Models::WikiPageAttachment
|
20
|
-
yield if block_given?
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
ActionController::Base.instance_eval do
|
26
|
-
|
27
|
-
# @param config [Hash] config for controller class
|
28
|
-
# @option page_class
|
29
|
-
#
|
30
|
-
def acts_as_wiki_pages_controller( config = {} )
|
31
|
-
include Irwi::Extensions::Controllers::WikiPages
|
32
|
-
include Irwi::Extensions::Controllers::WikiPageAttachments if Irwi::config.page_attachment_class_name
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
Module.class_eval do
|
38
|
-
|
39
|
-
def acts_as_wiki_pages_helper( config = {} )
|
40
|
-
include Irwi::Helpers::WikiPagesHelper
|
41
|
-
include Irwi::Helpers::WikiPageAttachmentsHelper if Irwi::config.page_attachment_class_name
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require "spec/spec_helper"
|
2
|
-
|
3
|
-
describe Irwi::Comparators::DiffLcs do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@c = Irwi::Comparators::DiffLcs.new
|
7
|
-
end
|
8
|
-
|
9
|
-
specify "should render change for replaced text" do
|
10
|
-
@c.render_changes('AAA','BbB').should == '<span class="removed">AAA</span><span class="added">BbB</span>'
|
11
|
-
end
|
12
|
-
|
13
|
-
specify "should render no changes for same text" do
|
14
|
-
@c.render_changes('vdsds','vdsds').should == 'vdsds'
|
15
|
-
end
|
16
|
-
|
17
|
-
specify "should render addition" do
|
18
|
-
@c.render_changes('AAA','AABbA').should == 'AA<span class="added">Bb</span>A'
|
19
|
-
end
|
20
|
-
|
21
|
-
specify "should render deletion" do
|
22
|
-
@c.render_changes('AdvsADA','AdDA').should == 'Ad<span class="removed">vsA</span>DA'
|
23
|
-
end
|
24
|
-
|
25
|
-
specify "should render changed with addition" do
|
26
|
-
@c.render_changes('qwerty','qwasdfy').should == 'qw<span class="removed">ert</span><span class="added">asdf</span>y'
|
27
|
-
end
|
28
|
-
|
29
|
-
specify "should survive on nil in old" do
|
30
|
-
@c.render_changes(nil,'AdDA').should == '<span class="added">AdDA</span>'
|
31
|
-
end
|
32
|
-
|
33
|
-
specify "should survive on nil in new" do
|
34
|
-
@c.render_changes('AdDA',nil).should == '<span class="removed">AdDA</span>'
|
35
|
-
end
|
36
|
-
|
37
|
-
specify "should change \\n to <br />" do
|
38
|
-
@c.render_changes("AdDA\nhhh",'').should == '<span class="removed">AdDA<br />hhh</span>'
|
39
|
-
end
|
40
|
-
|
41
|
-
specify "should change \\r\\n to <br />" do
|
42
|
-
@c.render_changes("AdDA\r\nhhh",'').should == '<span class="removed">AdDA<br />hhh</span>'
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
data/spec/config_spec.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require "spec/spec_helper"
|
2
|
-
|
3
|
-
describe Irwi::Config do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@o = Irwi::Config.new
|
7
|
-
end
|
8
|
-
|
9
|
-
specify "should save selected user_class_name" do
|
10
|
-
@o.user_class_name = 'MyUserClass'
|
11
|
-
@o.user_class_name.should == 'MyUserClass'
|
12
|
-
end
|
13
|
-
|
14
|
-
specify "should select 'User' as user_class_name by default" do
|
15
|
-
@o.user_class_name.should == 'User'
|
16
|
-
end
|
17
|
-
|
18
|
-
specify "should save selected page_class_name" do
|
19
|
-
@o.page_class_name = 'MyPageClass'
|
20
|
-
@o.page_class_name.should == 'MyPageClass'
|
21
|
-
end
|
22
|
-
|
23
|
-
specify "should select 'WikiPage' as page_class_name by default" do
|
24
|
-
@o.page_class_name.should == 'WikiPage'
|
25
|
-
end
|
26
|
-
|
27
|
-
specify "should save selected page_version_class_name" do
|
28
|
-
@o.page_version_class_name = 'MyVersionClass'
|
29
|
-
@o.page_version_class_name.should == 'MyVersionClass'
|
30
|
-
end
|
31
|
-
|
32
|
-
specify "should select 'WikiPageVersion' as page_version_class_name by default" do
|
33
|
-
@o.page_version_class_name.should == 'WikiPageVersion'
|
34
|
-
end
|
35
|
-
|
36
|
-
specify "should save selected formatter" do
|
37
|
-
@o.formatter = :my_formatter
|
38
|
-
@o.formatter.should == :my_formatter
|
39
|
-
end
|
40
|
-
|
41
|
-
specify "should select RedCloth as formatter by default" do
|
42
|
-
Irwi::Formatters::RedCloth.should_receive(:new).and_return(:red_cloth_formatter)
|
43
|
-
|
44
|
-
@o.formatter.should == :red_cloth_formatter
|
45
|
-
end
|
46
|
-
|
47
|
-
specify "should save selected comparator" do
|
48
|
-
@o.comparator = :my_formatter
|
49
|
-
@o.comparator.should == :my_formatter
|
50
|
-
end
|
51
|
-
|
52
|
-
specify "should select DiffLcs as comparator by default" do
|
53
|
-
Irwi::Comparators::DiffLcs.should_receive(:new).and_return(:diff_lcs_comparator)
|
54
|
-
|
55
|
-
@o.comparator.should == :diff_lcs_comparator
|
56
|
-
end
|
57
|
-
|
58
|
-
specify "should contain 'all' action in system pages" do
|
59
|
-
Irwi.config.system_pages['all'].should == 'all'
|
60
|
-
end
|
61
|
-
|
62
|
-
specify "should add action in system pages" do
|
63
|
-
Irwi.config.system_pages['custom'].should be_nil
|
64
|
-
Irwi.config.add_system_page :custom, '!custom_page'
|
65
|
-
Irwi.config.system_pages['custom'].should == '!custom_page'
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require "spec/spec_helper"
|
2
|
-
|
3
|
-
require "action_controller"
|
4
|
-
|
5
|
-
describe Irwi::Extensions::Controllers::WikiPages do
|
6
|
-
|
7
|
-
class WikiPage; end
|
8
|
-
class WikiPagesController < ActionController::Base
|
9
|
-
include Irwi::Extensions::Controllers::WikiPages
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def current_user
|
14
|
-
return @current_user if defined?(@current_user)
|
15
|
-
@current_user = 'Some user'
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
it { should_not be_nil }
|
21
|
-
|
22
|
-
before(:all) do
|
23
|
-
@cls = WikiPagesController
|
24
|
-
end
|
25
|
-
|
26
|
-
context "class" do
|
27
|
-
|
28
|
-
it { @cls.should respond_to(:set_page_class) }
|
29
|
-
it { @cls.should respond_to(:page_class) }
|
30
|
-
|
31
|
-
specify "should have WikiPage as default page_class" do
|
32
|
-
@cls.page_class.should == WikiPage
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
context "instance" do
|
38
|
-
|
39
|
-
before(:each) do
|
40
|
-
@obj = @cls.new
|
41
|
-
end
|
42
|
-
|
43
|
-
it { @obj.should respond_to(:page_class) }
|
44
|
-
|
45
|
-
specify "should have WikiPage as default page_class" do
|
46
|
-
@obj.send(:page_class).should == WikiPage
|
47
|
-
end
|
48
|
-
|
49
|
-
it { @obj.should respond_to(:render_template) }
|
50
|
-
it { @obj.should respond_to(:setup_current_user) }
|
51
|
-
it { @obj.should respond_to(:setup_page) }
|
52
|
-
|
53
|
-
it { @obj.should respond_to(:show) }
|
54
|
-
it { @obj.should respond_to(:new) }
|
55
|
-
it { @obj.should respond_to(:edit) }
|
56
|
-
it { @obj.should respond_to(:update) }
|
57
|
-
it { @obj.should respond_to(:history) }
|
58
|
-
it { @obj.should respond_to(:compare) }
|
59
|
-
it { @obj.should respond_to(:destroy) }
|
60
|
-
|
61
|
-
specify "should correctly handle current_user" do
|
62
|
-
@obj.send(:setup_current_user)
|
63
|
-
@obj.send(:current_user).should == 'Some user'
|
64
|
-
@obj.instance_variable_get(:@current_user).should == 'Some user'
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|