rhyhann-merb_stathyc_slice 0.1

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.
Files changed (41) hide show
  1. data/LICENSE +21 -0
  2. data/README.markdown +106 -0
  3. data/Rakefile +55 -0
  4. data/TODO +5 -0
  5. data/app/controllers/application.rb +3 -0
  6. data/app/controllers/pages.rb +62 -0
  7. data/app/helpers/application_helper.rb +136 -0
  8. data/app/helpers/pages_helper.rb +49 -0
  9. data/app/models/page.rb +49 -0
  10. data/app/views/layout/static_slice.html.haml +27 -0
  11. data/app/views/pages/_cud.html.haml +11 -0
  12. data/app/views/pages/_sidebar.html.haml +2 -0
  13. data/app/views/pages/delete.html.haml +2 -0
  14. data/app/views/pages/edit.html.haml +6 -0
  15. data/app/views/pages/index.html.haml +5 -0
  16. data/app/views/pages/new.html.haml +6 -0
  17. data/app/views/pages/show.html.haml +5 -0
  18. data/lib/static_slice.rb +85 -0
  19. data/lib/static_slice/merbtasks.rb +103 -0
  20. data/lib/static_slice/slicetasks.rb +18 -0
  21. data/lib/static_slice/spectasks.rb +65 -0
  22. data/public/images/css/banner_mountains.jpg +0 -0
  23. data/public/images/css/bg.png +0 -0
  24. data/public/images/css/bg02-blue-left.png +0 -0
  25. data/public/images/css/bg02-blue-right.png +0 -0
  26. data/public/images/css/bg02-left.png +0 -0
  27. data/public/images/css/bg02-right.png +0 -0
  28. data/public/images/css/bg02-white-left.png +0 -0
  29. data/public/images/css/bg02-white-right.png +0 -0
  30. data/public/images/css/logo.png +0 -0
  31. data/public/images/css/menu.png +0 -0
  32. data/public/images/css/menuleft.png +0 -0
  33. data/public/images/css/menuright.png +0 -0
  34. data/public/stylesheets/master.css +138 -0
  35. data/spec/models/page_spec.rb +7 -0
  36. data/spec/requests/pages_spec.rb +110 -0
  37. data/spec/spec_helper.rb +43 -0
  38. data/spec/static_slice_spec.rb +19 -0
  39. data/stubs/app/controllers/application.rb +2 -0
  40. data/stubs/app/controllers/main.rb +2 -0
  41. metadata +118 -0
