Merge upstream/dev into show-roles and re-add myself to CONTRIBUTORS.md

Conflicts:
	CONTRIBUTORS.md
This commit is contained in:
twconquest
2015-08-17 17:04:27 +00:00
35 changed files with 192 additions and 115 deletions

View File

@@ -1 +1 @@
2.1.5
2.1.6

View File

@@ -9,7 +9,7 @@ env:
secure: "Z5TpM2jEX4UCvNePnk/LwltQX48U2u9BRc+Iypr1x9QW2o228QJhPIOH39a8RMUrepGnkQIq9q3ZRUn98RfrJz1yThtlNFL3NmzdQ57gKgjGwfpa0e4Dwj/ZJqV2D84tDGjvdVYLP7zzaYZxQcwk/cgNpzKf/jq97HLNP7CYuf4="
bundler_args: "--without development production staging"
rvm:
- 2.1.5
- 2.1.6
before_script:
- psql -c 'create database growstuff_test;' -U postgres
script:

View File

@@ -64,4 +64,5 @@ submit the change with your pull request.
- Manmeet Singh / [manmeetsingh](https://github.com/manmeetsingh)
- Jym Paul Carandang / [jacarandang](https://github.com/jacarandang)
- Anthony Atkinson / [sha1sum](https://github.com/sha1sum)
- Terence Conquest / [twconquest](https://github.com/twconquest)
- Terence Conquest / [twconquest](https://github.com/twconquest)
- Daniel O'Connor / [CloCkWeRX](https://github.com/CloCkWeRX)

View File

@@ -1,8 +1,8 @@
source 'https://rubygems.org'
ruby '2.1.5'
ruby '2.1.6'
gem 'rails', '4.1.9'
gem 'rails', '4.1.11'
gem 'bundler', '>=1.1.5'
@@ -35,6 +35,9 @@ gem 'ruby-units' # for unit conversion
gem 'comfortable_mexican_sofa', '~> 1.12.0' # content management system
gem 'kaminari' # pagination
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
# vendored activemerchant for testing- needed for bogus paypal
# gateway monkeypatch
gem 'activemerchant', '1.33.0',

View File

@@ -20,29 +20,29 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
actionmailer (4.1.11)
actionpack (= 4.1.11)
actionview (= 4.1.11)
mail (~> 2.5, >= 2.5.4)
actionpack (4.1.9)
actionview (= 4.1.9)
activesupport (= 4.1.9)
actionpack (4.1.11)
actionview (= 4.1.11)
activesupport (= 4.1.11)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
actionview (4.1.9)
activesupport (= 4.1.9)
actionview (4.1.11)
activesupport (= 4.1.11)
builder (~> 3.1)
erubis (~> 2.7.0)
active_link_to (1.0.2)
actionpack
activemodel (4.1.9)
activesupport (= 4.1.9)
activemodel (4.1.11)
activesupport (= 4.1.11)
builder (~> 3.1)
activerecord (4.1.9)
activemodel (= 4.1.9)
activesupport (= 4.1.9)
activerecord (4.1.11)
activemodel (= 4.1.11)
activesupport (= 4.1.11)
arel (~> 5.0.0)
activesupport (4.1.9)
activesupport (4.1.11)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
@@ -64,6 +64,9 @@ GEM
bonsai-elasticsearch-rails (0.0.4)
bootstrap-datepicker-rails (1.3.0.2)
railties (>= 3.0)
bootstrap-kaminari-views (0.0.5)
kaminari (>= 0.13)
rails (>= 3.1)
bootstrap-sass (3.3.3)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.2.19)
@@ -86,7 +89,7 @@ GEM
climate_control (0.0.3)
activesupport (>= 3.0)
cliver (0.3.2)
cocaine (0.5.5)
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
codemirror-rails (4.8)
railties (>= 3.0, < 5)
@@ -136,6 +139,8 @@ GEM
warden (~> 1.2.3)
diff-lcs (1.2.5)
docile (1.1.5)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
easy_translate (0.5.0)
json
thread
@@ -210,6 +215,8 @@ GEM
haml (>= 4.0.0.rc.1)
hpricot (~> 0.8.6)
ruby_parser (~> 3.1.1)
http-cookie (1.0.2)
domain_name (~> 0.5)
httparty (0.13.3)
json (~> 1.8)
multi_xml (>= 0.5.2)
@@ -223,7 +230,7 @@ GEM
slop (>= 3.5.0)
term-ansicolor
terminal-table
jquery-rails (3.1.2)
jquery-rails (3.1.3)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.3)
@@ -231,7 +238,10 @@ GEM
js-routes (0.9.9)
railties (>= 3.2)
sprockets-rails
json (1.8.2)
json (1.8.3)
kaminari (0.16.3)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
kgio (2.9.2)
kramdown (1.5.0)
launchy (2.4.3)
@@ -257,14 +267,15 @@ GEM
mime-types (>= 1.16, < 3)
memcachier (0.0.2)
method_source (0.8.2)
mime-types (2.4.3)
mime-types (2.6.1)
mimemagic (0.3.0)
mini_portile (0.6.1)
minitest (5.5.1)
multi_json (1.10.1)
minitest (5.8.0)
multi_json (1.11.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
nenv (0.2.0)
netrc (0.10.0)
netrc (0.10.3)
newrelic_rpm (3.9.8.273)
nokogiri (1.6.5)
mini_portile (~> 0.6.0)
@@ -284,11 +295,12 @@ GEM
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.5.0)
paperclip (4.2.1)
activemodel (>= 3.0.0)
activesupport (>= 3.0.0)
cocaine (~> 0.5.3)
paperclip (4.3.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (= 0.3.0)
pg (0.17.1)
plupload-rails (1.2.1)
rails (>= 3.1)
@@ -303,18 +315,18 @@ GEM
slop (~> 3.4)
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.5.2)
rack (1.5.5)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.1.9)
actionmailer (= 4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
activemodel (= 4.1.9)
activerecord (= 4.1.9)
activesupport (= 4.1.9)
rails (4.1.11)
actionmailer (= 4.1.11)
actionpack (= 4.1.11)
actionview (= 4.1.11)
activemodel (= 4.1.11)
activerecord (= 4.1.11)
activesupport (= 4.1.11)
bundler (>= 1.3.0, < 2.0)
railties (= 4.1.9)
railties (= 4.1.11)
sprockets-rails (~> 2.0)
rails-i18n (4.0.3)
i18n (~> 0.6)
@@ -324,9 +336,9 @@ GEM
rails_stdout_logging
rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3)
railties (4.1.9)
actionpack (= 4.1.9)
activesupport (= 4.1.9)
railties (4.1.11)
actionpack (= 4.1.11)
activesupport (= 4.1.11)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
raindrops (0.13.0)
@@ -337,7 +349,8 @@ GEM
ref (1.0.5)
responders (1.1.2)
railties (>= 3.2, < 4.2)
rest-client (1.7.2)
rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
rspec (3.1.0)
@@ -381,12 +394,12 @@ GEM
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.6.0)
sprockets (2.12.3)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.2)
sprockets-rails (2.3.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
@@ -398,7 +411,7 @@ GEM
ref
thor (0.19.1)
thread (0.1.4)
thread_safe (0.3.4)
thread_safe (0.3.5)
tilt (1.4.1)
tins (1.3.3)
tzinfo (1.2.2)
@@ -406,6 +419,9 @@ GEM
uglifier (2.5.3)
execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (4.8.3)
kgio (~> 2.6)
rack
@@ -434,6 +450,7 @@ DEPENDENCIES
bluecloth
bonsai-elasticsearch-rails
bootstrap-datepicker-rails
bootstrap-kaminari-views
bundler (>= 1.1.5)
byebug
cancancan (~> 1.9)
@@ -464,6 +481,7 @@ DEPENDENCIES
jquery-rails
jquery-ui-rails (~> 5.0.2)
js-routes
kaminari
leaflet-markercluster-rails
leaflet-rails
less (~> 2.5.0)
@@ -480,7 +498,7 @@ DEPENDENCIES
poltergeist (~> 1.6)
pry
quiet_assets
rails (= 4.1.9)
rails (= 4.1.11)
rails_12factor
rake (>= 10.0.0)
rspec-activemodel-mocks

View File

@@ -9,11 +9,11 @@ jQuery ->
finished = $('#planting_finished_at')
if @checked
if previousValue.length
date = previousValue
date = previousValue
finished.val(date)
else
finished.trigger('focus')
else
previousValue = finished.val()
finished.val('')
)
)

