padrino-flash 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,11 +55,11 @@ module Padrino
55
55
  # @api public
56
56
  def flash_messages
57
57
  flashes = flash.collect do |type, message|
58
- content_tag(:span, message, title: type.to_s.titleize, class: type)
58
+ content_tag(:span, message, :title => type.to_s.titleize, :class => type)
59
59
  end.join("\n")
60
60
 
61
61
  # Create the tag even if we don't need it so it can be dynamically altered
62
- content_tag(:div, flashes, id: 'flash')
62
+ content_tag(:div, flashes, :id => 'flash')
63
63
  end
64
64
 
65
65
  ###
@@ -83,7 +83,7 @@ module Padrino
83
83
  # @api public
84
84
  def flash_message(type)
85
85
  if flash[type]
86
- content_tag(:div, flash[type], id: "flash-#{type}", title: type.to_s.titleize, class: type)
86
+ content_tag(:div, flash[type], :id => "flash-#{type}", :title => type.to_s.titleize, :class => type)
87
87
  end
88
88
  end
89
89
 
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  module Padrino
3
3
  module Flash
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end # Flash
6
6
  end # Padrino
data/spec/flash_spec.rb CHANGED
@@ -1,14 +1,14 @@
1
- require_relative 'spec'
1
+ require File.expand_path('../spec', __FILE__)
2
2
 
3
3
  describe Padrino::Flash do
4
4
  it 'can set the future flash' do
5
- post '/flash', { notice: 'Flash' }
6
- post '/flash', { success: 'Flash' }
5
+ post '/flash', { :notice => 'Flash' }
6
+ post '/flash', { :success => 'Flash' }
7
7
  last_response.body.should == '{:notice=>"Flash"}'
8
8
  end
9
9
 
10
10
  it 'knows the future flash' do
11
- post '/flash', { notice: 'Flash' }
11
+ post '/flash', { :notice => 'Flash' }
12
12
  get '/flash'
13
13
  last_response.body.should == '{:notice=>"Flash"}'
14
14
  end
data/spec/helpers_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'spec'
1
+ require File.expand_path('../spec', __FILE__)
2
2
 
3
3
  describe Padrino::Flash::Helpers do
4
4
  include Padrino::Helpers::OutputHelpers
@@ -7,7 +7,7 @@ describe Padrino::Flash::Helpers do
7
7
 
8
8
  context '#redirect' do
9
9
  it 'should let you to use a string to set a flash message' do
10
- app.get(:redirect) { redirect('/flash', notice: 'Redirected') }
10
+ app.get(:redirect) { redirect('/flash', :notice => 'Redirected') }
11
11
  get '/redirect'
12
12
  follow_redirect!
13
13
  last_response.body.should == '{:notice=>"Redirected"}'
@@ -21,7 +21,7 @@ describe Padrino::Flash::Helpers do
21
21
  end
22
22
 
23
23
  it 'should allow you to set multiple flash messages' do
24
- app.get(:redirect) { redirect('/flash', notice: 'Redirected', success: 'Redirected') }
24
+ app.get(:redirect) { redirect('/flash', :notice => 'Redirected', :success => 'Redirected') }
25
25
  get '/redirect'
26
26
  follow_redirect!
27
27
  last_response.body.should == '{:notice=>"Redirected", :success=>"Redirected"}'
@@ -34,7 +34,7 @@ describe Padrino::Flash::Helpers do
34
34
  end
35
35
 
36
36
  it 'should allow you to set the status code with flash messages' do
37
- app.get(:redirect) { redirect('/flash', 301, notice: 'Redirected') }
37
+ app.get(:redirect) { redirect('/flash', 301, :notice => 'Redirected') }
38
38
  get '/redirect'
39
39
  last_response.status.should == 301
40
40
  follow_redirect!
@@ -45,7 +45,7 @@ describe Padrino::Flash::Helpers do
45
45
  context '#flash_message' do
46
46
  it 'should return the contents of the specified flash' do
47
47
  flash = flash_message(:success)
48
- flash.should have_tag(:div, count: 1, with: { id: 'flash-success', class: 'success', title: 'Success' })
48
+ flash.should have_tag(:div, :count => 1, :with => { :id => 'flash-success', :class => 'success', :title => 'Success' })
49
49
  end
50
50
 
51
51
  it 'should return nil when the specified flash is not set' do
@@ -57,16 +57,16 @@ describe Padrino::Flash::Helpers do
57
57
  context '#flash_messages' do
58
58
  it 'should return the contents of all flashes' do
59
59
  flashes = flash_messages
60
- flashes.should have_tag(:div, count: 1, with: { id: 'flash' }) do
61
- with_tag(:span, text: 'Flash Success', with: { class: 'success', title: 'Success' })
62
- with_tag(:span, text: 'Flash Notice', with: { class: 'notice', title: 'Notice' })
60
+ flashes.should have_tag(:div, :count => 1, :with => { :id => 'flash' }) do
61
+ with_tag(:span, :text => 'Flash Success', :with => { :class => 'success', :title => 'Success' })
62
+ with_tag(:span, :text => 'Flash Notice', :with => { :class => 'notice', :title => 'Notice' })
63
63
  end
64
64
  end
65
65
 
66
66
  it 'should return an empty div when no flash messages set' do
67
67
  session.clear
68
68
  flashes = flash_messages
69
- flashes.should have_tag(:div, count: 1, with: { id: 'flash' })
69
+ flashes.should have_tag(:div, :count => 1, :with => { :id => 'flash' })
70
70
  end
71
71
  end
72
72
  end
data/spec/spec.rb CHANGED
@@ -12,18 +12,18 @@ module TestHelpers
12
12
  set :logging, false
13
13
 
14
14
  get :flash do
15
- flash.inspect
15
+ flash.now.inspect
16
16
  end
17
17
 
18
18
  post :flash do
19
19
  params.each { |type, message| flash[type.to_sym] = message }
20
- flash.inspect
20
+ flash.now.inspect
21
21
  end
22
22
  end
23
23
  end
24
24
 
25
25
  def session
26
- @session ||= { _flash: { notice: 'Flash Notice', success: 'Flash Success' }}
26
+ @session ||= { :_flash => { :notice => 'Flash Notice', :success => 'Flash Success' }}
27
27
  end
28
28
  end
29
29
 
data/spec/storage_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative 'spec'
1
+ require File.expand_path('../spec', __FILE__)
2
2
 
3
3
  describe Padrino::Flash::Storage do
4
4
  let :flash do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-flash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-17 00:00:00.000000000 Z
12
+ date: 2012-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: padrino-core
16
- requirement: &15843012 !ruby/object:Gem::Requirement
16
+ requirement: &20219160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15843012
24
+ version_requirements: *20219160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: padrino-helpers
27
- requirement: &15841152 !ruby/object:Gem::Requirement
27
+ requirement: &20218464 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15841152
35
+ version_requirements: *20218464
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &15840744 !ruby/object:Gem::Requirement
38
+ requirement: &20217960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.0.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *15840744
46
+ version_requirements: *20217960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-html-matchers
49
- requirement: &15839976 !ruby/object:Gem::Requirement
49
+ requirement: &20217492 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15839976
57
+ version_requirements: *20217492
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &15839256 !ruby/object:Gem::Requirement
60
+ requirement: &20216760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *15839256
68
+ version_requirements: *20216760
69
69
  description: A plugin for the Padrino web framework which adds support for Rails like
70
70
  flash messages
71
71
  email: