gritter_notices 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,16 +4,17 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem 'gritter'
7
- gem 'activerecord'
8
- gem 'actionpack'
7
+ gem 'activerecord', "~> 3.0"
8
+ gem 'actionpack', "~> 3.0"
9
9
 
10
10
  # Add dependencies to develop your gem here.
11
11
  # Include everything needed to run rake, tests, features, etc.
12
- group :development do
13
- gem 'activerecord-nulldb-adapter'
12
+ group :development, :test do
13
+ gem 'sqlite3'
14
14
  gem 'factory_girl'
15
15
  gem 'shoulda'
16
- gem "rspec", "~> 2.3.0"
16
+ gem "rspec", "~> 2.5.0"
17
+ gem 'rspec-rails'
17
18
  gem "bundler", "~> 1.0.0"
18
19
  gem "jeweler", "~> 1.5.2"
19
20
  gem "rcov", ">= 0"
data/README.rdoc CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  Визуально выглядит так: http://boedesign.com/demos/gritter/
8
8
 
9
+ Модуль родился и активно используется в проекте http://planposter.com/
10
+
9
11
  == Установка
10
12
 
11
13
  Включаем модуль в Gemfile, незабываем затем сделать bundle install:
@@ -28,7 +30,7 @@
28
30
  = include_gritter
29
31
  %body
30
32
  = gflash // session сообщения добавляемые через gritter-овский gflash :success=>траляля
31
- = gritter_flash_messages // Все остальные сообщения добавляемые через flash[:success] или notice
33
+ = gritter_flash_messages // Все остальные сообщения добавляемые через вызовы типа flash[:success] или user.notice_*
32
34
 
33
35
  == Использование
34
36
 
@@ -79,7 +81,7 @@
79
81
 
80
82
  == TODO
81
83
 
82
- Удалять gritter_notice только после того как они закроются или их закроют
84
+ 1. Удалять gritter_notice только после того как они закроются или их закроют
83
85
 
84
86
  Контроллер gritter_notices с одной акцией delivered. Ставить ее запуск на onclose. Сделать настраиваемым текущее поведение:
85
87
 
@@ -87,6 +89,8 @@
87
89
  2. notices помечаются удаленными когда закрываются (сами или принудительно) onclose
88
90
  3. обычные notices по методу 1, sticky notices по методу 2.
89
91
 
92
+ 2. Показывать push-сообщения
93
+
90
94
 
91
95
  == Credits
92
96
  * Robin Brouwer https://github.com/RobinBrouwer/gritter
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -19,6 +19,7 @@ class GritterNotice < ActiveRecord::Base
19
19
 
20
20
  serialize :options, Hash
21
21
 
22
+ before_validation :set_options
22
23
  validates_presence_of :owner, :message
23
24
 
24
25
  def fresh?
@@ -40,4 +41,10 @@ class GritterNotice < ActiveRecord::Base
40
41
  update_attribute :delivered_at, Time.now
41
42
  end
42
43
  end
44
+
45
+ private
46
+
47
+ def set_options
48
+ self.options={} unless self.options
49
+ end
43
50
  end
