diff --git a/.gitignore b/.gitignore index 0f1fad3..efa8621 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .vagrant themes/* plugins/* -wordpress/* \ No newline at end of file +wordpress/* +Gemfile.lock + diff --git a/Gemfile b/Gemfile index bd7c437..bb93b34 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,7 @@ # A sample Gemfile source "http://rubygems.org" -gem "vagrant" +gem "vagrant", '~> 0.8.0' +gem 'cucumber' +gem 'capybara-webkit' +gem 'rspec' diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index d700360..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,33 +0,0 @@ -GEM - remote: http://rubygems.org/ - specs: - abstract (1.0.0) - archive-tar-minitar (0.5.2) - erubis (2.6.6) - abstract (>= 1.0.0) - ffi (1.0.9) - i18n (0.5.0) - json (1.5.1) - mario (0.0.6) - net-scp (1.0.4) - net-ssh (>= 1.99.1) - net-ssh (2.1.4) - thor (0.14.6) - vagrant (0.7.5) - archive-tar-minitar (= 0.5.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - json (~> 1.5.1) - mario (~> 0.0.6) - net-scp (~> 1.0.4) - net-ssh (~> 2.1.0) - thor (~> 0.14.6) - virtualbox (~> 0.8.3) - virtualbox (0.8.6) - ffi (~> 1.0) - -PLATFORMS - ruby - -DEPENDENCIES - vagrant diff --git a/features/home_page.feature b/features/home_page.feature new file mode 100644 index 0000000..ff80bc0 --- /dev/null +++ b/features/home_page.feature @@ -0,0 +1,7 @@ +Feature: Home Page + Scenario: Load the home page + Given I have a running WordPress site + When I visit the home page + Then I should not see a WordPress installation page + And I should see a WordPress site + diff --git a/features/step_definitions/given/i_have_a_running_wordpress_site.rb b/features/step_definitions/given/i_have_a_running_wordpress_site.rb new file mode 100644 index 0000000..6636211 --- /dev/null +++ b/features/step_definitions/given/i_have_a_running_wordpress_site.rb @@ -0,0 +1,3 @@ +Given /^I have a running WordPress site$/ do + ensure_vagrant_running +end diff --git a/features/step_definitions/then/i_should_not_see_wordpress_installation.rb b/features/step_definitions/then/i_should_not_see_wordpress_installation.rb new file mode 100644 index 0000000..1f93661 --- /dev/null +++ b/features/step_definitions/then/i_should_not_see_wordpress_installation.rb @@ -0,0 +1,3 @@ +Then /^I should not see a WordPress installation page$/ do + page.should_not have_css('link[href*="install.css"]') +end diff --git a/features/step_definitions/then/i_should_see_a_wordpress_site.rb b/features/step_definitions/then/i_should_see_a_wordpress_site.rb new file mode 100644 index 0000000..e8ef327 --- /dev/null +++ b/features/step_definitions/then/i_should_see_a_wordpress_site.rb @@ -0,0 +1,3 @@ +Then /^I should see a WordPress site$/ do + page.should have_css('meta[content*="WordPress"]') +end diff --git a/features/step_definitions/when/i_visit.rb b/features/step_definitions/when/i_visit.rb new file mode 100644 index 0000000..6171dda --- /dev/null +++ b/features/step_definitions/when/i_visit.rb @@ -0,0 +1,3 @@ +When /^I visit the home page$/ do + visit '/' +end diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000..b0ebaa4 --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,19 @@ +require 'capybara/cucumber' + +Capybara.app_host = 'http://localhost:8080/' + +require 'capybara-webkit' + +Capybara.default_driver = :webkit + +def ensure_vagrant_running + require 'vagrant' + + vm = Vagrant::Environment.new.primary_vm + if !vm.created? + raise StandardError.new("VM not created! Run `bundle exec vagrant up`.") + end + + vm.start +end +