@@ -0,0 +1,7 @@
1
+ require File.join( File.dirname(__FILE__), '..', "spec_helper" )
2
+
3
+ describe Page do
4
+
5
+ it "should have specs"
6
+
7
+ end
@@ -0,0 +1,110 @@
1
+ require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
2
+
3
+ given "a page exists" do
4
+ Page.all.destroy!
5
+ request(resource(:pages), :method => "POST",
6
+ :params => { :page => { :id => nil }})
7
+ end
8
+
9
+ describe "resource(:pages)" do
10
+ describe "GET" do
11
+
12
+ before(:each) do
13
+ @response = request(resource(:pages))
14
+ end
15
+
16
+ it "responds successfully" do
17
+ @response.should be_successful
18
+ end
19
+
20
+ it "contains a list of pages" do
21
+ pending
22
+ @response.should have_xpath("//ul")
23
+ end
24
+
25
+ end
26
+
27
+ describe "GET", :given => "a page exists" do
28
+ before(:each) do
29
+ @response = request(resource(:pages))
30
+ end
31
+
32
+ it "has a list of pages" do
33
+ pending
34
+ @response.should have_xpath("//ul/li")
35
+ end
36
+ end
37
+
38
+ describe "a successful POST" do
39
+ before(:each) do
40
+ Page.all.destroy!
41
+ @response = request(resource(:pages), :method => "POST",
42
+ :params => { :page => { :id => nil }})
43
+ end
44
+
45
+ it "redirects to resource(:pages)" do
46
+ @response.should redirect_to(resource(Page.first), :message => {:notice => "page was successfully created"})
47
+ end
48
+
49
+ end
50
+ end
51
+
52
+ describe "resource(@page)" do
53
+ describe "a successful DELETE", :given => "a page exists" do
54
+ before(:each) do
55
+ @response = request(resource(Page.first), :method => "DELETE")
56
+ end
57
+
58
+ it "should redirect to the index action" do
59
+ @response.should redirect_to(resource(:pages))
60
+ end
61
+
62
+ end
63
+ end
64
+
65
+ describe "resource(:pages, :new)" do
66
+ before(:each) do
67
+ @response = request(resource(:pages, :new))
68
+ end
69
+
70
+ it "responds successfully" do
71
+ @response.should be_successful
72
+ end
73
+ end
74
+
75
+ describe "resource(@page, :edit)", :given => "a page exists" do
76
+ before(:each) do
77
+ @response = request(resource(Page.first, :edit))
78
+ end
79
+
80
+ it "responds successfully" do
81
+ @response.should be_successful
82
+ end
83
+ end
84
+
85
+ describe "resource(@page)", :given => "a page exists" do
86
+
87
+ describe "GET" do
88
+ before(:each) do
89
+ @response = request(resource(Page.first))
90
+ end
91
+
92
+ it "responds successfully" do
93
+ @response.should be_successful
94
+ end
95
+ end
96
+
97
+ describe "PUT" do
98
+ before(:each) do
99
+ @page = Page.first
100
+ @response = request(resource(@page), :method => "PUT",
101
+ :params => { :page => {:id => @page.id} })
102
+ end
103
+
104
+ it "redirect to the article show action" do
105
+ @response.should redirect_to(resource(@page))
106
+ end
107
+ end
108
+
109
+ end
110
+
@@ -0,0 +1,43 @@
1
+ require 'rubygems'
2
+ require 'merb-core'
3
+ require 'merb-slices'
4
+ require 'spec'
5
+
6
+ # Add static_slice.rb to the search path
7
+ Merb::Plugins.config[:merb_slices][:auto_register] = true
8
+ Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FILE__), '..', 'lib', 'static_slice.rb')
9
+
10
+ # Using Merb.root below makes sure that the correct root is set for
11
+ # - testing standalone, without being installed as a gem and no host application
12
+ # - testing from within the host application; its root will be used
13
+ Merb.start_environment(
14
+ :testing => true,
15
+ :adapter => 'runner',
16
+ :environment => ENV['MERB_ENV'] || 'test',
17
+ :session_store => 'memory'
18
+ )
19
+
20
+ module Merb
21
+ module Test
22
+ module SliceHelper
23
+
24
+ # The absolute path to the current slice
25
+ def current_slice_root
26
+ @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
27
+ end
28
+
29
+ # Whether the specs are being run from a host application or standalone
30
+ def standalone?
31
+ Merb.root == ::StaticSlice.root
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+
38
+ Spec::Runner.configure do |config|
39
+ config.include(Merb::Test::ViewHelper)
40
+ config.include(Merb::Test::RouteHelper)
41
+ config.include(Merb::Test::ControllerHelper)
42
+ config.include(Merb::Test::SliceHelper)
43
+ end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe "StaticSlice (module)" do
4
+
5
+ # Implement your StaticSlice specs here
6
+
7
+ it "should have proper specs"
8
+
9
+ # To spec StaticSlice you need to hook it up to the router like this:
10
+
11
+ # before :all do
12
+ # Merb::Router.prepare { add_slice(:StaticSlice) } if standalone?
13
+ # end
14
+ #
15
+ # after :all do
16
+ # Merb::Router.reset! if standalone?
17
+ # end
18
+
19
+ end
@@ -0,0 +1,2 @@
1
+ class StaticSlice::Application < Merb::Controller
2
+ end
@@ -0,0 +1,2 @@
1
+ class StaticSlice::Main < StaticSlice::Application
2
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rhyhann-merb_stathyc_slice
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Othmane Benkirane (rhyhann)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-22 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: merb-slices
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "1.0"
23
+ version:
24
+ description: Merb Slice that provides core static pages functionnalities
25
+ email: eo-in-rhyhann-net
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.markdown
32
+ - LICENSE
33
+ - TODO
34
+ files:
35
+ - LICENSE
36
+ - README.markdown
37
+ - Rakefile
38
+ - TODO
39
+ - lib/static_slice.rb
40
+ - lib/static_slice
41
+ - lib/static_slice/slicetasks.rb
42
+ - lib/static_slice/merbtasks.rb
43
+ - lib/static_slice/spectasks.rb
44
+ - spec/models
45
+ - spec/models/page_spec.rb
46
+ - spec/requests
47
+ - spec/requests/pages_spec.rb
48
+ - spec/controllers
49
+ - spec/spec_helper.rb
50
+ - spec/static_slice_spec.rb
51
+ - app/models
52
+ - app/models/page.rb
53
+ - app/views
54
+ - app/views/layout
55
+ - app/views/layout/static_slice.html.haml
56
+ - app/views/pages
57
+ - app/views/pages/new.html.haml
58
+ - app/views/pages/edit.html.haml
59
+ - app/views/pages/delete.html.haml
60
+ - app/views/pages/_cud.html.haml
61
+ - app/views/pages/_sidebar.html.haml
62
+ - app/views/pages/show.html.haml
63
+ - app/views/pages/index.html.haml
64
+ - app/views/main
65
+ - app/helpers
66
+ - app/helpers/pages_helper.rb
67
+ - app/helpers/application_helper.rb
68
+ - app/controllers
69
+ - app/controllers/application.rb
70
+ - app/controllers/pages.rb
71
+ - public/images
72
+ - public/images/css
73
+ - public/images/css/bg02-right.png
74
+ - public/images/css/bg02-blue-right.png
75
+ - public/images/css/bg02-blue-left.png
76
+ - public/images/css/bg.png
77
+ - public/images/css/banner_mountains.jpg
78
+ - public/images/css/menuleft.png
79
+ - public/images/css/menuright.png
80
+ - public/images/css/bg02-white-right.png
81
+ - public/images/css/menu.png
82
+ - public/images/css/bg02-left.png
83
+ - public/images/css/bg02-white-left.png
84
+ - public/images/css/logo.png
85
+ - public/stylesheets
86
+ - public/stylesheets/master.css
87
+ - stubs/app
88
+ - stubs/app/controllers
89
+ - stubs/app/controllers/application.rb
90
+ - stubs/app/controllers/main.rb
91
+ has_rdoc: true
92
+ homepage: http://github.com/rhyhann/merb-stathyc_slice
93
+ post_install_message:
94
+ rdoc_options: []
95
+
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: "0"
103
+ version:
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: "0"
109
+ version:
110
+ requirements: []
111
+
112
+ rubyforge_project: merb
113
+ rubygems_version: 1.2.0
114
+ signing_key:
115
+ specification_version: 2
116
+ summary: Merb Slice that provides core static pages functionnalities
117
+ test_files: []
118
+