View File

@@ -5,7 +5,7 @@ class NotificationsController < ApplicationController
# GET /notifications
def index
@notifications = Notification.where(recipient_id: current_member)
@notifications = Notification.where(recipient_id: current_member).page(params[:page])
respond_to do |format|
format.html # index.html.erb

View File

@@ -2,12 +2,19 @@ class Notifier < ActionMailer::Base
include NotificationsHelper
default from: "Growstuff <noreply@growstuff.org>"
def verifier()
if ENV['RAILS_SECRET_TOKEN']
return ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
else
raise "RAILS_SECRET_TOKEN environment variable not set - have you created config/application.yml?"
end
end
def notify(notification)
@notification = notification
@reply_link = reply_link(@notification)
# Encrypting
verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
@signed_message = verifier.generate ({ member_id: @notification.recipient.id, type: :send_notification_email })
mail(:to => @notification.recipient.email,
@@ -21,7 +28,6 @@ class Notifier < ActionMailer::Base
@harvests = @member.harvests.first(5)
# Encrypting
verifier = ActiveSupport::MessageVerifier.new(ENV['RAILS_SECRET_TOKEN'])
@signed_message = verifier.generate ({ member_id: @member.id, type: :send_planting_reminder })
if @member.send_planting_reminder

View File

@@ -105,7 +105,7 @@ class Planting < ActiveRecord::Base
if differences.compact.empty?
nil
else
differences.compact.sum/differences.compact.length
differences.compact.sum/differences.compact.size
end
end

View File

@@ -9,24 +9,28 @@
%span.help-block If you change your email address you will have to reconfirm.
.form-group
.col-md-offset-2.col-md-8
= f.check_box :show_email
Show email publicly on your profile page.
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :show_email
Show email publicly on your profile page.
.form-group
.col-md-offset-2.col-md-8
= f.check_box :send_notification_email
Receive emailed copies of Inbox notifications (eg. private messages).
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :send_notification_email
Receive emailed copies of Inbox notifications (eg. private messages).
.form-group
.col-md-offset-2.col-md-8
= f.check_box :send_planting_reminder
Receive regular reminders to track your planting and harvesting.
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :send_planting_reminder
Receive regular reminders to track your planting and harvesting.
.form-group
.col-md-offset-2.col-md-8
= f.check_box :newsletter
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :newsletter
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
.help-block
= render :partial => 'newsletter_blurb'

View File

@@ -26,15 +26,17 @@
.col-md-8= f.password_field :password_confirmation, :class => 'form-control'
.form-group
.col-md-offset-2.col-md-8
= f.check_box :tos_agreement
I agree to the
= succeed "." do
= link_to 'Terms of Service', url_for(:action => 'tos', :controller => '/policy')
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :tos_agreement
I agree to the
= succeed "." do
= link_to 'Terms of Service', url_for(:action => 'tos', :controller => '/policy')
.form-group
.col-md-offset-2.col-md-8
= f.check_box :newsletter, :checked => true
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
.col-md-offset-2.col-md-8.checkbox
%label
= f.check_box :newsletter, :checked => true
Subscribe to the #{ENV['GROWSTUFF_SITE_NAME']} newsletter
.help-inline
= render :partial => 'newsletter_blurb'

View File

@@ -15,9 +15,10 @@
- if devise_mapping.rememberable?
.form-group
.col-md-8.col-md-offset-2
= f.check_box :remember_me
Remember me
.col-md-8.col-md-offset-2.checkbox
%label
= f.check_box :remember_me
Remember me
.form-group
.form-actions.col-md-8.col-md-offset-2

View File

@@ -25,9 +25,9 @@
%dd= garden.active ? "Yes" : "No"
.col-md-12
%b
= "#{pluralize(garden.plantings.count, "Planting")} : "
= "#{pluralize(garden.plantings.size, "Planting")} : "
= display_garden_plantings(garden.plantings.current)
- if garden.plantings.count > 2
- if garden.plantings.size > 2
%br
= link_to "See more plantings >>", garden_path(garden)
.panel-footer

View File

@@ -1,7 +1,7 @@
- cache("homepage_stats") do
%p.stats
= t('.message_html', { member: link_to(t('.member_linktext', count: Member.confirmed.count.to_i), members_path),
number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path),
= t('.message_html', { member: link_to(t('.member_linktext', count: Member.confirmed.size.to_i), members_path),
number_crops: link_to(t('.number_crops_linktext', count: Crop.count.to_i), crops_path),
number_plantings: link_to(t('.number_plantings_linktext', count: Planting.count.to_i), plantings_path),
number_gardens: link_to(t('.number_gardens_linktext', count: Garden.count.to_i), gardens_path) })

View File

@@ -7,3 +7,6 @@
!= cms_snippet_content(:footer2)
.col-md-4#footer3
!= cms_snippet_content(:footer3)
%div(style="float: right;")
%a(href="http://opendefinition.org/ossd/")
%img(src="http://assets.okfn.org/images/ok_buttons/os_80x15_blue.png" alt="")

View File

@@ -1,6 +1,7 @@
- content_for :title, "Inbox"
- if @notifications.size > 0
= paginate @notifications, theme: 'twitter-bootstrap-3'
%table.table.table-striped
%tr
%th From
@@ -28,5 +29,6 @@
%strong= n.created_at
%td
= link_to 'Delete', n, method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-default btn-xs'
= paginate @notifications, theme: 'twitter-bootstrap-3'
- else
You have no messages.

View File

@@ -1,4 +1,4 @@
- if DateTime.now.to_date < planting.planted_at
- if (planting.planted_at.nil? || DateTime.now.to_date < planting.planted_at)
= "Progress: 0% - not planted yet"
= render partial: "plantings/progress_bar", locals: {status: "warning", progress: "100%"}
- elsif planting.finished?

View File

@@ -15,7 +15,8 @@
%td.hidden-xs
=link_to post.author, post.author
%td
= distance_of_time_in_words(post.recent_activity, Time.zone.now)
ago
= post.recent_activity.to_date.to_formatted_s(:short)
// once the site gets more active, can change this to include time as well
// can't make it relative (distance_of_time_in_words) as it's cached
%td.hidden-xs
= post.comments.size.to_s

View File

@@ -11,6 +11,9 @@ csv.headers :id,
:latitude,
:longitude,
:description,
:organic,
:gmo,
:heirloom,
:date_added,
:last_modified,
:license
@@ -37,6 +40,9 @@ csv.headers :id,
csv.cell :longitude, s.owner.longitude
csv.cell :description
csv.cell :organic
csv.cell :gmo
csv.cell :heirloom
csv.cell :date_added, s.created_at.to_s(:db)
csv.cell :last_modified, s.updated_at.to_s(:db)

View File

@@ -12,6 +12,9 @@
:escaped
<p>Quantity: #{seed.quantity ? seed.quantity : 'unknown' }</p>
<p>Plant before: #{seed.plant_before ? seed.plant_before : 'unknown' }</p>
<p>Organic? #{seed.organic}</p>
<p>GMO? #{seed.gmo}</p>
<p>Heirloom? #{seed.heirloom}</p>
- if seed.tradable?
:escaped
<p>Will trade #{seed.tradable_to} from #{seed.owner.location ? seed.owner.location : 'unknown location'}</p>

View File

@@ -115,7 +115,7 @@ describe PhotosController do
post :create, {:photo => { :flickr_photo_id => photo.flickr_photo_id },
:type => "planting",
:id => planting.id }
Photo.last.plantings.count.should eq 1
Photo.last.plantings.size.should eq 1
end
it "attaches the photo to a harvest" do
@@ -140,7 +140,7 @@ describe PhotosController do
post :create, {:photo => { :flickr_photo_id => photo.flickr_photo_id },
:type => "harvest",
:id => harvest.id }
Photo.last.harvests.count.should eq 1
Photo.last.harvests.size.should eq 1
end
end

View File

@@ -2,11 +2,16 @@ require 'rails_helper'
feature "footer" do
before { visit root_path }
scenario "footer is on home page" do
visit root_path
expect(page).to have_css 'footer'
end
it 'has the Open Service link and graphic' do
expect(page).to have_selector 'a[href="http://opendefinition.org/ossd/"]'
end
# NB: not testing specific content in the footer since I'm going to put them
# in the CMS and they'll be variable.
end

View File

@@ -23,8 +23,8 @@ feature "Harvesting a crop", :js do
expect(page).to have_selector 'textarea#harvest_description[placeholder="optional"]'
end
scenario "Creating a new harvest", :js => true do
fill_autocomplete "crop", :with => "mai"
scenario "Creating a new harvest", :js do
fill_autocomplete "crop", with: "mai"
select_from_autocomplete "maize"
within "form#new_harvest" do
fill_in "When?", with: "2014-06-15"
@@ -38,7 +38,7 @@ feature "Harvesting a crop", :js do
end
context "Clicking edit from the index page" do
let!(:harvest) { FactoryGirl.create(:harvest, :crop => maize, :owner => member) }
let!(:harvest) { create :harvest, crop: maize, owner: member }
background do
visit harvests_path

View File

@@ -28,4 +28,25 @@ feature "Notifications", :js do
expect(page).to have_content "Message was successfully sent"
end
end
describe 'pagination' do
before do
34.times { FactoryGirl.create :notification, recipient: recipient }
login_as recipient
visit notifications_path
end
it 'has page navigation' do
expect(page).to have_selector 'a[rel="next"]'
end
it 'paginates at 30 notifications per page' do
expect(page).to have_selector 'tr', count: 31
end
it 'navigates pages' do
first('a[rel="next"]').click
expect(page).to have_selector 'tr', count: 5
end
end
end

View File

@@ -232,7 +232,7 @@ describe Crop do
Crop.interesting.should include @crop1
Crop.interesting.should include @crop2
Crop.interesting.length.should == 2
Crop.interesting.size.should == 2
end
it 'ignores crops without plantings' do
@@ -254,7 +254,7 @@ describe Crop do
Crop.interesting.should include @crop1
Crop.interesting.should_not include @crop2
Crop.interesting.length.should == 1
Crop.interesting.size.should == 1
end
@@ -280,7 +280,7 @@ describe Crop do
Crop.interesting.should include @crop1
Crop.interesting.should_not include @crop2
Crop.interesting.length.should == 1
Crop.interesting.size.should == 1
end
end

View File

@@ -19,7 +19,7 @@ describe Forum do
it "has many posts" do
@post1 = FactoryGirl.create(:forum_post, :forum => forum)
@post2 = FactoryGirl.create(:forum_post, :forum => forum)
forum.posts.length.should == 2
forum.posts.size.should == 2
end
it "orders posts in reverse chron order" do

View File

@@ -88,7 +88,7 @@ describe Garden do
garden = FactoryGirl.create(:garden, :owner => owner)
@planting1 = FactoryGirl.create(:planting, :garden => garden)
@planting2 = FactoryGirl.create(:planting, :garden => garden)
garden.plantings.length.should == 2
garden.plantings.size.should == 2
all = Planting.count
garden.destroy
Planting.count.should == all - 2

View File

@@ -23,7 +23,7 @@ describe 'member' do
end
it 'should have a default garden' do
member.gardens.count.should == 1
member.gardens.size.should == 1
end
it 'should have a accounts entry' do
@@ -61,13 +61,13 @@ describe 'member' do
it "has many comments" do
@comment1 = FactoryGirl.create(:comment, :author => member)
@comment2 = FactoryGirl.create(:comment, :author => member)
member.comments.length.should == 2
member.comments.size.should == 2
end
it "has many forums" do
@forum1 = FactoryGirl.create(:forum, :owner => member)
@forum2 = FactoryGirl.create(:forum, :owner => member)
member.forums.length.should == 2
member.forums.size.should == 2
end
it 'has location and lat/long fields' do
@@ -221,12 +221,12 @@ describe 'member' do
end
it 'sees confirmed members' do
Member.confirmed.count.should == 2
Member.confirmed.size.should == 2
end
it 'ignores unconfirmed members' do
@member3 = FactoryGirl.create(:unconfirmed_member)
Member.confirmed.count.should == 2
Member.confirmed.size.should == 2
end
end

View File

@@ -11,19 +11,19 @@ describe Photo do
context "adds photos" do
it 'to a planting' do
planting.photos << photo
expect(planting.photos.count).to eq 1
expect(planting.photos.size).to eq 1
expect(planting.photos.first).to eq photo
end
it 'to a harvest' do
harvest.photos << photo
expect(harvest.photos.count).to eq 1
expect(harvest.photos.size).to eq 1
expect(harvest.photos.first).to eq photo
end
it 'to a garden' do
garden.photos << photo
expect(garden.photos.count).to eq 1
expect(garden.photos.size).to eq 1
expect(garden.photos.first).to eq photo
end
end
@@ -32,19 +32,19 @@ describe Photo do
it 'from a planting' do
planting.photos << photo
photo.destroy
expect(planting.photos.count).to eq 0
expect(planting.photos.size).to eq 0
end
it 'from a harvest' do
harvest.photos << photo
photo.destroy
expect(harvest.photos.count).to eq 0
expect(harvest.photos.size).to eq 0
end
it 'from a garden' do
garden.photos << photo
photo.destroy
expect(garden.photos.count).to eq 0
expect(garden.photos.size).to eq 0
end
it "automatically if unused" do

View File

@@ -229,7 +229,7 @@ describe Planting do
context "with howmany argument" do
it "only returns the number asked for" do
@plantings = FactoryGirl.create_list(:planting, 10)
Planting.interesting(3, false).length.should eq 3
Planting.interesting(3, false).size.should eq 3
end
end

View File

@@ -24,7 +24,7 @@ describe Post do
@datestr = @time.strftime("%Y%m%d")
# 2 digit day and month, full-length years
# Counting digits using Math.log is not precise enough!
@datestr.length.should == 4 + @time.year.to_s.size
@datestr.size.should == 4 + @time.year.to_s.size
@post.slug.should == "#{member.login_name}-#{@datestr}-a-post"
end
@@ -32,14 +32,14 @@ describe Post do
@post = FactoryGirl.create(:post, :author => member)
@comment1 = FactoryGirl.create(:comment, :post => @post)
@comment2 = FactoryGirl.create(:comment, :post => @post)
@post.comments.length.should == 2
@post.comments.size.should == 2
end
it "destroys comments when deleted" do
@post = FactoryGirl.create(:post, :author => member)
@comment1 = FactoryGirl.create(:comment, :post => @post)
@comment2 = FactoryGirl.create(:comment, :post => @post)
@post.comments.length.should == 2
@post.comments.size.should == 2
all = Comment.count
@post.destroy
Comment.count.should == all - 2

View File

@@ -146,7 +146,7 @@ describe Seed do
Seed.interesting.should_not include @seed2
Seed.interesting.should_not include @seed3
Seed.interesting.should_not include @seed4
Seed.interesting.length.should == 1
Seed.interesting.size.should == 1
end
end

View File

@@ -45,7 +45,7 @@ describe "forums/index" do
it "displays posts" do
assert_select "table"
rendered.should have_content @post.subject
rendered.should have_content "less than a minute ago"
rendered.should have_content Date.today.to_s(:short)
end
it "displays comment count" do

View File

@@ -26,10 +26,11 @@ describe "notifications/index" do
before(:each) do
@notification = FactoryGirl.create(:notification, :sender => @member,
:recipient => @member)
assign(:notifications, [ @notification, @notification ])
assign(:notifications, Kaminari.paginate_array([ @notification, @notification ]).page(1))
render
end
it "renders a list of notifications" do
assert_select "table"
assert_select "tr>td", :text => @notification.sender.to_s, :count => 2
@@ -45,7 +46,7 @@ describe "notifications/index" do
it "shows (no subject)" do
@notification = FactoryGirl.create(:notification,
:sender => @member, :recipient => @member, :subject => nil)
assign(:notifications, [@notification])
assign(:notifications, Kaminari.paginate_array([@notification]).page(1))
render
rendered.should have_content "(no subject)"
end
@@ -55,7 +56,7 @@ describe "notifications/index" do
it "shows (no subject)" do
@notification = FactoryGirl.create(:notification,
:sender => @member, :recipient => @member, :subject => " ")
assign(:notifications, [@notification])
assign(:notifications, Kaminari.paginate_array([@notification]).page(1))
render
rendered.should have_content "(no subject)"
end

View File

@@ -10,7 +10,7 @@ class SSLVerify
def test_gateways
success, failed, missing, errored, disabled = [], [], [], [], []
puts "Verifying #{@gateways.count} SSL certificates\n\n"
puts "Verifying #{@gateways.size} SSL certificates\n\n"
@gateways.each do |g|
if !g.live_url