fusionary-easel_helpers 0.2.7 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/testtask'
3
3
  require 'rake/rdoctask'
4
4
  require 'echoe'
5
5
 
6
- Echoe.new("easel_helpers", "0.2.7") do |p|
6
+ Echoe.new("easel_helpers", "0.2.9") do |p|
7
7
  p.description = "Fusionary Rails View Helpers"
8
8
  p.url = "http://github.com/fusionary/easel_helpers"
9
9
  p.author = "Joshua Clayton"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easel_helpers}
5
- s.version = "0.2.7"
5
+ s.version = "0.2.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Joshua Clayton"]
9
- s.date = %q{2009-06-04}
9
+ s.date = %q{2009-06-11}
10
10
  s.description = %q{Fusionary Rails View Helpers}
11
11
  s.email = %q{joshua.clayton@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/easel_helpers/helpers/date_helper.rb", "lib/easel_helpers/helpers/form_helper.rb", "lib/easel_helpers/helpers/grid_helper.rb", "lib/easel_helpers/helpers/link_helper.rb", "lib/easel_helpers/helpers/message_helper.rb", "lib/easel_helpers/helpers/rjs_helper.rb", "lib/easel_helpers/helpers/structure_helper.rb", "lib/easel_helpers/helpers/table_helper.rb", "lib/easel_helpers/helpers.rb", "lib/easel_helpers/rails_partial_caching.rb", "lib/easel_helpers.rb", "README.textile", "tasks/easel_helpers_tasks.rake"]
@@ -4,11 +4,14 @@ module EaselHelpers
4
4
 
5
5
  def inline_flash(page, flash, options = {})
6
6
  container_id = options[:container] || "flash-container"
7
+ current_flash = flash
8
+
9
+ flash.discard unless options[:keep_flash]
7
10
 
8
11
  if options[:replace]
9
- page.replace_html container_id, messages(flash)
12
+ page.replace_html container_id, messages(current_flash)
10
13
  else
11
- page.insert_html :top, container_id, messages(flash)
14
+ page.insert_html :top, container_id, messages(current_flash)
12
15
  end
13
16
  end
14
17
 
@@ -7,22 +7,40 @@ class RjsHelperTest < ActiveSupport::TestCase
7
7
  context "inline_flash" do
8
8
  setup do
9
9
  @page = Object.new
10
+ @flash_hash = {:notice => "Test!"}
10
11
  self.expects(:messages).with({:notice => "Test!"}).returns("string")
11
12
  end
12
13
 
13
- should "default to inserting flash within div#flash-container" do
14
- @page.expects(:insert_html).with(:top, "flash-container", "string")
15
- inline_flash(@page, {:notice => "Test!"})
16
- end
17
-
18
- should "allow assignment of container id" do
19
- @page.expects(:insert_html).with(:top, "my-custom-id", "string")
20
- inline_flash(@page, {:notice => "Test!"}, {:container => "my-custom-id"})
14
+ context "without keeping flash" do
15
+ setup do
16
+ @flash_hash.expects(:discard).returns(true)
17
+ end
18
+
19
+ should "default to inserting flash within div#flash-container" do
20
+ @page.expects(:insert_html).with(:top, "flash-container", "string")
21
+ inline_flash(@page, @flash_hash)
22
+ end
23
+
24
+ should "allow assignment of container id" do
25
+ @page.expects(:insert_html).with(:top, "my-custom-id", "string")
26
+ inline_flash(@page, @flash_hash, {:container => "my-custom-id"})
27
+ end
28
+
29
+ should "allow replacement of current flash container's HTML" do
30
+ @page.expects(:replace_html).with("flash-container", "string")
31
+ inline_flash(@page, @flash_hash, {:replace => true})
32
+ end
21
33
  end
22
34
 
23
- should "allow replacement of current flash container's HTML" do
24
- @page.expects(:replace_html).with("flash-container", "string")
25
- inline_flash(@page, {:notice => "Test!"}, {:replace => true})
35
+ context "when keeping flash" do
36
+ setup do
37
+ @flash_hash.expects(:discard).never
38
+ end
39
+
40
+ should "default to inserting flash within div#flash-container" do
41
+ @page.expects(:insert_html).with(:top, "flash-container", "string")
42
+ inline_flash(@page, @flash_hash, :keep_flash => true)
43
+ end
26
44
  end
27
45
  end
28
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusionary-easel_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Clayton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-04 00:00:00 -07:00
12
+ date: 2009-06-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency