simply_messages 0.1.0 → 0.1.1

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.
@@ -63,7 +63,9 @@ module SimplyMessages
63
63
  end
64
64
  end
65
65
 
66
- messages_block += content_tag(:div, flash_msg.html_safe + errors.html_safe, :class => (html_class.presence || 'alert'))
66
+ if flash_msg.present? or errors.present?
67
+ messages_block += content_tag(:div, flash_msg.html_safe + errors.html_safe, :class => (html_class.presence || 'alert'))
68
+ end
67
69
 
68
70
  messages_block.html_safe
69
71
  end
@@ -1,3 +1,3 @@
1
1
  module SimplyMessages
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -8,14 +8,14 @@ ActiveRecord::Base.establish_connection 'test'
8
8
 
9
9
  # config
10
10
  app = Class.new(Rails::Application)
11
- app.config.secret_token = "2jv9wver8j3haskhf23b4j51ho8f8vh1"
12
- app.config.session_store :cookie_store, :key => "_simply_messages_session"
11
+ app.config.secret_token = '2jv9wver8j3haskhf23b4j51ho8f8vh1'
12
+ app.config.session_store :cookie_store, :key => '_simply_messages_session'
13
13
  app.config.active_support.deprecation = :log
14
14
  app.initialize!
15
15
 
16
16
  # route
17
17
  app.routes.draw do
18
- resources :users, :only => [:index, :create]
18
+ resources :users, :only => [:index, :new, :create]
19
19
  end
20
20
 
21
21
  # model
@@ -32,12 +32,16 @@ class UsersController < ApplicationController
32
32
  flash.now[:notice] = 'Good'
33
33
  flash.now[:success] = 'Good'
34
34
  flash.now[:alert] = 'Not too good'
35
- render :inline => "<%= messages_block %>"
35
+ render :inline => '<%= messages_block %>'
36
+ end
37
+
38
+ def new
39
+ render :inline => '<%= messages_block %>'
36
40
  end
37
41
 
38
42
  def create
39
43
  @user = User.create(params[:user])
40
- render :inline => "<%= messages_block %>"
44
+ render :inline => '<%= messages_block %>'
41
45
  end
42
46
  end
43
47
 
@@ -16,6 +16,17 @@ describe UsersController do
16
16
  specify { response.should have_selector('div.alert p', :content => 'Not too good') }
17
17
  end
18
18
 
19
+ describe "#new" do
20
+ before do
21
+ get :new
22
+ end
23
+
24
+ specify { response.should be_success }
25
+
26
+ specify { response.should_not have_selector('div.notice') }
27
+ specify { response.should_not have_selector('div.alert') }
28
+ end
29
+
19
30
  describe "#create" do
20
31
  context "without name" do
21
32
  before do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simply_messages
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Pawe\xC5\x82 Go\xC5\x9Bcicki"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-20 00:00:00 +02:00
18
+ date: 2011-05-21 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency