Permalink
Browse files

starting to add the nessecary files for cukes

  • Loading branch information...
1 parent 00b5602 commit 49cd7f1ed82e3154a54581acadc6a2645d926f45 @cheezy committed May 11, 2011
Showing with 20 additions and 16 deletions.
  1. +8 −1 Rakefile
  2. +4 −0 cucumber.yml
  3. +4 −0 features/support/env.rb
  4. +4 −15 spec/page-object/page-object_spec.rb
View
@@ -1,15 +1,22 @@
require 'rubygems'
require 'bundler'
+require 'rspec/core/rake_task'
+require 'cucumber'
+require 'cucumber/rake/task'
+
Bundler::GemHelper.install_tasks
-require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.ruby_opts = "-I lib:spec"
spec.pattern = 'spec/**/*_spec.rb'
end
task :spec
+Cucumber::Rake::Task.new(:features) do |t|
+ t.cucumber_opts = "features --format pretty"
+end
+
task :lib do
$LOAD_PATH.unshift(File.expand_path("lib", File.dirname(__FILE__)))
end
View
@@ -0,0 +1,4 @@
+default: --no-source
+watir: --no-source --tags @watir
+selenium: --no-source --tags @selenium
+
View
@@ -0,0 +1,4 @@
+require 'rspec/expectations'
+
+
+
@@ -34,30 +34,19 @@ class TestPageObject
describe "page level functionality" do
context "when using WatirPageObject" do
- def mock_watir_browser
- watir_browser = double('watir')
- watir_browser.should_receive(:is_a?).with(Watir::Browser).and_return(true)
- watir_browser
- end
-
+ let(:watir_browser) { mock_watir_browser }
+
it "should display the page text" do
- watir_browser = mock_watir_browser
watir_browser.should_receive(:text).and_return("browser text")
page_object = TestPageObject.new(watir_browser)
page_object.text.should == "browser text"
end
end
context "when using SeleniumPageObject" do
- def mock_selenium_browser
- selenium_browser = double('selenium')
- selenium_browser.should_receive(:is_a?).with(Watir::Browser).and_return(false)
- selenium_browser.should_receive(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
- selenium_browser
- end
-
+ let(:selenium_browser) { mock_selenium_browser }
+
it "should display the page text" do
- selenium_browser = mock_selenium_browser
selenium_browser.should_receive(:body_text).and_return("browser text")
page = TestPageObject.new(selenium_browser)
page.text.should == "browser text"

0 comments on commit 49cd7f1

Please sign in to comment.