Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: plataformatec/responders
base: master
...
head fork: iain/responders
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 08, 2011
@iain iain Remove Gemfile.lock
This will enable easier testing against various versions of
dependencies.
1ebc2e4
@iain iain Let bundler depend on the gemspec 7e0bb76
@iain iain Set default of flash_now to :on_failure
Since the usual pattern is that a page gets rerendered after failure,
the proper behavior would be to set the flash directly, so that it
doesn't stick around if you give up and leave the page.
fc4737a
View
2  .gitignore
@@ -0,0 +1,2 @@
+Gemfile.lock
+.rvmrc
View
4 Gemfile
@@ -1,10 +1,12 @@
source "http://rubygems.org"
+gemspec
+
gem "rails", "3.0.0"
gem "mocha"
if RUBY_VERSION < "1.9"
- gem "ruby-debug"
+ gem "ruby-debug"
else
gem "test-unit"
end
View
82 Gemfile.lock
@@ -1,82 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- abstract (1.0.0)
- actionmailer (3.0.0)
- actionpack (= 3.0.0)
- mail (~> 2.2.5)
- actionpack (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4.1)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.12)
- rack-test (~> 0.5.4)
- tzinfo (~> 0.3.23)
- activemodel (3.0.0)
- activesupport (= 3.0.0)
- builder (~> 2.1.2)
- i18n (~> 0.4.1)
- activerecord (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- arel (~> 1.0.0)
- tzinfo (~> 0.3.23)
- activeresource (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- activesupport (3.0.0)
- arel (1.0.1)
- activesupport (~> 3.0.0)
- builder (2.1.2)
- columnize (0.3.1)
- erubis (2.6.6)
- abstract (>= 1.0.0)
- i18n (0.4.1)
- linecache (0.43)
- mail (2.2.5)
- activesupport (>= 2.3.6)
- mime-types
- treetop (>= 1.4.5)
- mime-types (1.16)
- mocha (0.9.8)
- rake
- polyglot (0.3.1)
- rack (1.2.1)
- rack-mount (0.6.13)
- rack (>= 1.0.0)
- rack-test (0.5.4)
- rack (>= 1.0)
- rails (3.0.0)
- actionmailer (= 3.0.0)
- actionpack (= 3.0.0)
- activerecord (= 3.0.0)
- activeresource (= 3.0.0)
- activesupport (= 3.0.0)
- bundler (~> 1.0.0)
- railties (= 3.0.0)
- railties (3.0.0)
- actionpack (= 3.0.0)
- activesupport (= 3.0.0)
- rake (>= 0.8.4)
- thor (~> 0.14.0)
- rake (0.8.7)
- ruby-debug (0.10.3)
- columnize (>= 0.1)
- ruby-debug-base (~> 0.10.3.0)
- ruby-debug-base (0.10.3)
- linecache (>= 0.3)
- thor (0.14.0)
- treetop (1.4.8)
- polyglot (>= 0.3.1)
- tzinfo (0.3.23)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- mocha
- rails (= 3.0.0)
- ruby-debug
View
4 lib/responders/flash_responder.rb
@@ -85,7 +85,7 @@ def initialize(controller, resources, options={})
@flash = options.delete(:flash)
@notice = options.delete(:notice)
@alert = options.delete(:alert)
- @flash_now = options.delete(:flash_now)
+ @flash_now = options.delete(:flash_now) || :on_failure
end
def to_html
@@ -164,4 +164,4 @@ def flash_defaults_by_namespace(status) #:nodoc:
defaults << ""
end
end
-end
+end
View
7 test/flash_responder_test.rb
@@ -135,6 +135,11 @@ def test_sets_message_based_on_alert_key
assert_equal "Warning, warning!", flash[:alert]
end
+ def test_sets_flash_now_on_failure_by_default
+ post :another, :fail => true
+ assert_flash_now :alert
+ end
+
# If we have flash.now, it's always marked as used.
def assert_flash_now(k)
assert flash.instance_variable_get(:@used).include?(k.to_sym),
@@ -169,4 +174,4 @@ def test_fallbacks_to_non_namespaced_controller_flash_message
delete :destroy
assert_equal "Successfully deleted the chosen address at Ocean Avenue", flash[:notice]
end
-end
+end

No commit comments for this range

Something went wrong with that request. Please try again.