diabolo-webrat 0.4.4.2 → 0.5.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.
- data/.document +4 -0
- data/.gitignore +15 -0
- data/History.txt +60 -9
- data/Rakefile +90 -75
- data/VERSION +1 -0
- data/lib/webrat.rb +8 -23
- data/lib/webrat/{mechanize.rb → adapters/mechanize.rb} +6 -2
- data/lib/webrat/adapters/merb.rb +11 -0
- data/lib/webrat/adapters/rack.rb +25 -0
- data/lib/webrat/{rails.rb → adapters/rails.rb} +9 -18
- data/lib/webrat/adapters/sinatra.rb +9 -0
- data/lib/webrat/core.rb +0 -1
- data/lib/webrat/core/configuration.rb +7 -17
- data/lib/webrat/core/elements/area.rb +2 -2
- data/lib/webrat/core/elements/element.rb +3 -3
- data/lib/webrat/core/elements/field.rb +33 -30
- data/lib/webrat/core/elements/form.rb +4 -4
- data/lib/webrat/core/elements/label.rb +4 -4
- data/lib/webrat/core/elements/link.rb +7 -6
- data/lib/webrat/core/elements/select_option.rb +2 -2
- data/lib/webrat/core/locators.rb +1 -1
- data/lib/webrat/core/locators/area_locator.rb +3 -3
- data/lib/webrat/core/locators/button_locator.rb +6 -6
- data/lib/webrat/core/locators/field_by_id_locator.rb +3 -3
- data/lib/webrat/core/locators/field_labeled_locator.rb +2 -2
- data/lib/webrat/core/locators/field_named_locator.rb +3 -3
- data/lib/webrat/core/locators/form_locator.rb +1 -1
- data/lib/webrat/core/locators/label_locator.rb +2 -2
- data/lib/webrat/core/locators/link_locator.rb +20 -12
- data/lib/webrat/core/locators/select_option_locator.rb +5 -5
- data/lib/webrat/core/logging.rb +1 -1
- data/lib/webrat/core/matchers/have_content.rb +2 -7
- data/lib/webrat/core/matchers/have_xpath.rb +2 -27
- data/lib/webrat/core/methods.rb +4 -4
- data/lib/webrat/core/mime.rb +11 -22
- data/lib/webrat/core/save_and_open_page.rb +5 -7
- data/lib/webrat/core/scope.rb +2 -2
- data/lib/webrat/core/session.rb +30 -14
- data/lib/webrat/core/xml.rb +41 -84
- data/lib/webrat/integrations/merb.rb +10 -0
- data/lib/webrat/integrations/rails.rb +9 -0
- data/lib/webrat/integrations/rspec-rails.rb +10 -0
- data/lib/webrat/integrations/selenium.rb +11 -0
- data/lib/webrat/rspec-rails.rb +2 -13
- data/lib/webrat/selenium.rb +0 -11
- data/lib/webrat/selenium/application_server_factory.rb +40 -0
- data/lib/webrat/selenium/application_servers.rb +5 -0
- data/lib/webrat/selenium/application_servers/base.rb +46 -0
- data/lib/webrat/selenium/application_servers/external.rb +26 -0
- data/lib/webrat/selenium/application_servers/merb.rb +50 -0
- data/lib/webrat/selenium/application_servers/rails.rb +44 -0
- data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
- data/lib/webrat/selenium/location_strategy_javascript/label.js +2 -1
- data/lib/webrat/selenium/selenium_rc_server.rb +7 -5
- data/lib/webrat/selenium/selenium_session.rb +20 -7
- data/lib/webrat/selenium/silence_stream.rb +1 -1
- data/spec/fakes/{test_session.rb → test_adapter.rb} +6 -3
- data/spec/integration/mechanize/Rakefile +7 -0
- data/spec/integration/mechanize/config.ru +2 -0
- data/spec/integration/mechanize/sample_app.rb +20 -0
- data/spec/integration/mechanize/spec/mechanize_spec.rb +22 -0
- data/spec/integration/mechanize/spec/spec_helper.rb +27 -0
- data/spec/integration/merb/.gitignore +21 -0
- data/spec/integration/merb/Rakefile +35 -0
- data/spec/integration/merb/app/controllers/testing.rb +9 -0
- data/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
- data/spec/integration/merb/app/views/layout/application.html.erb +12 -0
- data/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
- data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
- data/spec/integration/merb/config/router.rb +1 -0
- data/spec/integration/merb/spec/spec.opts +1 -0
- data/spec/integration/merb/spec/spec_helper.rb +2 -0
- data/spec/integration/merb/spec/webrat_spec.rb +7 -0
- data/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
- data/spec/integration/rack/Rakefile +5 -0
- data/spec/integration/rack/app.rb +89 -0
- data/spec/integration/rack/test/helper.rb +21 -0
- data/spec/integration/rack/test/webrat_rack_test.rb +57 -51
- data/spec/integration/rails/.gitignore +3 -0
- data/spec/integration/rails/Rakefile +30 -0
- data/spec/integration/rails/app/controllers/webrat_controller.rb +13 -9
- data/spec/integration/rails/app/views/buttons/show.html.erb +11 -0
- data/spec/integration/rails/app/views/fields/show.html.erb +9 -0
- data/spec/integration/rails/app/views/links/show.html.erb +5 -0
- data/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
- data/spec/integration/rails/app/views/webrat/buttons.html.erb +11 -0
- data/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
- data/spec/integration/rails/config/locales/en.yml +5 -0
- data/spec/integration/rails/config/routes.rb +1 -0
- data/spec/integration/rails/public/404.html +30 -0
- data/spec/integration/rails/public/422.html +30 -0
- data/spec/integration/rails/public/500.html +33 -0
- data/spec/integration/rails/script/about +4 -0
- data/spec/integration/rails/script/console +3 -0
- data/spec/integration/rails/script/dbconsole +3 -0
- data/spec/integration/rails/script/destroy +3 -0
- data/spec/integration/rails/script/generate +3 -0
- data/spec/integration/rails/script/performance/benchmarker +3 -0
- data/spec/integration/rails/script/performance/profiler +3 -0
- data/spec/integration/rails/script/performance/request +3 -0
- data/spec/integration/rails/script/plugin +3 -0
- data/spec/integration/rails/script/process/inspector +3 -0
- data/spec/integration/rails/script/process/reaper +3 -0
- data/spec/integration/rails/script/process/spawner +3 -0
- data/spec/integration/rails/script/runner +3 -0
- data/spec/integration/rails/script/server +3 -0
- data/spec/integration/rails/test/integration/button_click_test.rb +2 -2
- data/spec/integration/rails/test/integration/link_click_test.rb +7 -1
- data/spec/integration/rails/test/integration/webrat_test.rb +22 -0
- data/spec/integration/rails/test/test_helper.rb +6 -5
- data/spec/integration/sinatra/Rakefile +5 -0
- data/spec/integration/sinatra/test/test_helper.rb +3 -2
- data/spec/private/core/configuration_spec.rb +8 -27
- data/spec/private/core/field_spec.rb +7 -7
- data/spec/private/core/link_spec.rb +1 -1
- data/spec/private/core/session_spec.rb +23 -21
- data/spec/private/mechanize/{mechanize_session_spec.rb → mechanize_adapter_spec.rb} +4 -12
- data/spec/private/nokogiri_spec.rb +2 -2
- data/spec/private/rails/{rails_session_spec.rb → rails_adapter_spec.rb} +16 -16
- data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
- data/spec/public/matchers/contain_spec.rb +4 -4
- data/spec/public/matchers/have_selector_spec.rb +2 -2
- data/spec/public/matchers/have_xpath_spec.rb +3 -3
- data/spec/public/save_and_open_spec.rb +25 -6
- data/spec/public/selenium/application_server_factory_spec.rb +49 -0
- data/spec/public/selenium/application_servers/external_spec.rb +12 -0
- data/spec/public/selenium/selenium_session_spec.rb +37 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +5 -1
- data/vendor/selenium-server.jar +0 -0
- data/webrat.gemspec +348 -0
- metadata +176 -23
- data/lib/webrat/core/xml/hpricot.rb +0 -19
- data/lib/webrat/core/xml/nokogiri.rb +0 -76
- data/lib/webrat/core/xml/rexml.rb +0 -24
- data/lib/webrat/merb_session.rb +0 -65
- data/lib/webrat/rack.rb +0 -24
- data/lib/webrat/rack_test.rb +0 -32
- data/lib/webrat/selenium/application_server.rb +0 -73
- data/lib/webrat/selenium/merb_application_server.rb +0 -48
- data/lib/webrat/selenium/rails_application_server.rb +0 -42
- data/lib/webrat/selenium/sinatra_application_server.rb +0 -35
- data/lib/webrat/sinatra.rb +0 -44
- data/spec/integration/rack/rack_app.rb +0 -16
- data/spec/integration/rack/test/test_helper.rb +0 -20
- data/spec/private/merb/merb_session_spec.rb +0 -42
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require "webrat/selenium/application_servers/base"
|
|
2
|
+
|
|
3
|
+
module Webrat
|
|
4
|
+
module Selenium
|
|
5
|
+
module ApplicationServers
|
|
6
|
+
class Sinatra < Webrat::Selenium::ApplicationServers::Base
|
|
7
|
+
|
|
8
|
+
def start
|
|
9
|
+
fork do
|
|
10
|
+
File.open('rack.pid', 'w') { |fp| fp.write Process.pid }
|
|
11
|
+
exec 'rackup', File.expand_path(Dir.pwd + '/config.ru'), '-p', Webrat.configuration.application_port.to_s
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def stop
|
|
16
|
+
silence_stream(STDOUT) do
|
|
17
|
+
pid = File.read(pid_file)
|
|
18
|
+
system("kill -9 #{pid}")
|
|
19
|
+
FileUtils.rm_f pid_file
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def fail
|
|
24
|
+
$stderr.puts
|
|
25
|
+
$stderr.puts
|
|
26
|
+
$stderr.puts "==> Failed to boot the Sinatra application server... exiting!"
|
|
27
|
+
exit
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def pid_file
|
|
31
|
+
prepare_pid_file(Dir.pwd, 'rack.pid')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
var allLabels = inDocument.getElementsByTagName("label");
|
|
2
2
|
var candidateLabels = $A(allLabels).select(function(candidateLabel){
|
|
3
|
+
var regExp = new RegExp('^' + locator + '\\b', 'i');
|
|
3
4
|
var labelText = getText(candidateLabel).strip();
|
|
4
|
-
return labelText.
|
|
5
|
+
return (labelText.search(regExp) >= 0);
|
|
5
6
|
});
|
|
6
7
|
if (candidateLabels.length == 0) {
|
|
7
8
|
return null;
|
|
@@ -2,7 +2,7 @@ module Webrat
|
|
|
2
2
|
module Selenium
|
|
3
3
|
|
|
4
4
|
class SeleniumRCServer
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
include Webrat::Selenium::SilenceStream
|
|
7
7
|
|
|
8
8
|
def self.boot
|
|
@@ -32,9 +32,9 @@ module Webrat
|
|
|
32
32
|
def remote_control
|
|
33
33
|
return @remote_control if @remote_control
|
|
34
34
|
|
|
35
|
-
@remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
|
|
36
|
-
Webrat.configuration.selenium_server_port,
|
|
37
|
-
Webrat.configuration.selenium_browser_startup_timeout)
|
|
35
|
+
@remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
|
|
36
|
+
Webrat.configuration.selenium_server_port,
|
|
37
|
+
:timeout => Webrat.configuration.selenium_browser_startup_timeout)
|
|
38
38
|
@remote_control.jar_file = jar_path
|
|
39
39
|
|
|
40
40
|
return @remote_control
|
|
@@ -74,7 +74,9 @@ module Webrat
|
|
|
74
74
|
|
|
75
75
|
def stop
|
|
76
76
|
silence_stream(STDOUT) do
|
|
77
|
-
::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
|
|
77
|
+
::Selenium::RemoteControl::RemoteControl.new("0.0.0.0",
|
|
78
|
+
Webrat.configuration.selenium_server_port,
|
|
79
|
+
:timeout => 5).stop
|
|
78
80
|
end
|
|
79
81
|
end
|
|
80
82
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
require "webrat/core/save_and_open_page"
|
|
2
2
|
require "webrat/selenium/selenium_rc_server"
|
|
3
|
-
require "webrat/selenium/
|
|
3
|
+
require "webrat/selenium/application_server_factory"
|
|
4
|
+
require "webrat/selenium/application_servers/base"
|
|
5
|
+
|
|
6
|
+
require "selenium"
|
|
4
7
|
|
|
5
8
|
module Webrat
|
|
6
9
|
class TimeoutError < WebratError
|
|
@@ -150,8 +153,10 @@ module Webrat
|
|
|
150
153
|
|
|
151
154
|
begin
|
|
152
155
|
value = yield
|
|
153
|
-
rescue
|
|
154
|
-
|
|
156
|
+
rescue Exception => e
|
|
157
|
+
unless is_ignorable_wait_for_exception?(e)
|
|
158
|
+
raise e
|
|
159
|
+
end
|
|
155
160
|
end
|
|
156
161
|
|
|
157
162
|
return value if value
|
|
@@ -182,14 +187,22 @@ module Webrat
|
|
|
182
187
|
else
|
|
183
188
|
$browser.capture_screenshot(filename)
|
|
184
189
|
end
|
|
185
|
-
|
|
190
|
+
open_in_browser(filename)
|
|
191
|
+
|
|
186
192
|
end
|
|
187
193
|
|
|
188
|
-
|
|
194
|
+
protected
|
|
195
|
+
def is_ignorable_wait_for_exception?(exception) #:nodoc:
|
|
196
|
+
if defined?(::Spec::Expectations::ExpectationNotMetError)
|
|
197
|
+
return true if exception.class == ::Spec::Expectations::ExpectationNotMetError
|
|
198
|
+
end
|
|
199
|
+
return true if [::Selenium::CommandError, Webrat::WebratError].include?(exception.class)
|
|
200
|
+
return false
|
|
201
|
+
end
|
|
189
202
|
|
|
190
203
|
def setup #:nodoc:
|
|
191
204
|
Webrat::Selenium::SeleniumRCServer.boot
|
|
192
|
-
Webrat::Selenium::
|
|
205
|
+
Webrat::Selenium::ApplicationServerFactory.app_server_instance.boot
|
|
193
206
|
|
|
194
207
|
create_browser
|
|
195
208
|
$browser.start
|
|
@@ -202,7 +215,7 @@ module Webrat
|
|
|
202
215
|
|
|
203
216
|
def create_browser
|
|
204
217
|
$browser = ::Selenium::Client::Driver.new(Webrat.configuration.selenium_server_address || "localhost",
|
|
205
|
-
|
|
218
|
+
Webrat.configuration.selenium_server_port, Webrat.configuration.selenium_browser_key, "http://#{Webrat.configuration.application_address}:#{Webrat.configuration.application_port}")
|
|
206
219
|
$browser.set_speed(0) unless Webrat.configuration.selenium_server_address
|
|
207
220
|
|
|
208
221
|
at_exit do
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
module Webrat #:nodoc:
|
|
2
|
-
def self.
|
|
3
|
-
|
|
2
|
+
def self.adapter_class #:nodoc:
|
|
3
|
+
TestAdapter
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class TestAdapter #:nodoc:
|
|
7
7
|
attr_accessor :response_body
|
|
8
8
|
attr_writer :response_code
|
|
9
9
|
|
|
10
|
+
def initialize(*args)
|
|
11
|
+
end
|
|
12
|
+
|
|
10
13
|
def doc_root
|
|
11
14
|
File.expand_path(File.join(".", "public"))
|
|
12
15
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "rubygems"
|
|
2
|
+
require "sinatra/base"
|
|
3
|
+
|
|
4
|
+
class SampleApp < Sinatra::Default
|
|
5
|
+
get "/" do
|
|
6
|
+
"Hello World"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
get "/internal_redirect" do
|
|
10
|
+
redirect URI.join(request.url, "redirected").to_s
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
get "/external_redirect" do
|
|
14
|
+
redirect "http://example.tst/"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
get "/redirected" do
|
|
18
|
+
"Redirected"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "Webrat's Mechanize mode" do
|
|
4
|
+
it "should work" do
|
|
5
|
+
response = visit("http://localhost:9292/")
|
|
6
|
+
response.should contain("Hello World")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "should follow redirects" do
|
|
10
|
+
response = visit("http://localhost:9292/internal_redirect")
|
|
11
|
+
response.should contain("Redirected")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "should follow links"
|
|
15
|
+
it "should submit forms"
|
|
16
|
+
it "should not follow external redirects" do
|
|
17
|
+
pending do
|
|
18
|
+
response = visit("http://localhost:9292/external_redirect")
|
|
19
|
+
response.should contain("Foo")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require "rubygems"
|
|
2
|
+
require "spec"
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
|
|
5
|
+
require "webrat"
|
|
6
|
+
|
|
7
|
+
Webrat.configure do |config|
|
|
8
|
+
config.mode = :mechanize
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Spec::Runner.configure do |config|
|
|
12
|
+
config.include Webrat::Methods
|
|
13
|
+
config.include Webrat::Matchers
|
|
14
|
+
|
|
15
|
+
config.before :suite do
|
|
16
|
+
if File.exists?("rack.pid")
|
|
17
|
+
Process.kill("TERM", File.read("rack.pid").to_i)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
system "rackup --daemonize --pid rack.pid config.ru"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
config.after :suite do
|
|
24
|
+
Process.kill("TERM", File.read("rack.pid").to_i)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
log/*
|
|
3
|
+
tmp/*
|
|
4
|
+
TAGS
|
|
5
|
+
*~
|
|
6
|
+
.#*
|
|
7
|
+
schema/schema.rb
|
|
8
|
+
schema/*_structure.sql
|
|
9
|
+
schema/*.sqlite3
|
|
10
|
+
schema/*.sqlite
|
|
11
|
+
schema/*.db
|
|
12
|
+
*.sqlite
|
|
13
|
+
*.sqlite3
|
|
14
|
+
*.db
|
|
15
|
+
src/*
|
|
16
|
+
.hgignore
|
|
17
|
+
.hg/*
|
|
18
|
+
.svn/*
|
|
19
|
+
gems/gems/*
|
|
20
|
+
gems/specifications/*
|
|
21
|
+
merb_profile_results
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake/rdoctask'
|
|
3
|
+
|
|
4
|
+
require 'merb-core'
|
|
5
|
+
require 'merb-core/tasks/merb'
|
|
6
|
+
|
|
7
|
+
include FileUtils
|
|
8
|
+
|
|
9
|
+
# Load the basic runtime dependencies; this will include
|
|
10
|
+
# any plugins and therefore plugin rake tasks.
|
|
11
|
+
init_env = ENV['MERB_ENV'] || 'rake'
|
|
12
|
+
Merb.load_dependencies(:environment => init_env)
|
|
13
|
+
|
|
14
|
+
# Get Merb plugins and dependencies
|
|
15
|
+
Merb::Plugins.rakefiles.each { |r| require r }
|
|
16
|
+
|
|
17
|
+
# Load any app level custom rakefile extensions from lib/tasks
|
|
18
|
+
tasks_path = File.join(File.dirname(__FILE__), "lib", "tasks")
|
|
19
|
+
rake_files = Dir["#{tasks_path}/*.rake"]
|
|
20
|
+
rake_files.each{|rake_file| load rake_file }
|
|
21
|
+
|
|
22
|
+
desc "Start runner environment"
|
|
23
|
+
task :merb_env do
|
|
24
|
+
Merb.start_environment(:environment => init_env, :adapter => 'runner')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
require 'spec/rake/spectask'
|
|
28
|
+
require 'merb-core/test/tasks/spectasks'
|
|
29
|
+
desc 'Default: run spec examples'
|
|
30
|
+
task :default => 'spec'
|
|
31
|
+
|
|
32
|
+
##############################################################################
|
|
33
|
+
# ADD YOUR CUSTOM TASKS IN /lib/tasks
|
|
34
|
+
# NAME YOUR RAKE FILES file_name.rake
|
|
35
|
+
##############################################################################
|
|
@@ -4,6 +4,15 @@ class Testing < Application
|
|
|
4
4
|
render
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
def upload
|
|
8
|
+
case request.method
|
|
9
|
+
when :get then render
|
|
10
|
+
when :post then
|
|
11
|
+
uploaded_file = params[:uploaded_file]
|
|
12
|
+
render [uploaded_file[:filename], uploaded_file[:tempfile].class.name].inspect
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
7
16
|
def submit_form
|
|
8
17
|
end
|
|
9
18
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<div id="container">
|
|
2
|
+
<div id="header-container">
|
|
3
|
+
<img src="/images/merb.jpg" />
|
|
4
|
+
<!-- <h1>Mongrel + Erb</h1> -->
|
|
5
|
+
<h2>pocket rocket web framework</h2>
|
|
6
|
+
<hr />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div id="left-container">
|
|
10
|
+
<h3>Exception:</h3>
|
|
11
|
+
<p><%= request.exceptions.first.message %></p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div id="main-container">
|
|
15
|
+
<h3>Why am I seeing this page?</h3>
|
|
16
|
+
<p>Merb couldn't find an appropriate content_type to return,
|
|
17
|
+
based on what you said was available via provides() and
|
|
18
|
+
what the client requested.</p>
|
|
19
|
+
|
|
20
|
+
<h3>How to add a mime-type</h3>
|
|
21
|
+
<pre><code>
|
|
22
|
+
Merb.add_mime_type :pdf, :to_pdf, %w[application/pdf], "Content-Encoding" => "gzip"
|
|
23
|
+
</code></pre>
|
|
24
|
+
<h3>What this means is:</h3>
|
|
25
|
+
<ul>
|
|
26
|
+
<li>Add a mime-type for :pdf</li>
|
|
27
|
+
<li>Register the method for converting objects to PDF as <code>#to_pdf</code>.</li>
|
|
28
|
+
<li>Register the incoming mime-type "Accept" header as <code>application/pdf</code>.</li>
|
|
29
|
+
<li>Specify a new header for PDF types so it will set <code>Content-Encoding</code> to gzip.</li>
|
|
30
|
+
</ul>
|
|
31
|
+
|
|
32
|
+
<h3>You can then do:</h3>
|
|
33
|
+
<pre><code>
|
|
34
|
+
class Foo < Application
|
|
35
|
+
provides :pdf
|
|
36
|
+
end
|
|
37
|
+
</code></pre>
|
|
38
|
+
|
|
39
|
+
<h3>Where can I find help?</h3>
|
|
40
|
+
<p>If you have any questions or if you can't figure something out, please take a
|
|
41
|
+
look at our <a href="http://merbivore.com/"> project page</a>,
|
|
42
|
+
feel free to come chat at irc.freenode.net, channel #merb,
|
|
43
|
+
or post to <a href="http://groups.google.com/group/merb">merb mailing list</a>
|
|
44
|
+
on Google Groups.</p>
|
|
45
|
+
|
|
46
|
+
<h3>What if I've found a bug?</h3>
|
|
47
|
+
<p>If you want to file a bug or make your own contribution to Merb,
|
|
48
|
+
feel free to register and create a ticket at our
|
|
49
|
+
<a href="http://merb.lighthouseapp.com/">project development page</a>
|
|
50
|
+
on Lighthouse.</p>
|
|
51
|
+
|
|
52
|
+
<h3>How do I edit this page?</h3>
|
|
53
|
+
<p>You can change what people see when this happens by editing <tt>app/views/exceptions/not_acceptable.html.erb</tt>.</p>
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div id="footer-container">
|
|
58
|
+
<hr />
|
|
59
|
+
<div class="left"></div>
|
|
60
|
+
<div class="right">© 2008 the merb dev team</div>
|
|
61
|
+
<p> </p>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<div id="container">
|
|
2
|
+
<div id="header-container">
|
|
3
|
+
<img src="/images/merb.jpg" />
|
|
4
|
+
<!-- <h1>Mongrel + Erb</h1> -->
|
|
5
|
+
<h2>pocket rocket web framework</h2>
|
|
6
|
+
<hr />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div id="left-container">
|
|
10
|
+
<h3>Exception:</h3>
|
|
11
|
+
<p><%= request.exceptions.first.message %></p>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div id="main-container">
|
|
15
|
+
<h3>Welcome to Merb!</h3>
|
|
16
|
+
<p>Merb is a light-weight MVC framework written in Ruby. We hope you enjoy it.</p>
|
|
17
|
+
|
|
18
|
+
<h3>Where can I find help?</h3>
|
|
19
|
+
<p>If you have any questions or if you can't figure something out, please take a
|
|
20
|
+
look at our <a href="http://merbivore.com/"> project page</a>,
|
|
21
|
+
feel free to come chat at irc.freenode.net, channel #merb,
|
|
22
|
+
or post to <a href="http://groups.google.com/group/merb">merb mailing list</a>
|
|
23
|
+
on Google Groups.</p>
|
|
24
|
+
|
|
25
|
+
<h3>What if I've found a bug?</h3>
|
|
26
|
+
<p>If you want to file a bug or make your own contribution to Merb,
|
|
27
|
+
feel free to register and create a ticket at our
|
|
28
|
+
<a href="http://merb.lighthouseapp.com/">project development page</a>
|
|
29
|
+
on Lighthouse.</p>
|
|
30
|
+
|
|
31
|
+
<h3>How do I edit this page?</h3>
|
|
32
|
+
<p>You're seeing this page because you need to edit the following files:
|
|
33
|
+
<ul>
|
|
34
|
+
<li>config/router.rb <strong><em>(recommended)</em></strong></li>
|
|
35
|
+
<li>app/views/exceptions/not_found.html.erb <strong><em>(recommended)</em></strong></li>
|
|
36
|
+
<li>app/views/layout/application.html.erb <strong><em>(change this layout)</em></strong></li>
|
|
37
|
+
</ul>
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div id="footer-container">
|
|
42
|
+
<hr />
|
|
43
|
+
<div class="left"></div>
|
|
44
|
+
<div class="right">© 2008 the merb dev team</div>
|
|
45
|
+
<p> </p>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|