qcourses 0.1.7 → 0.1.8
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/.rspec +1 -0
- data/lib/qcourses/qcourses.rake.rb +3 -2
- data/lib/qcourses/version.rb +1 -1
- data/lib/qcourses/view_helpers.rb +5 -0
- data/spec/qcourses/view_helpers_spec.rb +21 -0
- data/views/events/index.haml +1 -1
- metadata +3 -3
data/.rspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
|
2
2
|
desc "project console"
|
3
3
|
task :console => :environment do
|
4
|
-
sh "irb -I #{File.expand_path('lib', File.dirname(__FILE__)) } -r qcourses"
|
4
|
+
sh "irb -I #{File.expand_path('../../lib', File.dirname(__FILE__)) } -r qcourses"
|
5
5
|
end
|
6
6
|
|
7
7
|
desc "project environment"
|
8
8
|
task :environment do
|
9
|
+
p "setting environment"
|
9
10
|
ENV['RACK_ENV'] ||= 'development'
|
10
11
|
end
|
11
12
|
|
@@ -13,7 +14,7 @@ namespace :db do
|
|
13
14
|
desc "migrate the database"
|
14
15
|
task :migrate, [:version] => :environment do |t, args|
|
15
16
|
migration_dir = File.expand_path('../../db/migrations', File.dirname(__FILE__))
|
16
|
-
command = ["sequel -E config/database.yml -m #{migration_dir}"]
|
17
|
+
command = ["sequel -e #{ENV['RACK_ENV']} -E config/database.yml -m #{migration_dir}"]
|
17
18
|
command << "-M #{args[:version]}" if args[:version]
|
18
19
|
sh command.join(' ')
|
19
20
|
end
|
data/lib/qcourses/version.rb
CHANGED
@@ -31,6 +31,11 @@ module Qcourses
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def event_registration_link(event)
|
35
|
+
return "closed" unless event.open
|
36
|
+
haml "%a{ :href=> url('/registrations/new/#{event.id}') } register"
|
37
|
+
end
|
38
|
+
|
34
39
|
def input_for(object, attribute_name, options={})
|
35
40
|
object = instance_variable_get("@#{object}") if object.is_a?(Symbol)
|
36
41
|
return '' unless object
|
@@ -4,7 +4,9 @@ module Qcourses
|
|
4
4
|
describe ViewHelpers do
|
5
5
|
require 'sinatra'
|
6
6
|
let(:template_cache) { Tilt::Cache.new }
|
7
|
+
let(:app) { Sinatra::Base.new }
|
7
8
|
include Sinatra::Templates
|
9
|
+
include Sinatra::Helpers
|
8
10
|
include ViewHelpers
|
9
11
|
|
10
12
|
describe 'human_period' do
|
@@ -116,5 +118,24 @@ module Qcourses
|
|
116
118
|
end
|
117
119
|
end
|
118
120
|
end
|
121
|
+
|
122
|
+
describe "event_registration_link", :focus => true do
|
123
|
+
def html_for(result)
|
124
|
+
Capybara.string(result)
|
125
|
+
end
|
126
|
+
def url(addr = nil, absolute = true, add_script_name = true)
|
127
|
+
addr
|
128
|
+
end
|
129
|
+
let(:event) { Rubory.build :event }
|
130
|
+
it "contains a registration link" do
|
131
|
+
p event
|
132
|
+
html_for(event_registration_link(event)).should have_selector("a[href='/registrations/new/#{event.id}']")
|
133
|
+
end
|
134
|
+
it "contains no registration link if event is closed" do
|
135
|
+
event.open = false
|
136
|
+
html_for(event_registration_link(event)).should_not have_selector("a[href='/registrations/new/#{event.id}']")
|
137
|
+
html_for(event_registration_link(event)).should have_content("closed")
|
138
|
+
end
|
139
|
+
end
|
119
140
|
end
|
120
141
|
end
|
data/views/events/index.haml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qcourses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-25 00:00:00.
|
12
|
+
date: 2012-04-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project: qcourses
|
246
|
-
rubygems_version: 1.8.
|
246
|
+
rubygems_version: 1.8.21
|
247
247
|
signing_key:
|
248
248
|
specification_version: 3
|
249
249
|
summary: Small course event module for sinatra site
|