Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit a001228cf7a85630b8bd223d3fb4c778e22291be @twe4ked committed Aug 17, 2012
Showing with 83 additions and 0 deletions.
  1. +22 โˆ’0 LICENSE
  2. +4 โˆ’0 README.md
  3. +2 โˆ’0 Rakefile
  4. +17 โˆ’0 lib/nc.rb
  5. +17 โˆ’0 rspec-nc.gemspec
  6. +21 โˆ’0 spec/nc_spec.rb
22 LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2012 Odin Dutton
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
+RSpec Notification Center
+-------------------------
+
+Specify multiple formatters: `rspec spec/lib --format=doc --format=Nc`.
@@ -0,0 +1,2 @@
+#!/usr/bin/env rake
+require "bundler/gem_tasks"
@@ -0,0 +1,17 @@
+require 'rspec/core/formatters/base_text_formatter'
+require 'terminal-notifier'
+
+class Nc < RSpec::Core::Formatters::BaseTextFormatter
+ def dump_summary(duration, example_count, failure_count, pending_count)
+ say "Finished in #{duration} seconds", summary_line(example_count, failure_count, pending_count)
+ end
+
+ def dump_pending; end
+ def dump_failures; end
+
+ private
+
+ def say(title, body)
+ TerminalNotifier.notify body, :title => title
+ end
+end
@@ -0,0 +1,17 @@
+# -*- encoding: utf-8 -*-
+Gem::Specification.new do |gem|
+ gem.name = 'rspec-nc'
+ gem.version = '0.0.1'
+ gem.authors = ['Odin Dutton']
+ gem.email = ['odindutton@gmail.com']
+ gem.description = 'https://github.com/twe4ked/rspec-nc'
+ gem.summary = "RSpec extension for Mountain Lion's Notification Center"
+ gem.homepage = 'https://github.com/twe4ked/rspec-nc'
+
+ gem.add_dependency 'terminal-notifier', '~> 1.4.2'
+
+ gem.files = `git ls-files`.split($\)
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
+ gem.test_files = gem.files.grep(%r{^(spec)/})
+ gem.require_paths = ['lib']
+end
@@ -0,0 +1,21 @@
+require 'nc'
+
+RSpec.configure do |config|
+ config.color_enabled = true
+ config.formatter = 'doc'
+ config.formatter = 'Nc'
+end
+
+describe 'it works' do
+ it 'returns success' do
+ # success!
+ end
+
+ it 'returns pending' do
+ pending
+ end
+
+ it 'returns failure' do
+ raise 'the roof'
+ end
+end

0 comments on commit a001228

Please sign in to comment.