Skip to content

Commit

Permalink
Trying to get tests passing.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.openqa.org/svn/selenium-on-rails/selenium-on-rails@125 9274398c-e119-0410-8437-aa71ef7847aa
  • Loading branch information
eric@8thlight.com committed Mar 7, 2009
1 parent aafa374 commit d5ae749
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
config.yml
config.yml
gems
3 changes: 2 additions & 1 deletion README
Expand Up @@ -71,7 +71,8 @@ and in a RHTML test case:

Configuration

There are a number of settings available. You make them by renaming config.yml.example to config.yml and make your changes in that file.
There are a number of settings available. You make them by renaming selenium.yml.example to selenium.yml and placing it in your rails app's config
file. Make your changes in that file.
Environments

Per default this plugin is only available in test environment. You can change this by setting environments, such as:
Expand Down
3 changes: 1 addition & 2 deletions lib/selenium_on_rails_config.rb
Expand Up @@ -14,8 +14,7 @@ def self.get var, default = nil
def self.configs
@@configs ||= nil
unless @@configs
files = [File.expand_path(File.dirname(__FILE__) + '/../config.yml')]
files << File.join(RAILS_ROOT, 'config', 'selenium.yml')
files = [File.join(RAILS_ROOT, 'config', 'selenium.yml')]
files.each do |file|
@@configs = YAML.load(ERB.new(IO.read(file)).result) if File.exist?(file)
end
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/selenese_test.rb
@@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/test_helper'
require File.dirname(__FILE__) + '/test_helper'

class SeleneseTest < Test::Unit::TestCase

Expand Down Expand Up @@ -46,7 +46,7 @@ def test_one_line
assert_selenese expected, 'One line', input
end

def test_comments_only
def test_comments_only
expected = <<END
<p>Comment <strong>1</strong></p>
Expand All @@ -57,7 +57,7 @@ def test_comments_only
</table>
END
input = <<END
Comment *1*
Comment 2
Expand Down
25 changes: 2 additions & 23 deletions test/selenium_on_rails_config_test.rb
Expand Up @@ -12,35 +12,14 @@ class SeleniumOnRailsConfigTest < Test::Unit::TestCase
def setup
SeleniumOnRailsConfig.reset_config
@selenium_file = File.join(RAILS_ROOT, 'config', 'selenium.yml')
@config_file = File.expand_path(File.dirname(__FILE__) + '/../config.yml')
@selenium_content = File.read(File.dirname(__FILE__) + '/fixtures/selenium.yml')
@config_content = File.read(File.dirname(__FILE__) + '/fixtures/config.yml')
end

def test_get_when_config_yml_and_selenium_yaml_not_exists
File.expects(:exist?).with(@selenium_file).returns(false)
File.expects(:exist?).with(@config_file).returns(false)
IO.expects(:read).with(@config_file).never
IO.expects(:read).with(@selenium_file).never
assert_equal ["test"], SeleniumOnRailsConfig.get(:environments)
end

def test_get_when_config_yml_not_exists_but_selenium_yaml_exists

def test_get_selenium_yaml
File.expects(:exist?).with(@selenium_file).returns(true)
File.expects(:exist?).with(@config_file).returns(false)
IO.expects(:read).with(@config_file).never
IO.expects(:read).with(@selenium_file).returns(@selenium_content)
assert_equal ["test_cache"], SeleniumOnRailsConfig.get(:environments)
assert_equal({"firefox"=>"script/openfirefox"}, SeleniumOnRailsConfig.get(:browsers))
end

def test_get_when_config_yml_exists_but_selenium_yaml_not
File.expects(:exist?).with(@selenium_file).returns(false)
File.expects(:exist?).with(@config_file).returns(true)
IO.expects(:read).with(@config_file).returns(@config_content)
IO.expects(:read).with(@selenium_file).never
assert_equal ["test"], SeleniumOnRailsConfig.get(:environments)
assert_equal({"firefox"=>"script/openfirefox"}, SeleniumOnRailsConfig.get(:browsers))
end

end

0 comments on commit d5ae749

Please sign in to comment.