hermes 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -35
- data/lib/hermes.rb +0 -34
- data/lib/hermes/assertions.rb +84 -0
- data/lib/hermes/builders.rb +124 -0
- data/lib/hermes/context.rb +37 -0
- data/lib/hermes/integration_case.rb +11 -0
- data/lib/hermes/version.rb +1 -1
- data/test/test_helper.rb +5 -21
- metadata +19 -60
- data/lib/hermes/hooks/attr_protected.rb +0 -9
- data/lib/hermes/notifiers/growl.rb +0 -3
- data/lib/hermes/railtie.rb +0 -9
- data/test/dummy/Rakefile +0 -10
- data/test/dummy/app/controllers/application_controller.rb +0 -4
- data/test/dummy/app/controllers/users_controller.rb +0 -83
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/users_helper.rb +0 -2
- data/test/dummy/app/models/user.rb +0 -3
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/users/_form.html.erb +0 -21
- data/test/dummy/app/views/users/edit.html.erb +0 -6
- data/test/dummy/app/views/users/index.html.erb +0 -23
- data/test/dummy/app/views/users/new.html.erb +0 -5
- data/test/dummy/app/views/users/show.html.erb +0 -10
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -49
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -22
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -19
- data/test/dummy/config/environments/production.rb +0 -46
- data/test/dummy/config/environments/test.rb +0 -32
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -60
- data/test/dummy/db/migrate/20100423185611_create_users.rb +0 -14
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -9
- data/test/hermes_test.rb +0 -18
- data/test/support/integration_case.rb +0 -5
data/README.rdoc
CHANGED
@@ -1,40 +1,6 @@
|
|
1
1
|
= Hermes
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Hermes, the great messenger of the gods, is a tool that warn us about some common pitfalls (like the one above) while developing Rails applications.
|
6
|
-
|
7
|
-
== Notifiers
|
8
|
-
|
9
|
-
To help achieving this task, Hermes uses Growl in MacOSX. Right now it does not support other tools, but you are welcome to fork and add it!
|
10
|
-
|
11
|
-
== Hooks
|
12
|
-
|
13
|
-
So far, Hermes only notifies when assigning a protected attribute. Are you tired in falling in other pitfalls? Fork it, add a warning and never again!
|
14
|
-
|
15
|
-
== Installation
|
16
|
-
|
17
|
-
To use Hermes in both Rails 2.3 and Rails 3, you just need to install it as a gem:
|
18
|
-
|
19
|
-
gem install hermes
|
20
|
-
|
21
|
-
=== Rails 3
|
22
|
-
|
23
|
-
If you are using Rails 3, you just need to add it to your Gemfile:
|
24
|
-
|
25
|
-
group :development do
|
26
|
-
gem "hermes"
|
27
|
-
end
|
28
|
-
|
29
|
-
=== Rails 2.3
|
30
|
-
|
31
|
-
If you are using Rails 2.3, you need to add it to your config/environments/development.rb:
|
32
|
-
|
33
|
-
config.gem "hermes"
|
34
|
-
|
35
|
-
And then at the bottom of "config/environment.rb" or in any initializer, you need to set it up:
|
36
|
-
|
37
|
-
Hermes.setup!
|
3
|
+
A few testing facilities built on top of Capybara and ActiveSupport::TestCase
|
38
4
|
|
39
5
|
== Bugs and Features
|
40
6
|
|
data/lib/hermes.rb
CHANGED
@@ -1,36 +1,2 @@
|
|
1
|
-
require "hermes/railtie" if defined?(Rails::Railtie)
|
2
|
-
|
3
1
|
module Hermes
|
4
|
-
module Notifiers
|
5
|
-
end
|
6
|
-
|
7
|
-
mattr_reader :notifiers
|
8
|
-
@@notifiers = []
|
9
|
-
|
10
|
-
mattr_reader :hooks
|
11
|
-
@@hooks = [:attr_protected]
|
12
|
-
|
13
|
-
def self.notify(message)
|
14
|
-
notifiers.each { |notifier| notifier.call(message) }
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.setup!
|
18
|
-
setup_notifiers!
|
19
|
-
setup_hooks!
|
20
|
-
end
|
21
|
-
|
22
|
-
protected
|
23
|
-
|
24
|
-
def self.setup_hooks!
|
25
|
-
hooks.each { |hook| require "hermes/hooks/#{hook}" }
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.setup_notifiers!
|
29
|
-
case RUBY_PLATFORM
|
30
|
-
when /darwin/
|
31
|
-
require "hermes/notifiers/growl"
|
32
|
-
else
|
33
|
-
warn "Hermes only supports MacOSX using Growl. Want to support other OS? Fork it!"
|
34
|
-
end
|
35
|
-
end
|
36
2
|
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Hermes
|
2
|
+
# A few assertions built on top of Capybara.
|
3
|
+
module Assertions
|
4
|
+
def assert_current_path(expected)
|
5
|
+
assert_equal expected, current_path
|
6
|
+
end
|
7
|
+
|
8
|
+
def assert_difference_on_click_button(button, *args)
|
9
|
+
assert_difference *args do
|
10
|
+
click_button button
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def assert_difference_on_click_link(link, *args)
|
15
|
+
assert_difference *args do
|
16
|
+
click_link link
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def assert_content(content)
|
21
|
+
boolean = has_content?(content)
|
22
|
+
if boolean
|
23
|
+
assert_block("assert_content") { true }
|
24
|
+
else
|
25
|
+
assert_block("#{body_inner_text}\nExpected to have #{content}"){ false }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def assert_no_content(content)
|
30
|
+
boolean = has_content?(content)
|
31
|
+
if boolean
|
32
|
+
assert_block("#{body_inner_text}\nDid not expect to have content #{content}"){ false }
|
33
|
+
else
|
34
|
+
assert_block("assert_no_content") { true }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
%w(xpath css link select).each do |method|
|
39
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
40
|
+
def assert_#{method}(*args, &block)
|
41
|
+
boolean = has_#{method}?(*args, &block)
|
42
|
+
if boolean
|
43
|
+
assert_block("assert_#{method}") { true }
|
44
|
+
else
|
45
|
+
assert_block("\#{page.body}\nExpected to have #{method} \#{args.inspect}"){ false }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def assert_no_#{method}(*args, &block)
|
50
|
+
boolean = has_#{method}?(*args, &block)
|
51
|
+
if boolean
|
52
|
+
assert_block("\#{page.body}\nDid not expect to have #{method} \#{args.inspect}"){ false }
|
53
|
+
else
|
54
|
+
assert_block("assert_no_#{method}") { true }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
RUBY
|
58
|
+
end
|
59
|
+
|
60
|
+
def assert_mail_deliveries(many=1)
|
61
|
+
assert_difference("ActionMailer::Base.deliveries.size", many){ yield }
|
62
|
+
end
|
63
|
+
|
64
|
+
def assert_link_to(url, options)
|
65
|
+
assert_css "a[href='%s']" % url, options
|
66
|
+
end
|
67
|
+
|
68
|
+
def within(scope, prefix=nil)
|
69
|
+
scope = '#' << ActionController::RecordIdentifier.dom_id(scope, prefix) if scope.is_a?(ActiveRecord::Base)
|
70
|
+
super(scope)
|
71
|
+
end
|
72
|
+
|
73
|
+
protected
|
74
|
+
|
75
|
+
def body_inner_text
|
76
|
+
Nokogiri::HTML(page.body).inner_text.gsub(/^\s*$/, "").squeeze("\n")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Provide a shortcut to show body inner text. It helps debugging.
|
80
|
+
def pbit
|
81
|
+
puts body_inner_text
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# Rails developers have had bad experience with fixtures since a long time
|
2
|
+
# due to several reasons, including misuse.
|
3
|
+
#
|
4
|
+
# This misuse of fixtures is often characterized by a huge ammount of
|
5
|
+
# fixtures, causing a lot of data to maintain and dependence between tests.
|
6
|
+
# In my experience working (and rescueing) different applications, 80% of
|
7
|
+
# these fixtures are used only by 20% of tests.
|
8
|
+
#
|
9
|
+
# An example of such tests is a test that assures a given SQL query with
|
10
|
+
# GROUP BY and ORDER BY conditions returns the correct result set. As expected,
|
11
|
+
# we need a huge amount of data in this test which we usually don't need in
|
12
|
+
# order tests.
|
13
|
+
#
|
14
|
+
# For such scenarios, factories are a fine solution. They won't cluster
|
15
|
+
# all your database since they are created for these specific tests and they
|
16
|
+
# are also easier to maintain.
|
17
|
+
#
|
18
|
+
# I believe this was the primary reason for the Rails community to strongly
|
19
|
+
# adopt factories builders as we saw in the couple two years ago.
|
20
|
+
#
|
21
|
+
# However, factories are also misused. It is common to see people creating
|
22
|
+
# a huge amount of data with factories before each test in their integration
|
23
|
+
# suite, causing their whole test suite to be slow, while fixtures would
|
24
|
+
# work great for this purpose.
|
25
|
+
#
|
26
|
+
# This is a small attempt to have the best of both worlds.
|
27
|
+
#
|
28
|
+
# For the data used in almost all your tests, use fixtures. For all the
|
29
|
+
# other smaller scenarios, use factories. As both fixtures and factories
|
30
|
+
# require valid attributes, this code below provides a quick solution
|
31
|
+
# that allows you to create small, simple factories from the information
|
32
|
+
# stored in your fixtures.
|
33
|
+
#
|
34
|
+
# == Examples
|
35
|
+
#
|
36
|
+
# You can define your builder inside the Builders module:
|
37
|
+
#
|
38
|
+
# module Hermes::Builders
|
39
|
+
# build :message do
|
40
|
+
# { :title => "OMG", :queue => queues(:general) }
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# It should necessarily return a hash. After defining this builder,
|
45
|
+
# you can easily create a new message calling +create_message+ or
|
46
|
+
# +new_message+ in your tests. Both methods accepts an optional
|
47
|
+
# options parameter that is merged into the given hash.
|
48
|
+
#
|
49
|
+
# == Reusing fixtures
|
50
|
+
#
|
51
|
+
# The great benefit of builders is that you can reuse your fixtures
|
52
|
+
# attributes, avoiding duplication. An explicit way of doing it is:
|
53
|
+
#
|
54
|
+
# build :message do
|
55
|
+
# messages(:fixture_one).attributes.merge(
|
56
|
+
# :title => "Overwritten title"
|
57
|
+
# )
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# However, Builders provide an implicit way of doing the same:
|
61
|
+
#
|
62
|
+
# build :message, :like => :fixture_one do
|
63
|
+
# { :title => "Overwritten title" }
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# == Just Ruby
|
67
|
+
#
|
68
|
+
# Since all Builders are defined inside the Builders module, without
|
69
|
+
# a DSL on top of it, it allows us to use Ruby in case we need to do
|
70
|
+
# something more complex, like supporting sequences.
|
71
|
+
#
|
72
|
+
# module Builders
|
73
|
+
# @@sequence = 0
|
74
|
+
#
|
75
|
+
# def sequence
|
76
|
+
# @@sequence += 1
|
77
|
+
# end
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
module Hermes
|
81
|
+
module Builders
|
82
|
+
@@builders = ActiveSupport::OrderedHash.new
|
83
|
+
|
84
|
+
def self.build(name, options={}, &block)
|
85
|
+
klass = options[:as] || name.to_s.classify.constantize
|
86
|
+
|
87
|
+
builder = if options[:like]
|
88
|
+
lambda { send(name.to_s.pluralize, options[:like]).attributes.merge(block.call) }
|
89
|
+
else
|
90
|
+
block
|
91
|
+
end
|
92
|
+
|
93
|
+
@@builders[name] = [klass, builder]
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.retrieve(scope, name, method, options)
|
97
|
+
if builder = @@builders[name.to_sym]
|
98
|
+
klass, block = builder
|
99
|
+
hash = block.bind(scope).call.merge(options || {})
|
100
|
+
hash.delete("id")
|
101
|
+
[klass, hash]
|
102
|
+
else
|
103
|
+
raise NoMethodError, "No builder #{name.inspect} for `#{method}'"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def method_missing(method, *args, &block)
|
108
|
+
case method.to_s
|
109
|
+
when /(create|new)_(.*?)(!)?$/
|
110
|
+
klass, hash = Builders.retrieve(self, $2, method, args.first)
|
111
|
+
object = klass.new
|
112
|
+
object.send("attributes=", hash, false)
|
113
|
+
object.send("save#{$3}") if $1 == "create"
|
114
|
+
object
|
115
|
+
when /valid_(.*?)_attributes$/
|
116
|
+
Builders.retrieve(self, $1, method, args.first)[1]
|
117
|
+
else
|
118
|
+
super
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
ActiveSupport::TestCase.send :include, Hermes::Builders
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Hermes
|
2
|
+
# Add context support to AS::TestCase.
|
3
|
+
module Context
|
4
|
+
def context_list
|
5
|
+
@@context_list ||= []
|
6
|
+
end
|
7
|
+
|
8
|
+
def context_buffer
|
9
|
+
@context_buffer ||= []
|
10
|
+
end
|
11
|
+
|
12
|
+
def test(name)
|
13
|
+
super("#{self.context_buffer.join(" ")} #{name}".strip)
|
14
|
+
end
|
15
|
+
|
16
|
+
def context(name, &block)
|
17
|
+
klass = Class.new(self)
|
18
|
+
klass.context_buffer.concat self.context_buffer
|
19
|
+
klass.context_buffer << name
|
20
|
+
|
21
|
+
# Care about Rails tests in nested contexts
|
22
|
+
# Extracted this from github.com/jm/context
|
23
|
+
klass.tests($1.constantize) if self < ActiveSupport::TestCase &&
|
24
|
+
self.name =~ /^(.*(Controller|Helper|Mailer))Test/
|
25
|
+
|
26
|
+
# Undefine parent methods so they don't get executed twice
|
27
|
+
klass.instance_methods.grep(/^test_/).each { |m| klass.send(:undef_method, m) }
|
28
|
+
klass.class_eval(&block)
|
29
|
+
|
30
|
+
self.context_list << klass
|
31
|
+
Object.const_set("TestContext#{name.camelize.gsub(/\W/,'')}#{klass.object_id.abs}", klass)
|
32
|
+
klass
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
ActiveSupport::TestCase.extend Hermes::Context
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'hermes/assertions'
|
2
|
+
|
3
|
+
class Hermes::IntegrationCase < ActiveSupport::TestCase
|
4
|
+
include Capybara
|
5
|
+
include ActionController::RecordIdentifier
|
6
|
+
include Rails.application.routes.url_helpers
|
7
|
+
include Hermes::Assertions
|
8
|
+
|
9
|
+
teardown { Capybara.reset_sessions! }
|
10
|
+
class << self; alias :scenario :test; end
|
11
|
+
end
|
data/lib/hermes/version.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,22 +1,6 @@
|
|
1
|
-
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
1
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
2
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
|
7
|
-
|
8
|
-
ActionMailer::Base.perform_deliveries = true
|
9
|
-
ActionMailer::Base.default_url_options[:host] = "test.com"
|
10
|
-
|
11
|
-
Rails.backtrace_cleaner.remove_silencers!
|
12
|
-
|
13
|
-
# Configure capybara for integration testing
|
14
|
-
require "capybara/rails"
|
15
|
-
Capybara.default_driver = :rack_test
|
16
|
-
Capybara.default_selector = :css
|
17
|
-
|
18
|
-
# Run any available migration
|
19
|
-
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
20
|
-
|
21
|
-
# Load support files
|
22
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
3
|
+
require 'active_support/test_case'
|
4
|
+
require 'hermes'
|
5
|
+
require 'hermes/context'
|
6
|
+
require 'hermes/integration_case'
|
metadata
CHANGED
@@ -1,37 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hermes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- "Jos\xC3\xA9 Valim"
|
14
|
+
- "Carlos Ant\xC3\xB4nio da Silva"
|
13
15
|
autorequire:
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2010-
|
19
|
+
date: 2010-10-29 00:00:00 -02:00
|
18
20
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
21
|
-
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 1
|
29
|
-
- 0
|
30
|
-
- 0
|
31
|
-
version: 1.0.0
|
32
|
-
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
description: Hermes, the great messenger of the gods, warn us about some common pitfalls while developing Rails applications.
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: A few testing facilities built on top of Capybara and ActiveSupport::TestCase
|
35
24
|
email:
|
36
25
|
- developers@plataformatec.com.br
|
37
26
|
executables: []
|
@@ -41,13 +30,15 @@ extensions: []
|
|
41
30
|
extra_rdoc_files:
|
42
31
|
- README.rdoc
|
43
32
|
files:
|
44
|
-
- lib/hermes/
|
45
|
-
- lib/hermes/
|
46
|
-
- lib/hermes/
|
33
|
+
- lib/hermes/assertions.rb
|
34
|
+
- lib/hermes/builders.rb
|
35
|
+
- lib/hermes/context.rb
|
36
|
+
- lib/hermes/integration_case.rb
|
47
37
|
- lib/hermes/version.rb
|
48
38
|
- lib/hermes.rb
|
49
39
|
- README.rdoc
|
50
40
|
- MIT-LICENSE
|
41
|
+
- test/test_helper.rb
|
51
42
|
has_rdoc: true
|
52
43
|
homepage: http://github.com/plataformatec/hermes
|
53
44
|
licenses: []
|
@@ -59,61 +50,29 @@ rdoc_options:
|
|
59
50
|
require_paths:
|
60
51
|
- lib
|
61
52
|
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
62
54
|
requirements:
|
63
55
|
- - ">="
|
64
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
65
58
|
segments:
|
66
59
|
- 0
|
67
60
|
version: "0"
|
68
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
69
63
|
requirements:
|
70
64
|
- - ">="
|
71
65
|
- !ruby/object:Gem::Version
|
66
|
+
hash: 3
|
72
67
|
segments:
|
73
68
|
- 0
|
74
69
|
version: "0"
|
75
70
|
requirements: []
|
76
71
|
|
77
72
|
rubyforge_project: hermes
|
78
|
-
rubygems_version: 1.3.
|
73
|
+
rubygems_version: 1.3.7
|
79
74
|
signing_key:
|
80
75
|
specification_version: 3
|
81
|
-
summary:
|
76
|
+
summary: A few testing facilities built on top of Capybara and ActiveSupport::TestCase
|
82
77
|
test_files:
|
83
|
-
- test/dummy/app/controllers/application_controller.rb
|
84
|
-
- test/dummy/app/controllers/users_controller.rb
|
85
|
-
- test/dummy/app/helpers/application_helper.rb
|
86
|
-
- test/dummy/app/helpers/users_helper.rb
|
87
|
-
- test/dummy/app/models/user.rb
|
88
|
-
- test/dummy/app/views/layouts/application.html.erb
|
89
|
-
- test/dummy/app/views/users/_form.html.erb
|
90
|
-
- test/dummy/app/views/users/edit.html.erb
|
91
|
-
- test/dummy/app/views/users/index.html.erb
|
92
|
-
- test/dummy/app/views/users/new.html.erb
|
93
|
-
- test/dummy/app/views/users/show.html.erb
|
94
|
-
- test/dummy/config/application.rb
|
95
|
-
- test/dummy/config/boot.rb
|
96
|
-
- test/dummy/config/database.yml
|
97
|
-
- test/dummy/config/environment.rb
|
98
|
-
- test/dummy/config/environments/development.rb
|
99
|
-
- test/dummy/config/environments/production.rb
|
100
|
-
- test/dummy/config/environments/test.rb
|
101
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
102
|
-
- test/dummy/config/initializers/inflections.rb
|
103
|
-
- test/dummy/config/initializers/mime_types.rb
|
104
|
-
- test/dummy/config/initializers/secret_token.rb
|
105
|
-
- test/dummy/config/initializers/session_store.rb
|
106
|
-
- test/dummy/config/locales/en.yml
|
107
|
-
- test/dummy/config/routes.rb
|
108
|
-
- test/dummy/config.ru
|
109
|
-
- test/dummy/db/migrate/20100423185611_create_users.rb
|
110
|
-
- test/dummy/db/test.sqlite3
|
111
|
-
- test/dummy/public/404.html
|
112
|
-
- test/dummy/public/422.html
|
113
|
-
- test/dummy/public/500.html
|
114
|
-
- test/dummy/public/favicon.ico
|
115
|
-
- test/dummy/Rakefile
|
116
|
-
- test/dummy/script/rails
|
117
|
-
- test/hermes_test.rb
|
118
|
-
- test/support/integration_case.rb
|
119
78
|
- test/test_helper.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'active_record/base'
|
2
|
-
|
3
|
-
class ActiveRecord::Base
|
4
|
-
def log_protected_attribute_removal_with_hermes(*attributes)
|
5
|
-
log_protected_attribute_removal_without_hermes(*attributes)
|
6
|
-
Hermes.notify "Can't mass-assign #{self.class.name} protected attributes: #{attributes.to_sentence}."
|
7
|
-
end
|
8
|
-
alias_method_chain :log_protected_attribute_removal, :hermes
|
9
|
-
end
|
data/lib/hermes/railtie.rb
DELETED
data/test/dummy/Rakefile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require File.expand_path('../config/application', __FILE__)
|
5
|
-
|
6
|
-
require 'rake'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
|
10
|
-
Rails::Application.load_tasks
|
@@ -1,83 +0,0 @@
|
|
1
|
-
class UsersController < ApplicationController
|
2
|
-
# GET /users
|
3
|
-
# GET /users.xml
|
4
|
-
def index
|
5
|
-
@users = User.all
|
6
|
-
|
7
|
-
respond_to do |format|
|
8
|
-
format.html # index.html.erb
|
9
|
-
format.xml { render :xml => @users }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
# GET /users/1
|
14
|
-
# GET /users/1.xml
|
15
|
-
def show
|
16
|
-
@user = User.find(params[:id])
|
17
|
-
|
18
|
-
respond_to do |format|
|
19
|
-
format.html # show.html.erb
|
20
|
-
format.xml { render :xml => @user }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# GET /users/new
|
25
|
-
# GET /users/new.xml
|
26
|
-
def new
|
27
|
-
@user = User.new
|
28
|
-
|
29
|
-
respond_to do |format|
|
30
|
-
format.html # new.html.erb
|
31
|
-
format.xml { render :xml => @user }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# GET /users/1/edit
|
36
|
-
def edit
|
37
|
-
@user = User.find(params[:id])
|
38
|
-
end
|
39
|
-
|
40
|
-
# POST /users
|
41
|
-
# POST /users.xml
|
42
|
-
def create
|
43
|
-
@user = User.new(params[:user])
|
44
|
-
|
45
|
-
respond_to do |format|
|
46
|
-
if @user.save
|
47
|
-
format.html { redirect_to(@user, :notice => 'User was successfully created.') }
|
48
|
-
format.xml { render :xml => @user, :status => :created, :location => @user }
|
49
|
-
else
|
50
|
-
format.html { render :action => "new" }
|
51
|
-
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
# PUT /users/1
|
57
|
-
# PUT /users/1.xml
|
58
|
-
def update
|
59
|
-
@user = User.find(params[:id])
|
60
|
-
|
61
|
-
respond_to do |format|
|
62
|
-
if @user.update_attributes(params[:user])
|
63
|
-
format.html { redirect_to(@user, :notice => 'User was successfully updated.') }
|
64
|
-
format.xml { head :ok }
|
65
|
-
else
|
66
|
-
format.html { render :action => "edit" }
|
67
|
-
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# DELETE /users/1
|
73
|
-
# DELETE /users/1.xml
|
74
|
-
def destroy
|
75
|
-
@user = User.find(params[:id])
|
76
|
-
@user.destroy
|
77
|
-
|
78
|
-
respond_to do |format|
|
79
|
-
format.html { redirect_to(users_url) }
|
80
|
-
format.xml { head :ok }
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<%= form_for(@user) do |f| %>
|
2
|
-
<% if @user.errors.any? %>
|
3
|
-
<div id="error_explanation">
|
4
|
-
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
5
|
-
|
6
|
-
<ul>
|
7
|
-
<% @user.errors.full_messages.each do |msg| %>
|
8
|
-
<li><%= msg %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<div class="field">
|
15
|
-
<%= f.label :name %><br />
|
16
|
-
<%= f.text_field :name %>
|
17
|
-
</div>
|
18
|
-
<div class="actions">
|
19
|
-
<%= f.submit %>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<h1>Listing users</h1>
|
2
|
-
|
3
|
-
<table>
|
4
|
-
<tr>
|
5
|
-
<th>Name</th>
|
6
|
-
<th></th>
|
7
|
-
<th></th>
|
8
|
-
<th></th>
|
9
|
-
</tr>
|
10
|
-
|
11
|
-
<% @users.each do |user| %>
|
12
|
-
<tr>
|
13
|
-
<td><%= user.name %></td>
|
14
|
-
<td><%= link_to 'Show', user %></td>
|
15
|
-
<td><%= link_to 'Edit', edit_user_path(user) %></td>
|
16
|
-
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
|
17
|
-
</tr>
|
18
|
-
<% end %>
|
19
|
-
</table>
|
20
|
-
|
21
|
-
<br />
|
22
|
-
|
23
|
-
<%= link_to 'New User', new_user_path %>
|
data/test/dummy/config.ru
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require "active_model/railtie"
|
4
|
-
require "active_record/railtie"
|
5
|
-
require "action_controller/railtie"
|
6
|
-
require "action_view/railtie"
|
7
|
-
require "action_mailer/railtie"
|
8
|
-
|
9
|
-
Bundler.require
|
10
|
-
require "hermes"
|
11
|
-
|
12
|
-
module Dummy
|
13
|
-
class Application < Rails::Application
|
14
|
-
# Settings in config/environments/* take precedence over those specified here.
|
15
|
-
# Application configuration should go into files in config/initializers
|
16
|
-
# -- all .rb files in that directory are automatically loaded.
|
17
|
-
|
18
|
-
# Add additional load paths for your own custom dirs
|
19
|
-
# config.load_paths += %W( #{config.root}/extras )
|
20
|
-
|
21
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
22
|
-
# :all can be used as a placeholder for all plugins not explicitly named
|
23
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
24
|
-
|
25
|
-
# Activate observers that should always be running
|
26
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
27
|
-
|
28
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
29
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
30
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
31
|
-
|
32
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
33
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
-
# config.i18n.default_locale = :de
|
35
|
-
|
36
|
-
# Configure generators values. Many other options are available, be sure to check the documentation.
|
37
|
-
# config.generators do |g|
|
38
|
-
# g.orm :active_record
|
39
|
-
# g.template_engine :erb
|
40
|
-
# g.test_framework :test_unit, :fixture => true
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
44
|
-
config.encoding = "utf-8"
|
45
|
-
|
46
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
47
|
-
config.filter_parameters += [:password]
|
48
|
-
end
|
49
|
-
end
|
data/test/dummy/config/boot.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: db/development.sqlite3
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: db/test.sqlite3
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
17
|
-
|
18
|
-
production:
|
19
|
-
adapter: sqlite3
|
20
|
-
database: db/production.sqlite3
|
21
|
-
pool: 5
|
22
|
-
timeout: 5000
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the webserver when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Log error messages when you accidentally call methods on nil.
|
10
|
-
config.whiny_nils = true
|
11
|
-
|
12
|
-
# Show full error reports and disable caching
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_view.debug_rjs = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Don't care if the mailer can't send
|
18
|
-
config.action_mailer.raise_delivery_errors = false
|
19
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The production environment is meant for finished, "live" apps.
|
5
|
-
# Code is not reloaded between requests
|
6
|
-
config.cache_classes = true
|
7
|
-
|
8
|
-
# Full error reports are disabled and caching is turned on
|
9
|
-
config.consider_all_requests_local = false
|
10
|
-
config.action_controller.perform_caching = true
|
11
|
-
|
12
|
-
# Specifies the header that your server uses for sending files
|
13
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
-
|
15
|
-
# For nginx:
|
16
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
-
|
18
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
-
# just comment this out and Rails will serve the files
|
20
|
-
|
21
|
-
# See everything in the log (default is :info)
|
22
|
-
# config.log_level = :debug
|
23
|
-
|
24
|
-
# Use a different logger for distributed setups
|
25
|
-
# config.logger = SyslogLogger.new
|
26
|
-
|
27
|
-
# Use a different cache store in production
|
28
|
-
# config.cache_store = :mem_cache_store
|
29
|
-
|
30
|
-
# Disable Rails's static asset server
|
31
|
-
# In production, Apache or nginx will already do this
|
32
|
-
config.serve_static_assets = false
|
33
|
-
|
34
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
-
|
37
|
-
# Disable delivery errors, bad email addresses will be ignored
|
38
|
-
# config.action_mailer.raise_delivery_errors = false
|
39
|
-
|
40
|
-
# Enable threaded mode
|
41
|
-
# config.threadsafe!
|
42
|
-
|
43
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
-
# the I18n.default_locale when a translation can not be found)
|
45
|
-
config.i18n.fallbacks = true
|
46
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Raise exceptions instead of rendering exception templates
|
18
|
-
config.action_dispatch.show_exceptions = false
|
19
|
-
|
20
|
-
# Disable request forgery protection in test environment
|
21
|
-
config.action_controller.allow_forgery_protection = false
|
22
|
-
|
23
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
-
# The :test delivery method accumulates sent emails in the
|
25
|
-
# ActionMailer::Base.deliveries array.
|
26
|
-
config.action_mailer.delivery_method = :test
|
27
|
-
|
28
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
-
# like if you have constraints or database-specific column types
|
31
|
-
# config.active_record.schema_format = :sql
|
32
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format
|
4
|
-
# (all these examples are active by default):
|
5
|
-
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
-
# inflect.singular /^(ox)en/i, '\1'
|
8
|
-
# inflect.irregular 'person', 'people'
|
9
|
-
# inflect.uncountable %w( fish sheep )
|
10
|
-
# end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
# Make sure the secret is at least 30 characters and all random,
|
6
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Rails.application.config.secret_token = '37fdf22ab8c7467a756de5cdba07a98966ccf72e93daaea5df843ce4fd58e4f5c95466e39bb98b3111f4c58f8672edbc82a30ac35a9eae72c39689ab2a6e71af'
|
@@ -1,8 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
Rails.application.config.session_store :cookie_store, :key => '_dummy_session'
|
4
|
-
|
5
|
-
# Use the database for sessions instead of the cookie-based default,
|
6
|
-
# which shouldn't be used to store highly confidential information
|
7
|
-
# (create the session table with "rake db:sessions:create")
|
8
|
-
# Rails.application.config.session_store :active_record_store
|
data/test/dummy/config/routes.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
Dummy::Application.routes.draw do |map|
|
2
|
-
resources :users
|
3
|
-
|
4
|
-
# The priority is based upon order of creation:
|
5
|
-
# first created -> highest priority.
|
6
|
-
|
7
|
-
# Sample of regular route:
|
8
|
-
# match 'products/:id' => 'catalog#view'
|
9
|
-
# Keep in mind you can assign values other than :controller and :action
|
10
|
-
|
11
|
-
# Sample of named route:
|
12
|
-
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
13
|
-
# This route can be invoked with purchase_url(:id => product.id)
|
14
|
-
|
15
|
-
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
16
|
-
# resources :products
|
17
|
-
|
18
|
-
# Sample resource route with options:
|
19
|
-
# resources :products do
|
20
|
-
# member do
|
21
|
-
# get :short
|
22
|
-
# post :toggle
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# collection do
|
26
|
-
# get :sold
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
|
30
|
-
# Sample resource route with sub-resources:
|
31
|
-
# resources :products do
|
32
|
-
# resources :comments, :sales
|
33
|
-
# resource :seller
|
34
|
-
# end
|
35
|
-
|
36
|
-
# Sample resource route with more complex sub-resources
|
37
|
-
# resources :products do
|
38
|
-
# resources :comments
|
39
|
-
# resources :sales do
|
40
|
-
# get :recent, :on => :collection
|
41
|
-
# end
|
42
|
-
# end
|
43
|
-
|
44
|
-
# Sample resource route within a namespace:
|
45
|
-
# namespace :admin do
|
46
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
47
|
-
# # (app/controllers/admin/products_controller.rb)
|
48
|
-
# resources :products
|
49
|
-
# end
|
50
|
-
|
51
|
-
# You can have the root of your site routed with "root"
|
52
|
-
# just remember to delete public/index.html.
|
53
|
-
# root :to => "welcome#index"
|
54
|
-
|
55
|
-
# See how all your routes lay out with "rake routes"
|
56
|
-
|
57
|
-
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
58
|
-
# Note: This route will make all actions in every controller accessible via GET requests.
|
59
|
-
# match ':controller(/:action(/:id(.:format)))'
|
60
|
-
end
|
data/test/dummy/db/test.sqlite3
DELETED
Binary file
|
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
ENV_PATH = File.expand_path('../../config/environment', __FILE__)
|
5
|
-
BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
|
6
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
7
|
-
|
8
|
-
require BOOT_PATH
|
9
|
-
require 'rails/commands'
|
data/test/hermes_test.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class HermesStackTest < ActiveSupport::IntegrationCase
|
5
|
-
setup do
|
6
|
-
@messages = []
|
7
|
-
Hermes.notifiers << lambda { |msg| @messages << msg }
|
8
|
-
end
|
9
|
-
|
10
|
-
teardown do
|
11
|
-
Hermes.notifiers.pop
|
12
|
-
end
|
13
|
-
|
14
|
-
test "notifies when assigning a protected attribute" do
|
15
|
-
User.create!(:id => 1, :name => "José Valim", :age => 23)
|
16
|
-
assert_equal "Can't mass-assign User protected attributes: id.", @messages.last
|
17
|
-
end
|
18
|
-
end
|