Skip to content

Commit

Permalink
small enhancements: added rcov task and table indexes
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit cbc5265e4349246026b1bbf4468b4df22ff02cf6
Author: Alexander Dreher <alexdreher@lxmedia.net>
Date:   Tue Jan 18 14:24:38 2011 +0100

    added indexes to messages table

commit 04a00e7c790a8f24a0746388ed386029537fa6f1
Author: Alexander Dreher <alexdreher@lxmedia.net>
Date:   Tue Jan 18 14:21:52 2011 +0100

    small fix and clean up

commit 8801b25cd2b82828dcd12932eb7a6e18dd22f12a
Author: Alexander Dreher <alexdreher@lxmedia.net>
Date:   Tue Jan 18 14:18:30 2011 +0100

    added rcov rake task; gitignored results
  • Loading branch information
Alexander Dreher committed Jan 18, 2011
1 parent 9a33085 commit 79a735e
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 36 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,6 @@ db/*.sqlite3
log/*.log log/*.log
tmp/**/* tmp/**/*
.DS_Store .DS_Store
public/stylesheets/compiled/ public/stylesheets/compiled/
coverage.data
coverage/
2 changes: 0 additions & 2 deletions app/helpers/admin/messages_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/admin/users_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/messages_helper.rb

This file was deleted.

2 changes: 0 additions & 2 deletions app/helpers/welcome_helper.rb

This file was deleted.

13 changes: 13 additions & 0 deletions db/migrate/20110118132248_add_indexes.rb
@@ -0,0 +1,13 @@
class AddIndexes < ActiveRecord::Migration
def self.up
add_index :messages, :sender_id
add_index :messages, :recipient_id
add_index :messages, :subject
end

def self.down
remove_index :messages, :subject
remove_index :messages, :recipient_id
remove_index :messages, :sender_id
end
end
6 changes: 5 additions & 1 deletion db/schema.rb
Expand Up @@ -10,7 +10,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.


ActiveRecord::Schema.define(:version => 20110118110237) do ActiveRecord::Schema.define(:version => 20110118132248) do


create_table "messages", :force => true do |t| create_table "messages", :force => true do |t|
t.integer "sender_id" t.integer "sender_id"
Expand All @@ -21,6 +21,10 @@
t.datetime "updated_at" t.datetime "updated_at"
end end


add_index "messages", ["recipient_id"], :name => "index_messages_on_recipient_id"
add_index "messages", ["sender_id"], :name => "index_messages_on_sender_id"
add_index "messages", ["subject"], :name => "index_messages_on_subject"

create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false
Expand Down
47 changes: 47 additions & 0 deletions lib/tasks/rcov.rake
@@ -0,0 +1,47 @@
# https://gist.github.com/670111
#
# Forked to get it working with Rails 3 and RSpec 2
#
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
#
# Use rcov:rspec or rcov:cucumber
# to get non-aggregated coverage reports for rspec or cucumber separately

require 'cucumber/rake/task'
require "rspec/core/rake_task"

namespace :rcov do
Cucumber::Rake::Task.new(:cucumber_run) do |t|
t.rcov = true
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
t.rcov_opts << %[-o "coverage"]
end

RSpec::Core::RakeTask.new(:rspec_run) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rcov = true
t.rcov_opts = %w{--rails --exclude osx\/objc,gems\/,spec\/}
end

desc "Run both specs and features to generate aggregated coverage"
task :all do |t|
rm "coverage.data" if File.exist?("coverage.data")
Rake::Task["rcov:cucumber_run"].invoke
Rake::Task["rcov:rspec_run"].invoke
end

desc "Run only rspecs"
task :rspec do |t|
rm "coverage.data" if File.exist?("coverage.data")
Rake::Task["rcov:rspec_run"].invoke
end

desc "Run only cucumber"
task :cucumber do |t|
rm "coverage.data" if File.exist?("coverage.data")
Rake::Task["rcov:cucumber_run"].invoke
end
end
15 changes: 0 additions & 15 deletions spec/helpers/admin/messages_helper_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/requests/admin/admin_messages_spec.rb

This file was deleted.

0 comments on commit 79a735e

Please sign in to comment.