bcms_event 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -30
- data/app/assets/javascripts/bcms_event/application.js +15 -0
- data/app/assets/stylesheets/bcms_event/application.css +13 -0
- data/app/controllers/bcms_event/events_controller.rb +2 -0
- data/app/helpers/bcms_event/application_helper.rb +4 -0
- data/app/models/{event.rb → bcms_event/event.rb} +7 -3
- data/app/portlets/event_portlet.rb +2 -2
- data/app/portlets/events_portlet.rb +3 -3
- data/app/views/{cms → bcms_event}/events/_form.html.erb +0 -0
- data/app/views/{cms → bcms_event}/events/render.html.erb +0 -0
- data/config/routes.rb +3 -0
- data/db/bcms_event.seeds.rb +8 -8
- data/db/migrate/20120524204153_v120.rb +9 -0
- data/lib/bcms_event.rb +4 -2
- data/lib/bcms_event/engine.rb +1 -0
- data/lib/bcms_event/version.rb +1 -1
- data/lib/generators/bcms_event/install/install_generator.rb +8 -3
- data/lib/tasks/bcms_event_tasks.rake +4 -0
- data/test/bcms_event_test.rb +7 -0
- data/test/integration/events_portlet_test.rb +69 -0
- data/test/support/sample_data.rb +102 -0
- data/test/support/test_logging.rb +65 -0
- data/test/test_helper.rb +15 -0
- data/test/unit/event_test.rb +33 -0
- metadata +44 -16
- data/app/controllers/cms/events_controller.rb +0 -2
- data/app/views/layouts/templates/default.html.erb +0 -17
data/Gemfile
CHANGED
@@ -1,32 +1,4 @@
|
|
1
|
-
source
|
2
|
-
|
3
|
-
# Bundle edge Rails instead:
|
4
|
-
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
1
|
+
source "http://rubygems.org"
|
5
2
|
|
3
|
+
gemspec
|
6
4
|
gem 'sqlite3'
|
7
|
-
|
8
|
-
# Use unicorn as the web server
|
9
|
-
# gem 'unicorn'
|
10
|
-
|
11
|
-
# Deploy with Capistrano
|
12
|
-
# gem 'capistrano'
|
13
|
-
|
14
|
-
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
15
|
-
# gem 'ruby-debug'
|
16
|
-
# gem 'ruby-debug19', :require => 'ruby-debug'
|
17
|
-
|
18
|
-
# Bundle the extra gems:
|
19
|
-
# gem 'bj'
|
20
|
-
# gem 'nokogiri'
|
21
|
-
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
22
|
-
# gem 'aws-s3', :require => 'aws/s3'
|
23
|
-
|
24
|
-
# Bundle gems for the local environment. Make sure to
|
25
|
-
# put test-only gems in this group so their generators
|
26
|
-
# and rake tasks are available in development mode:
|
27
|
-
# group :development, :test do
|
28
|
-
# gem 'webrat'
|
29
|
-
# end
|
30
|
-
|
31
|
-
gem "mysql"
|
32
|
-
gemspec
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -1,10 +1,13 @@
|
|
1
|
+
module BcmsEvent
|
1
2
|
class Event < ActiveRecord::Base
|
2
3
|
acts_as_content_block :taggable => true
|
3
4
|
belongs_to_category
|
4
5
|
|
5
6
|
before_validation :set_slug
|
6
7
|
validates_presence_of :name, :slug, :starts_on
|
7
|
-
|
8
|
+
|
9
|
+
attr_accessible :category, :name, :description, :starts_on
|
10
|
+
|
8
11
|
scope :starts_on, lambda {|date|
|
9
12
|
d = if date.kind_of?(Hash)
|
10
13
|
Date.new(date[:year].to_i, date[:month].to_i, date[:day].to_i)
|
@@ -12,10 +15,10 @@ class Event < ActiveRecord::Base
|
|
12
15
|
date
|
13
16
|
end
|
14
17
|
|
15
|
-
{:conditions => ["
|
18
|
+
{:conditions => ["starts_on = ?", d]}
|
16
19
|
}
|
17
20
|
|
18
|
-
scope :with_slug, lambda{|slug| {:conditions => ["
|
21
|
+
scope :with_slug, lambda{|slug| {:conditions => ["slug = ?",slug]}}
|
19
22
|
|
20
23
|
def self.default_order
|
21
24
|
"starts_on desc"
|
@@ -51,3 +54,4 @@ class Event < ActiveRecord::Base
|
|
51
54
|
end
|
52
55
|
|
53
56
|
end
|
57
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
class EventPortlet < Portlet
|
1
|
+
class EventPortlet < Cms::Portlet
|
2
2
|
|
3
3
|
enable_template_editor true
|
4
4
|
|
5
5
|
def render
|
6
6
|
# @event should already be set by the page route
|
7
7
|
if !@event && params[:event_id]
|
8
|
-
@event = Event.published.find(params[:event_id])
|
8
|
+
@event = BcmsEvent::Event.published.find(params[:event_id])
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
class EventsPortlet < Portlet
|
1
|
+
class EventsPortlet < Cms::Portlet
|
2
2
|
|
3
3
|
enable_template_editor true
|
4
4
|
|
5
5
|
def render
|
6
6
|
if self.category_id.blank?
|
7
|
-
@events = Event.published.all
|
7
|
+
@events = BcmsEvent::Event.published.all
|
8
8
|
else
|
9
|
-
@events = Event.published.all(:conditions => {:category_id => self.category_id})
|
9
|
+
@events = BcmsEvent::Event.published.all(:conditions => {:category_id => self.category_id})
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
File without changes
|
File without changes
|
data/config/routes.rb
ADDED
data/db/bcms_event.seeds.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# Load the seed data specifically for the Event Module
|
2
2
|
# Add the following line to your seeds.rb to make db:seed run this file:
|
3
3
|
# load File.expand_path('../bcms_event.seeds.rb', __FILE__)
|
4
|
-
unless CategoryType.named('Event').exists?
|
5
|
-
CategoryType.create!(:name => "Event")
|
4
|
+
unless Cms::CategoryType.named('Event').exists?
|
5
|
+
Cms::CategoryType.create!(:name => "Event")
|
6
6
|
end
|
7
7
|
|
8
|
-
ContentType.create!(:name => "Event", :group_name => "Event")
|
8
|
+
Cms::ContentType.create!(:name => "BcmsEvent::Event", :group_name => "Event")
|
9
9
|
|
10
|
-
event_page = Page.create!(
|
10
|
+
event_page = Cms::Page.create!(
|
11
11
|
:name => "Event",
|
12
12
|
:path => "/event",
|
13
|
-
:section => Section.root.first,
|
13
|
+
:section => Cms::Section.root.first,
|
14
14
|
:template_file_name => "default.html.erb")
|
15
15
|
|
16
16
|
EventPortlet.create!(
|
@@ -20,10 +20,10 @@ EventPortlet.create!(
|
|
20
20
|
:connect_to_container => "main",
|
21
21
|
:publish_on_save => true)
|
22
22
|
|
23
|
-
events_page = Page.create!(
|
23
|
+
events_page = Cms::Page.create!(
|
24
24
|
:name => "Events",
|
25
25
|
:path => "/events",
|
26
|
-
:section => Section.root.first,
|
26
|
+
:section => Cms::Section.root.first,
|
27
27
|
:template_file_name => "default.html.erb")
|
28
28
|
|
29
29
|
EventsPortlet.create!(
|
@@ -36,7 +36,7 @@ EventsPortlet.create!(
|
|
36
36
|
route = event_page.page_routes.build(
|
37
37
|
:name => "Event",
|
38
38
|
:pattern => "/events/:year/:month/:day/:slug",
|
39
|
-
:code => "@event = Event.published.starts_on(params).with_slug(params[:slug]).first")
|
39
|
+
:code => "@event = BcmsEvent::Event.published.starts_on(params).with_slug(params[:slug]).first")
|
40
40
|
route.add_condition(:method, "get")
|
41
41
|
route.add_requirement(:year, '\d{4,}')
|
42
42
|
route.add_requirement(:month, '\d{2,}')
|
data/lib/bcms_event.rb
CHANGED
data/lib/bcms_event/engine.rb
CHANGED
data/lib/bcms_event/version.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
require 'cms/module_installation'
|
2
2
|
|
3
3
|
class BcmsEvent::InstallGenerator < Cms::ModuleInstallation
|
4
|
-
add_migrations_directory_to_source_root __FILE__
|
5
4
|
|
6
|
-
|
7
|
-
|
5
|
+
def copy_migrations
|
6
|
+
rake 'bcms_event:install:migrations'
|
7
|
+
end
|
8
8
|
|
9
9
|
def add_seed_data_to_project
|
10
10
|
copy_file "../bcms_event.seeds.rb", "db/bcms_event.seeds.rb"
|
11
11
|
append_to_file "db/seeds.rb", "load File.expand_path('../bcms_event.seeds.rb', __FILE__)"
|
12
12
|
end
|
13
|
+
|
14
|
+
def add_routes
|
15
|
+
mount_engine(BcmsEvent)
|
16
|
+
end
|
17
|
+
|
13
18
|
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class EventsPortletTest < ActionController::IntegrationTest
|
4
|
+
|
5
|
+
def setup
|
6
|
+
create_baseline_data!
|
7
|
+
create_sample_data!
|
8
|
+
@events_portlet = EventsPortlet.create!(:name => "Events Portlet",
|
9
|
+
:template => EventsPortlet.default_template,
|
10
|
+
:connect_to_page_id => @events_page.id,
|
11
|
+
:connect_to_container => "main",
|
12
|
+
:publish_on_save => true)
|
13
|
+
|
14
|
+
@show_event_portlet = Factory(:event_portlet, :path=>"/event")
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_show_post
|
18
|
+
get "/events"
|
19
|
+
|
20
|
+
assert_response :success
|
21
|
+
assert_select "title", "Events"
|
22
|
+
|
23
|
+
assert_select ".event" do
|
24
|
+
assert_select ".event_starts_on", "January 19, 2009"
|
25
|
+
assert_select "a b", "Martin Luther King Day"
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_select ".event a b", {:text => "Unpublished", :count => 0}
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
test "setup" do
|
33
|
+
p = Cms::Portlet.find_by_name("Show Event")
|
34
|
+
assert_not_nil p
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
test "The 'event' page should be blank if no event parameter is supplied" do
|
39
|
+
get "/event"
|
40
|
+
|
41
|
+
assert_response :success
|
42
|
+
assert_doesnt_have_content "ERROR: undefined method `name' for nil:NilClass"
|
43
|
+
assert_has_content "Missing required parameter"
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def assert_has_content(value)
|
49
|
+
assert_match /#{value}/, @response.body
|
50
|
+
end
|
51
|
+
|
52
|
+
def assert_doesnt_have_content(value)
|
53
|
+
assert_no_match /#{value}/, @response.body
|
54
|
+
end
|
55
|
+
|
56
|
+
# Fake API for Factory Girl
|
57
|
+
def Factory(name, options={})
|
58
|
+
defaults = {:name=>"Show Event",
|
59
|
+
:connect_to_container => "main",
|
60
|
+
:template => EventPortlet.default_template,
|
61
|
+
:path => "/event",
|
62
|
+
:publish_on_save => true
|
63
|
+
}
|
64
|
+
defaults.merge!(options)
|
65
|
+
path = defaults.delete(:path)
|
66
|
+
defaults[:connect_to_page_id] = Cms::Page.with_path(path).first.id
|
67
|
+
EventPortlet.create!(defaults)
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
module Cms
|
2
|
+
module SampleData
|
3
|
+
|
4
|
+
def create_baseline_data!
|
5
|
+
@section = Section.create!(:name => "My Site", :path => "/")
|
6
|
+
g = Group.create!(:name => "Guest", :code => "guest")
|
7
|
+
g.sections = [@section]
|
8
|
+
g.save!
|
9
|
+
|
10
|
+
@page_template = PageTemplate.create!(:name => "test", :format => "html", :handler => "erb", :body => %q{<html>
|
11
|
+
<head>
|
12
|
+
<title>
|
13
|
+
<%= page_title %>
|
14
|
+
</title>
|
15
|
+
<%= yield :html_head %>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
<%= cms_toolbar %>
|
19
|
+
<%= container :main %>
|
20
|
+
</body>
|
21
|
+
</html>})
|
22
|
+
|
23
|
+
@events_page = Page.create!(:name => "Events", :section => @section, :path => "/events", :template_file_name => "test.html.erb")
|
24
|
+
@event_page = Page.create!(:name => "Event", :section => @section, :path => "/event", :template_file_name => "test.html.erb")
|
25
|
+
|
26
|
+
@event_route = @event_page.page_routes.build(
|
27
|
+
:name => "Event",
|
28
|
+
:pattern => "/events/:year/:month/:day/:slug",
|
29
|
+
:code => "@event = Event.published.starts_on(params).with_slug(params[:slug]).first")
|
30
|
+
@event_route.add_condition(:method, "get")
|
31
|
+
@event_route.add_requirement(:year, '\d{4,}')
|
32
|
+
@event_route.add_requirement(:month, '\d{2,}')
|
33
|
+
@event_route.add_requirement(:day, '\d{2,}')
|
34
|
+
@event_route.save!
|
35
|
+
|
36
|
+
@events_page.publish!
|
37
|
+
@event_page.publish!
|
38
|
+
end
|
39
|
+
|
40
|
+
def create_sample_data!
|
41
|
+
category_type = CategoryType.find_or_create_by_name("Event")
|
42
|
+
holidays = category_type.categories.find_or_create_by_name("Holidays")
|
43
|
+
ravens = category_type.categories.find_or_create_by_name("Ravens")
|
44
|
+
|
45
|
+
[ # Holidays
|
46
|
+
["January 1, 2009", "New Year's Day", "Jan. 1 every year"],
|
47
|
+
["January 19, 2009", "Martin Luther King Day", "3rd monday in Jan"],
|
48
|
+
["January 20, 2009", "Inauguration Day", "every 4th year"],
|
49
|
+
["February 16, 2009", "Presidents Day", "3rd monday in Feb\n\nPresidents Day is also Washington's Birthday"],
|
50
|
+
["May 25, 2009", "Memorial Day", "last monday in May"],
|
51
|
+
["July 4, 2009", "Independence Day", "July 4 every year"],
|
52
|
+
["September 7, 2009", "Labor Day", "1st monday in Sept"],
|
53
|
+
["October 12, 2009", "Columbus Day", "2nd monday in Oct"],
|
54
|
+
["November 11, 2009", "Veterans' Day", "Nov. 11 every year"],
|
55
|
+
["November 26, 2009", "Thanksgiving Day", "4th thursday in Nov"],
|
56
|
+
["December 25, 2009", "Christmas Day", "Dec. 25 every year"]
|
57
|
+
].each do |e|
|
58
|
+
BcmsEvent::Event.create!(
|
59
|
+
:name => e[1],
|
60
|
+
:category => holidays,
|
61
|
+
:description => e[2],
|
62
|
+
:starts_on => Date.parse(e[0]),
|
63
|
+
:publish_on_save => true)
|
64
|
+
end
|
65
|
+
|
66
|
+
[ #Ravens Games
|
67
|
+
["2009-09-13", "Baltimore vs. Kansas City, 1 p.m." ],
|
68
|
+
["2009-09-20", "Baltimore at San Diego, 4:15 p.m." ],
|
69
|
+
["2009-09-27", "Baltimore vs. Cleveland, 1 p.m." ],
|
70
|
+
["2009-10-04", "Baltimore at New England, 1 p.m." ],
|
71
|
+
["2009-10-11", "Baltimore vs. Cincinnati, 1 p.m." ],
|
72
|
+
["2009-10-18", "Baltimore at Minnesota, 1 p.m." ],
|
73
|
+
["2009-11-01", "Baltimore vs. Denver, 1 p.m." ],
|
74
|
+
["2009-11-08", "Baltimore at Cincinnati, 1 p.m." ],
|
75
|
+
["2009-11-16", "Baltimore at Cleveland, 8:30 p.m." ],
|
76
|
+
["2009-11-22", "Baltimore vs. Indianapolis, 1 p.m." ],
|
77
|
+
["2009-11-29", "Baltimore vs. Pittsburgh, 8:20 p.m."],
|
78
|
+
["2009-12-07", "Baltimore at Green Bay, 8:30 p.m." ],
|
79
|
+
["2009-12-13", "Baltimore vs. Detroit, 1 p.m." ],
|
80
|
+
["2009-12-20", "Baltimore vs. Chicago, 1 p.m." ],
|
81
|
+
["2009-12-27", "Baltimore at Pittsburgh, 1 p.m." ],
|
82
|
+
["2010-01-03", "Baltimore at Oakland, 4:15 p.m." ]
|
83
|
+
].each do |e|
|
84
|
+
BcmsEvent::Event.create!(
|
85
|
+
:name => e[1],
|
86
|
+
:category => ravens,
|
87
|
+
:starts_on => Date.parse(e[0]),
|
88
|
+
:publish_on_save => true)
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
BcmsEvent::Event.create!(
|
93
|
+
:name => "Unpublished",
|
94
|
+
:category => @general,
|
95
|
+
:description => "This event is not published",
|
96
|
+
:starts_on => Date.parse("2009-05-05"),
|
97
|
+
:publish_on_save => false)
|
98
|
+
end
|
99
|
+
extend self
|
100
|
+
end
|
101
|
+
end
|
102
|
+
ActiveSupport::TestCase.send(:include, Cms::SampleData)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module TestLogging
|
2
|
+
def log(msg)
|
3
|
+
Rails.logger.info(msg)
|
4
|
+
end
|
5
|
+
|
6
|
+
def log_array(obj, *columns)
|
7
|
+
lengths = columns.map{|m| m.to_s.length }
|
8
|
+
|
9
|
+
obj.each do |r|
|
10
|
+
columns.each_with_index do |m, i|
|
11
|
+
v = r.send(m)
|
12
|
+
if v.to_s.length > lengths[i]
|
13
|
+
lengths[i] = v.to_s.length
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
str = " "
|
19
|
+
columns.each_with_index do |m, i|
|
20
|
+
str << "%#{lengths[i]}s" % m
|
21
|
+
str << " "
|
22
|
+
end
|
23
|
+
str << "\n "
|
24
|
+
|
25
|
+
columns.each_with_index do |m, i|
|
26
|
+
str << ("-"*lengths[i])
|
27
|
+
str << " "
|
28
|
+
end
|
29
|
+
str << "\n "
|
30
|
+
|
31
|
+
obj.each do |r|
|
32
|
+
columns.each_with_index do |m, i|
|
33
|
+
str << "%#{lengths[i]}s" % r.send(m)
|
34
|
+
str << " "
|
35
|
+
end
|
36
|
+
str << "\n "
|
37
|
+
end
|
38
|
+
|
39
|
+
log str
|
40
|
+
end
|
41
|
+
|
42
|
+
def log_table(cls, options={})
|
43
|
+
if options[:include_columns]
|
44
|
+
columns = options[:include_columns]
|
45
|
+
elsif options[:exclude_columns]
|
46
|
+
columns = cls.column_names - options[:exclude_columns].map(&:to_s)
|
47
|
+
else
|
48
|
+
columns = cls.column_names
|
49
|
+
end
|
50
|
+
log_array (cls.uses_soft_delete? ? cls.find_with_deleted(:all) : cls.all), *columns
|
51
|
+
end
|
52
|
+
|
53
|
+
def log_table_with(cls, *columns)
|
54
|
+
log_table(cls, :include_columns => columns)
|
55
|
+
end
|
56
|
+
|
57
|
+
def log_table_without(cls, *columns)
|
58
|
+
log_table(cls, :exclude_columns => columns)
|
59
|
+
end
|
60
|
+
|
61
|
+
def log_table_without_stamps(cls, *columns)
|
62
|
+
log_table(cls, :exclude_columns => %w[created_at updated_at created_by_id updated_by_id] + columns)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
ActiveSupport::TestCase.send(:include, TestLogging)
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
|
7
|
+
Rails.backtrace_cleaner.remove_silencers!
|
8
|
+
|
9
|
+
# Load support files
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
11
|
+
|
12
|
+
# Load fixtures from the engine
|
13
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
14
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module BcmsEvent
|
4
|
+
class EventTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
test "create with minimum defaults" do
|
7
|
+
assert Event.create!(:name=>"Hello", :starts_on=>Date.today)
|
8
|
+
end
|
9
|
+
|
10
|
+
test "Starts On" do
|
11
|
+
last_weeks_event = Factory(:event, :starts_on=>1.week.ago)
|
12
|
+
todays_event = Factory(:event, :starts_on=>Date.today)
|
13
|
+
|
14
|
+
assert_equal [todays_event], Event.starts_on(Date.today)
|
15
|
+
end
|
16
|
+
|
17
|
+
test "with_slug" do
|
18
|
+
expected_event = Factory(:event, :name=>"Find")
|
19
|
+
unexpected_event = Factory(:event, :name=>"Dont Find")
|
20
|
+
|
21
|
+
assert_equal [expected_event], Event.with_slug("find")
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# Faking a Factory girl API until Rails 3.1 upgrade because I don't want to install it.
|
28
|
+
def Factory(name, options={})
|
29
|
+
defaults = {:name=>"Hello", :starts_on=>Date.today}
|
30
|
+
Event.create!(defaults.merge(options))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,19 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: browsercms
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - <
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: 3.6.0
|
22
|
+
- - ! '>='
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.5.0.rc3
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
|
-
version_requirements:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - <
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.6.0
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 3.5.0.rc3
|
25
36
|
description:
|
26
37
|
email: github@browsermedia.com
|
27
38
|
executables: []
|
@@ -29,31 +40,42 @@ extensions: []
|
|
29
40
|
extra_rdoc_files:
|
30
41
|
- README.markdown
|
31
42
|
files:
|
32
|
-
- app/
|
33
|
-
- app/
|
43
|
+
- app/assets/javascripts/bcms_event/application.js
|
44
|
+
- app/assets/stylesheets/bcms_event/application.css
|
45
|
+
- app/controllers/bcms_event/events_controller.rb
|
46
|
+
- app/helpers/bcms_event/application_helper.rb
|
47
|
+
- app/models/bcms_event/event.rb
|
34
48
|
- app/portlets/event_portlet.rb
|
35
49
|
- app/portlets/events_portlet.rb
|
36
|
-
- app/views/
|
37
|
-
- app/views/
|
38
|
-
- app/views/layouts/templates/default.html.erb
|
50
|
+
- app/views/bcms_event/events/_form.html.erb
|
51
|
+
- app/views/bcms_event/events/render.html.erb
|
39
52
|
- app/views/portlets/event/_form.html.erb
|
40
53
|
- app/views/portlets/event/render.html.erb
|
41
54
|
- app/views/portlets/events/_form.html.erb
|
42
55
|
- app/views/portlets/events/render.html.erb
|
43
|
-
-
|
56
|
+
- config/routes.rb
|
44
57
|
- db/bcms_event.seeds.rb
|
58
|
+
- db/migrate/20090504174621_create_events.rb
|
59
|
+
- db/migrate/20120524204153_v120.rb
|
45
60
|
- lib/bcms_event/engine.rb
|
46
61
|
- lib/bcms_event/routes.rb
|
47
62
|
- lib/bcms_event/version.rb
|
48
63
|
- lib/bcms_event.rb
|
49
64
|
- lib/generators/bcms_event/install/install_generator.rb
|
50
65
|
- lib/generators/bcms_event/install/USAGE
|
66
|
+
- lib/tasks/bcms_event_tasks.rake
|
51
67
|
- lib/tasks/install.rake
|
52
68
|
- Gemfile
|
53
69
|
- LICENSE.txt
|
54
70
|
- COPYRIGHT.txt
|
55
71
|
- GPL.txt
|
56
72
|
- README.markdown
|
73
|
+
- test/bcms_event_test.rb
|
74
|
+
- test/integration/events_portlet_test.rb
|
75
|
+
- test/support/sample_data.rb
|
76
|
+
- test/support/test_logging.rb
|
77
|
+
- test/test_helper.rb
|
78
|
+
- test/unit/event_test.rb
|
57
79
|
homepage: http://www.github.com/browsermedia/bcms_event
|
58
80
|
licenses: []
|
59
81
|
post_install_message:
|
@@ -68,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
90
|
version: '0'
|
69
91
|
segments:
|
70
92
|
- 0
|
71
|
-
hash: -
|
93
|
+
hash: -2548135507574776181
|
72
94
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
95
|
none: false
|
74
96
|
requirements:
|
@@ -77,11 +99,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
99
|
version: '0'
|
78
100
|
segments:
|
79
101
|
- 0
|
80
|
-
hash: -
|
102
|
+
hash: -2548135507574776181
|
81
103
|
requirements: []
|
82
104
|
rubyforge_project: bcms_event
|
83
|
-
rubygems_version: 1.8.
|
105
|
+
rubygems_version: 1.8.24
|
84
106
|
signing_key:
|
85
107
|
specification_version: 3
|
86
108
|
summary: The Event Module for BrowserCMS
|
87
|
-
test_files:
|
109
|
+
test_files:
|
110
|
+
- test/bcms_event_test.rb
|
111
|
+
- test/integration/events_portlet_test.rb
|
112
|
+
- test/support/sample_data.rb
|
113
|
+
- test/support/test_logging.rb
|
114
|
+
- test/test_helper.rb
|
115
|
+
- test/unit/event_test.rb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
3
|
-
<head>
|
4
|
-
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
5
|
-
<title><%= page_title %></title>
|
6
|
-
<%= yield :html_head %>
|
7
|
-
</head>
|
8
|
-
<body style="margin: 0; padding: 0; text-align: center;">
|
9
|
-
<%= cms_toolbar %>
|
10
|
-
<div id="wrapper" style="width: 700px; margin: 0 auto; text-align: left; padding: 30px">
|
11
|
-
Breadcrumbs: <%= render_breadcrumbs %>
|
12
|
-
Main Menu: <%= render_menu %>
|
13
|
-
<h1><%= page_title %></h1>
|
14
|
-
<%= container :main %>
|
15
|
-
</div>
|
16
|
-
</body>
|
17
|
-
</html>
|