- features/step_definitions/culerity_steps.rb
$browser = Culerity::RemoteBrowserProxy.new $server, {:browser => :firefox3,
:javascript_exceptions => true,
:resynchronize => true,
:status_code_exceptions => true
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/validation_reflection.rb | |
def remember_validation_metadata(validation_type, *attr_names) | |
configuration = attr_names.last.is_a?(::Hash) ? attr_names.pop : {} | |
attr_names.flatten.each do |attr_name| | |
self.write_inheritable_array :validations, | |
[::ActiveRecord::Reflection::MacroReflection.new(validation_type, attr_name.to_sym, configuration, self)] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When I follow "Log in" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/culerity.rb | |
def self.run_server | |
IO.popen(%{#{jruby_invocation} "#{celerity_invocation}"}, 'r+').extend(ServerCommands) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$browser.link(:text, "Log in").click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/culerity/remote_browser_object.rb | |
def method_missing(name, *args, &block) | |
send_remote(name, *args, &block) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/culerity/remote_browser_object.rb | |
def send_remote(name, *args, &blk) | |
input = [remote_object_id, %Q{"#{name}"}, *args.map{|a| arg_to_string(a)}] | |
serialized_block = ", #{block_to_string(&blk)}" if block_given? | |
@io << "[[#{input.join(", ")}]#{serialized_block}]\n" | |
process_result @io.gets.to_s.strip | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[remote_object_id, "link", "Log in"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/culerity/celerity_server.rb | |
def initialize(_in, _out) | |
... | |
while(true) | |
call, block = eval _in.gets.to_s.strip | |
... | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/culerity/celerity_server.rb | |
def initialize(_in, _out) | |
... | |
while(true) | |
call, block = eval _in.gets.to_s.strip | |
... | |
unless call.nil? | |
begin | |
result = target(call.first).send call[1], *call[2..-1], &block |