@@ -0,0 +1,98 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{gritter_notices}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Danil Pismenny"]
12
+ s.date = %q{2011-03-29}
13
+ s.description = %q{Provide `notice` method to user model to save notices and to shows them later in views with Gritter (growl-like jQuery plugin). Fully support of Rails flash messages also. Helpful to send flash messages from background jobs.}
14
+ s.email = %q{danil@orionet.ru}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ "Gemfile",
21
+ "LICENSE.txt",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "app/models/gritter_notice.rb",
26
+ "gritter_notices.gemspec",
27
+ "lib/generators/gritter_notices_generator.rb",
28
+ "lib/generators/templates/migration.rb",
29
+ "lib/gritter_notices.rb",
30
+ "lib/gritter_notices/active_record.rb",
31
+ "lib/gritter_notices/rspec_matcher.rb",
32
+ "lib/gritter_notices/view_helpers.rb",
33
+ "spec/gritter_notice_spec.rb",
34
+ "spec/owner_spec.rb",
35
+ "spec/spec_helper.rb",
36
+ "spec/support/factories.rb",
37
+ "spec/support/migration.rb",
38
+ "spec/support/user.rb",
39
+ "spec/view_helpers_spec.rb"
40
+ ]
41
+ s.homepage = %q{http://github.com/dapi/gritter_notices}
42
+ s.licenses = ["MIT"]
43
+ s.require_paths = ["lib"]
44
+ s.rubygems_version = %q{1.5.0}
45
+ s.summary = %q{Show flashes and saved user's notices with Gritter (growl-like jQuery plugin)}
46
+ s.test_files = [
47
+ "spec/gritter_notice_spec.rb",
48
+ "spec/owner_spec.rb",
49
+ "spec/spec_helper.rb",
50
+ "spec/support/factories.rb",
51
+ "spec/support/migration.rb",
52
+ "spec/support/user.rb",
53
+ "spec/view_helpers_spec.rb"
54
+ ]
55
+
56
+ if s.respond_to? :specification_version then
57
+ s.specification_version = 3
58
+
59
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
60
+ s.add_runtime_dependency(%q<gritter>, [">= 0"])
61
+ s.add_runtime_dependency(%q<activerecord>, ["~> 3.0"])
62
+ s.add_runtime_dependency(%q<actionpack>, ["~> 3.0"])
63
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
64
+ s.add_development_dependency(%q<factory_girl>, [">= 0"])
65
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
66
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
67
+ s.add_development_dependency(%q<rspec-rails>, [">= 0"])
68
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
69
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
70
+ s.add_development_dependency(%q<rcov>, [">= 0"])
71
+ else
72
+ s.add_dependency(%q<gritter>, [">= 0"])
73
+ s.add_dependency(%q<activerecord>, ["~> 3.0"])
74
+ s.add_dependency(%q<actionpack>, ["~> 3.0"])
75
+ s.add_dependency(%q<sqlite3>, [">= 0"])
76
+ s.add_dependency(%q<factory_girl>, [">= 0"])
77
+ s.add_dependency(%q<shoulda>, [">= 0"])
78
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
79
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
80
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
81
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
82
+ s.add_dependency(%q<rcov>, [">= 0"])
83
+ end
84
+ else
85
+ s.add_dependency(%q<gritter>, [">= 0"])
86
+ s.add_dependency(%q<activerecord>, ["~> 3.0"])
87
+ s.add_dependency(%q<actionpack>, ["~> 3.0"])
88
+ s.add_dependency(%q<sqlite3>, [">= 0"])
89
+ s.add_dependency(%q<factory_girl>, [">= 0"])
90
+ s.add_dependency(%q<shoulda>, [">= 0"])
91
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
92
+ s.add_dependency(%q<rspec-rails>, [">= 0"])
93
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
94
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
95
+ s.add_dependency(%q<rcov>, [">= 0"])
96
+ end
97
+ end
98
+
@@ -20,11 +20,13 @@ module GritterNotices::ActiveRecord
20
20
  def notice *args
21
21
  options = args.extract_options!
22
22
  message = args.first || options[:message]
23
- options = {:scope=>:gritter_notices, :level=>:notice}.merge options
23
+ options = {:scope=>:gritter_notices}.merge options
24
24
  if message.is_a? Symbol
25
25
  options[:gritter_message_key] = message
26
+ options[:level] = message unless options[:level]
26
27
  message = I18n::translate(message, options)
27
28
  end
29
+ options[:level]=:notice unless options[:level]
28
30
  gritter_notices.create! :message=>message, :options=>options
29
31
  end
30
32
 
@@ -1,7 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
-
2
+ require 'gritter'
3
3
  module GritterNotices::ViewHelpers
4
4
 
5
+ include Gritter::Helpers
6
+
5
7
  GRITTER_CONVERT_KEYS = { :info=>:notice, :alert=>:warning, :failure=>:error, :other=>:notice }.
6
8
  merge Hash[*GritterNotices::KEYS.map {|k| [k,k]}.flatten]
7
9
 
@@ -16,31 +18,40 @@ module GritterNotices::ViewHelpers
16
18
  def gritter_flash_messages *args
17
19
  options = args.extract_options!
18
20
  titles = gflash_titles(options)
19
- flashes = []
21
+ gritters = []
20
22
 
21
23
  # Собираем flash-сообщения
22
- flash.each_pair do |key, message_array|
24
+ add_flashes_to_gritters( gritters, flash, titles )
25
+ add_notices_to_gitters( gritters,
26
+ current_user.gritter_notices.fresh, titles) if defined?(current_user) and current_user.respond_to?(:gritter_notices)
27
+
28
+ js(gritters).html_safe unless gritters.empty?
29
+ end
30
+
31
+ def add_notices_to_gitters(gritters, list, titles)
32
+ list.each do |notice|
33
+ options = notice.options
34
+ gritter_key = GRITTER_CONVERT_KEYS[options[:level]] || GRITTER_CONVERT_KEYS[:other] || options[:level]
35
+ options[:title] = titles[gritter_key] || options[:level].to_s unless options[:title]
36
+ options[:image] = gritter_key unless options[:image]
37
+ gritters << add_gritter(notice.message, options)
38
+ notice.mark_as_delivered
39
+ end
40
+ end
41
+
42
+ def add_flashes_to_gritters(gritters, list, titles)
43
+ list.each_pair do |key, message_array|
44
+ next unless message_array
23
45
  message_array = [message_array] unless message_array.is_a? Array
24
46
  message_array.flatten.each { |message|
25
47
  key = key.to_sym
26
48
  # Превращаем системные флешки в гритеровские
27
49
  gritter_key = GRITTER_CONVERT_KEYS[key] || GRITTER_CONVERT_KEYS[:other] || key
28
50
  title = titles[gritter_key] || key.to_s
29
- flashes << add_gritter(message, :image => gritter_key, :title => title)
51
+ gritters << add_gritter(message, :image => gritter_key, :title => title)
30
52
  }
31
53
  end
32
54
 
33
- # Собираем gritter_notices
34
- current_user.gritter_notices.fresh.each do |notice|
35
- options = notice.options
36
- gritter_key = GRITTER_CONVERT_KEYS[options[:level]] || GRITTER_CONVERT_KEYS[:other] || options[:level]
37
- options[:title] = titles[gritter_key] || options[:level].to_s unless options[:title]
38
- options[:image] = gritter_key unless options[:image]
39
- flashes << add_gritter(notice.message, options)
40
- notice.mark_as_delivered
41
- end if current_user and current_user.respond_to? :gritter_notices
42
-
43
- js(flashes).html_safe
44
55
  end
45
56
 
46
57
  def move_gritter_notices_to_flashes
@@ -2,11 +2,24 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  describe GritterNotice do
5
- it { should belong_to(:user) }
6
- it { should validate_presence_of(:user) }
5
+ it { should belong_to(:owner) }
6
+ it { should validate_presence_of(:owner) }
7
7
  it { should validate_presence_of(:message) }
8
- context "помечается как доставленная" do
8
+ it { should be_fresh }
9
+ it { should_not be_delivered }
10
+
11
+ describe '#mark_as_delivered' do
9
12
  subject { Factory :notice }
10
- it { should_not be_delivered }
13
+ it 'destroys after delivering' do
14
+ subject.should_receive(:destroy_after_deliver?) { true }
15
+ subject.mark_as_delivered
16
+ subject.should be_destroyed
17
+ end
18
+
19
+ it 'marks as delivered after delivering' do
20
+ subject.should_receive(:destroy_after_deliver?) { false }
21
+ subject.mark_as_delivered
22
+ subject.should be_delivered
23
+ end
11
24
  end
12
25
  end
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe User do
5
+ specify { User.should respond_to(:has_gritter_notices) }
6
+ it { should have_many(:gritter_notices) }
7
+
8
+ describe '#notice' do
9
+ subject { Factory :user }
10
+
11
+ it 'gets message with string' do
12
+ subject.notice 'some text'
13
+ subject.should have_gritter_notice('some text')
14
+ subject.gritter_notices.last.options[:level].should == :notice
15
+ subject.gritter_notices.last.options[:gritter_message_key].should == nil
16
+ end
17
+
18
+ it 'gets message with attribute' do
19
+ subject.notice :message=>'some text2', :level=>:success
20
+ subject.should have_gritter_notice('some text2')
21
+ subject.gritter_notices.last.options[:gritter_message_key].should be_nil
22
+ subject.gritter_notices.last.options[:level].should == :success
23
+ end
24
+
25
+ it 'gets message with symbol' do
26
+ subject.notice :warning
27
+ last = subject.gritter_notices.last
28
+ last.message.should == 'translation missing: en.gritter_notices.warning'
29
+ last.options[:gritter_message_key].should == :warning
30
+ last.options[:level].should == :warning
31
+ end
32
+
33
+ it 'catches messages as missed method' do
34
+ subject.notice_error 'big problem'
35
+ subject.should have_gritter_notice('big problem')
36
+ subject.gritter_notices.last.options[:level].should == :error
37
+ end
38
+ end
39
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,28 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rubygems'
3
+ require 'bundler'
4
+
1
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
6
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
7
+
8
+ ENV["RAILS_ENV"] ||= 'test'
9
+
4
10
  require 'active_record'
5
11
  require 'action_view'
6
- # require 'nulldb_rspec'
7
- # include NullDB::RSpec::NullifiedDatabase
12
+ require 'action_controller'
8
13
 
14
+ require 'rspec'
15
+ require 'rspec/rails'
16
+ require 'shoulda'
9
17
 
10
18
  require 'gritter_notices'
11
19
 
12
- require 'app/models/gritter_notice'
20
+ # require 'nulldb_rspec'
21
+ # include NullDB::RSpec::NullifiedDatabase
13
22
 
14
- require 'factory_girl'
23
+ ActiveRecord::Base.establish_connection(
24
+ :adapter => 'sqlite3',
25
+ # :database=>'/tmp/gritter_notices.sqlite3'
26
+ :database => ":memory:"
27
+ )
28
+ #ActiveRecord::Base.logger = Logger.new(File.open('log/database.log', 'a'))
29
+
30
+ require 'lib/generators/templates/migration'
31
+ CreateGritterNoticesTable.migrate :up
15
32
 
33
+ require 'spec/support/migration'
34
+ CreateUsersTable.migrate :up
16
35
 
17
- # Factory.definition_file_paths = [
18
- # File.join(Rails.root, 'spec', 'factories')
19
- # ]
36
+ require 'spec/support/user'
20
37
 
38
+ require 'app/models/gritter_notice'
39
+
40
+ require 'factory_girl'
41
+ require 'spec/support/factories'
21
42
 
22
- # Requires supporting files with custom matchers and macros, etc,
23
- # in ./support/ and its subdirectories.
24
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
43
+ # Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
25
44
 
26
45
  RSpec.configure do |config|
27
-
46
+ config.include GritterNotices::RSpecMatcher
28
47
  end
@@ -3,6 +3,6 @@ Factory.define :user do |u|
3
3
  end
4
4
 
5
5
  Factory.define :notice, :class=>'GritterNotice' do |f|
6
- f.association :user
6
+ f.association :owner, :factory=>:user
7
7
  f.message "MyText"
8
8
  end
@@ -0,0 +1,7 @@
1
+ class CreateUsersTable < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,52 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+
4
+ describe GritterNotices::ViewHelpers, :type => :helper do
5
+ before do
6
+ @user = Factory :user
7
+ helper.stub!(:current_user) { @user }
8
+ end
9
+
10
+ let(:current_user) { @user }
11
+ # let(:flash) { {:success=>'Success',:error=>['Error1','Error2']} }
12
+
13
+ describe '#gritter_flash_messages' do
14
+ it 'safe run with not current_user defined' do
15
+ helper.unstub :current_user
16
+ expect { helper.gritter_flash_messages }.should_not raise_error
17
+ end
18
+
19
+ it 'does not run js() if there it no gritters' do
20
+ helper.should_not_receive(:js)
21
+ helper.gritter_flash_messages
22
+ end
23
+
24
+ it 'collects flashes and users notices and run js()' do
25
+
26
+ flash[:error]='Error'
27
+ flash[:success]=['Success1','Success2']
28
+ flash[:info]=nil
29
+ current_user.notice :progress
30
+ current_user.notice_warning 'Warning'
31
+
32
+ compiled_gritters = [
33
+ "$.gritter.add({image:'/images/gritter/error.png',title:'translation missing: en.gflash.titles.error',text:'Error'});",
34
+ "$.gritter.add({image:'/images/gritter/success.png',title:'translation missing: en.gflash.titles.success',text:'Success1'});",
35
+ "$.gritter.add({image:'/images/gritter/success.png',title:'translation missing: en.gflash.titles.success',text:'Success2'});",
36
+ "$.gritter.add({image:'/images/gritter/progress.png',title:'translation missing: en.gflash.titles.progress',text:'translation missing: en.gritter_notices.progress'});",
37
+ "$.gritter.add({image:'/images/gritter/warning.png',title:'translation missing: en.gflash.titles.warning',text:'Warning'});"]
38
+ helper.should_receive(:js).with(compiled_gritters) { mock :html_safe=>true }
39
+ helper.gritter_flash_messages
40
+ end
41
+ end
42
+
43
+ describe '#move_gritter_notices_to_flashes' do
44
+ specify do
45
+ notice = mock :level=>:level, :message=>:message
46
+ notice.should_receive(:mark_as_delivered).twice
47
+ current_user.stub_chain('gritter_notices.fresh') {[notice,notice]}
48
+ helper.should_receive(:append_flash_message).twice
49
+ helper.move_gritter_notices_to_flashes
50
+ end
51
+ end
52
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gritter_notices
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Danil Pismenny
@@ -37,12 +37,13 @@ dependencies:
37
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
39
39
  requirements:
40
- - - ">="
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
- hash: 3
42
+ hash: 7
43
43
  segments:
44
+ - 3
44
45
  - 0
45
- version: "0"
46
+ version: "3.0"
46
47
  prerelease: false
47
48
  type: :runtime
48
49
  requirement: *id002
@@ -51,17 +52,18 @@ dependencies:
51
52
  version_requirements: &id003 !ruby/object:Gem::Requirement
52
53
  none: false
53
54
  requirements:
54
- - - ">="
55
+ - - ~>
55
56
  - !ruby/object:Gem::Version
56
- hash: 3
57
+ hash: 7
57
58
  segments:
59
+ - 3
58
60
  - 0
59
- version: "0"
61
+ version: "3.0"
60
62
  prerelease: false
61
63
  type: :runtime
62
64
  requirement: *id003
63
65
  - !ruby/object:Gem::Dependency
64
- name: activerecord-nulldb-adapter
66
+ name: sqlite3
65
67
  version_requirements: &id004 !ruby/object:Gem::Requirement
66
68
  none: false
67
69
  requirements:
@@ -109,18 +111,32 @@ dependencies:
109
111
  requirements:
110
112
  - - ~>
111
113
  - !ruby/object:Gem::Version
112
- hash: 3
114
+ hash: 27
113
115
  segments:
114
116
  - 2
115
- - 3
117
+ - 5
116
118
  - 0
117
- version: 2.3.0
119
+ version: 2.5.0
118
120
  prerelease: false
119
121
  type: :development
120
122
  requirement: *id007
121
123
  - !ruby/object:Gem::Dependency
122
- name: bundler
124
+ name: rspec-rails
123
125
  version_requirements: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ prerelease: false
135
+ type: :development
136
+ requirement: *id008
137
+ - !ruby/object:Gem::Dependency
138
+ name: bundler
139
+ version_requirements: &id009 !ruby/object:Gem::Requirement
124
140
  none: false
125
141
  requirements:
126
142
  - - ~>
@@ -133,10 +149,10 @@ dependencies:
133
149
  version: 1.0.0
134
150
  prerelease: false
135
151
  type: :development
136
- requirement: *id008
152
+ requirement: *id009
137
153
  - !ruby/object:Gem::Dependency
138
154
  name: jeweler
139
- version_requirements: &id009 !ruby/object:Gem::Requirement
155
+ version_requirements: &id010 !ruby/object:Gem::Requirement
140
156
  none: false
141
157
  requirements:
142
158
  - - ~>
@@ -149,10 +165,10 @@ dependencies:
149
165
  version: 1.5.2
150
166
  prerelease: false
151
167
  type: :development
152
- requirement: *id009
168
+ requirement: *id010
153
169
  - !ruby/object:Gem::Dependency
154
170
  name: rcov
155
- version_requirements: &id010 !ruby/object:Gem::Requirement
171
+ version_requirements: &id011 !ruby/object:Gem::Requirement
156
172
  none: false
157
173
  requirements:
158
174
  - - ">="
@@ -163,7 +179,7 @@ dependencies:
163
179
  version: "0"
164
180
  prerelease: false
165
181
  type: :development
166
- requirement: *id010
182
+ requirement: *id011
167
183
  description: Provide `notice` method to user model to save notices and to shows them later in views with Gritter (growl-like jQuery plugin). Fully support of Rails flash messages also. Helpful to send flash messages from background jobs.
168
184
  email: danil@orionet.ru
169
185
  executables: []
@@ -180,6 +196,7 @@ files:
180
196
  - Rakefile
181
197
  - VERSION
182
198
  - app/models/gritter_notice.rb
199
+ - gritter_notices.gemspec
183
200
  - lib/generators/gritter_notices_generator.rb
184
201
  - lib/generators/templates/migration.rb
185
202
  - lib/gritter_notices.rb
@@ -187,10 +204,12 @@ files:
187
204
  - lib/gritter_notices/rspec_matcher.rb
188
205
  - lib/gritter_notices/view_helpers.rb
189
206
  - spec/gritter_notice_spec.rb
190
- - spec/notice_spec.rb
207
+ - spec/owner_spec.rb
191
208
  - spec/spec_helper.rb
192
209
  - spec/support/factories.rb
210
+ - spec/support/migration.rb
193
211
  - spec/support/user.rb
212
+ - spec/view_helpers_spec.rb
194
213
  has_rdoc: true
195
214
  homepage: http://github.com/dapi/gritter_notices
196
215
  licenses:
@@ -227,7 +246,9 @@ specification_version: 3
227
246
  summary: Show flashes and saved user's notices with Gritter (growl-like jQuery plugin)
228
247
  test_files:
229
248
  - spec/gritter_notice_spec.rb
230
- - spec/notice_spec.rb
249
+ - spec/owner_spec.rb
231
250
  - spec/spec_helper.rb
232
251
  - spec/support/factories.rb
252
+ - spec/support/migration.rb
233
253
  - spec/support/user.rb
254
+ - spec/view_helpers_spec.rb
data/spec/notice_spec.rb DELETED
@@ -1,12 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'spec_helper'
3
-
4
- describe GritterNotice do
5
- it { should belong_to(:user) }
6
- it { should validate_presence_of(:user) }
7
- it { should validate_presence_of(:message) }
8
- context "mark as delivered" do
9
- subject { Factory :notice }
10
- it { should_not be_delivered }
11
- end
12
- end