Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

WOOT! integration testing start, updated selenium driver, updated the…

… migration to remove email, changed the port in the manifest
  • Loading branch information...
commit 229d08a0c47833b5d195b91fc558af0367808b8a 1 parent 91cab26
@zhitomirskiyi zhitomirskiyi authored
View
2  .rvmrc
@@ -1 +1 @@
-rvm --create use 1.9.2@epic_parties
+rvm --create use 1.9.2@diaspora_client_sample
View
14 Gemfile
@@ -1,3 +1,4 @@
+
source 'http://rubygems.org'
gem 'rails', '3.0.9'
@@ -25,18 +26,19 @@ gem 'nokogiri'
# gem 'aws-s3', :require => 'aws/s3'
# Diaspora
-gem 'diaspora-client', #:git => 'git://github.com/diaspora/diaspora-client.git'
- :path => "~/workspace/diaspora-client"
+gem 'diaspora-client', :git => 'git://github.com/diaspora/diaspora-client.git'
+ #:path => "~/workspace/diaspora-client"
group :test do
gem 'capybara', '~> 0.3.9'
+ gem 'selenium-webdriver', '>= 2.5.0'
gem 'rest-client'
gem 'database_cleaner', '0.6.0'
gem 'cucumber-rails', '0.3.2'
- gem 'factory_girl_rails', :require => false
+ gem 'factory_girl_rails'
gem 'rspec-rails', '~> 2.4'
gem 'shoulda-matchers'
end
@@ -44,9 +46,9 @@ end
group :development, :test do
gem "nifty-generators"
gem 'sqlite3'
- gem 'ruby-debug-base19', '0.11.23' if RUBY_VERSION.include? '1.9.1'
- gem 'ruby-debug19' if RUBY_VERSION.include? '1.9'
- gem 'ruby-debug' if defined?(Rubinius).nil? && RUBY_VERSION.include?('1.8')
+ gem 'ruby-debug19', :platform => :mri_19
+ gem 'ruby-debug', :platform => :mri_18
end
+
View
86 Gemfile.lock
@@ -1,11 +1,15 @@
-PATH
- remote: ~/workspace/diaspora-client
+GIT
+ remote: git://github.com/diaspora/diaspora-client.git
+ revision: a1b6c480fa3caa8ce24912dda471579de842aa51
specs:
- diaspora-client (0.1.0)
+ diaspora-client (0.1.1)
activerecord
+ em-http-request
+ em-synchrony
faraday
jwt (>= 0.1.3)
oauth2 (= 0.4.1)
+ rack-fiber_pool
sinatra
GEM
@@ -39,6 +43,7 @@ GEM
activesupport (= 3.0.9)
activesupport (3.0.9)
addressable (2.2.6)
+ archive-tar-minitar (0.5.2)
arel (2.0.10)
bcrypt-ruby (2.1.4)
builder (2.1.2)
@@ -49,15 +54,15 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3)
- childprocess (0.1.9)
+ childprocess (0.2.2)
ffi (~> 1.0.6)
columnize (0.3.4)
- cucumber (1.0.1)
+ cucumber (1.0.6)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
- gherkin (~> 2.4.5)
+ gherkin (~> 2.4.18)
json (>= 1.4.6)
- term-ansicolor (>= 1.0.5)
+ term-ansicolor (>= 1.0.6)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.15)
@@ -66,36 +71,49 @@ GEM
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
- diff-lcs (1.1.2)
+ diff-lcs (1.1.3)
+ em-http-request (1.0.0)
+ addressable (>= 2.2.3)
+ em-socksify
+ eventmachine (>= 1.0.0.beta.3)
+ http_parser.rb (>= 0.5.2)
+ em-socksify (0.1.0)
+ eventmachine
+ em-synchrony (1.0.0)
+ eventmachine (>= 1.0.0.beta.1)
erubis (2.6.6)
abstract (>= 1.0.0)
- factory_girl (1.3.3)
- factory_girl_rails (1.0.1)
- factory_girl (~> 1.3)
+ eventmachine (1.0.0.beta.4)
+ factory_girl (2.1.0)
+ factory_girl_rails (1.2.0)
+ factory_girl (~> 2.1.0)
railties (>= 3.0.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
ffi (1.0.9)
- gherkin (2.4.5)
+ gherkin (2.4.21)
json (>= 1.4.6)
- haml (3.1.2)
+ haml (3.1.3)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
+ http_parser.rb (0.5.2)
i18n (0.5.0)
- jquery-rails (1.0.12)
+ jquery-rails (1.0.14)
railties (~> 3.0)
thor (~> 0.14)
- json (1.5.3)
- json_pure (1.5.3)
+ json (1.6.1)
+ json_pure (1.6.1)
jwt (0.1.3)
json (>= 1.2.4)
linecache (0.46)
rbx-require-relative (> 0.0.4)
+ linecache19 (0.5.12)
+ ruby_core_source (>= 0.1.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@@ -110,8 +128,9 @@ GEM
faraday (~> 0.6.1)
multi_json (>= 0.0.5)
orm_adapter (0.0.5)
- polyglot (0.3.1)
- rack (1.2.3)
+ polyglot (0.3.2)
+ rack (1.2.4)
+ rack-fiber_pool (0.9.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
@@ -132,8 +151,8 @@ GEM
thor (~> 0.14.4)
rake (0.9.2)
rbx-require-relative (0.0.5)
- rdoc (3.8)
- rest-client (1.6.3)
+ rdoc (3.9.4)
+ rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.6.0)
rspec-core (~> 2.6.0)
@@ -153,24 +172,35 @@ GEM
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
+ ruby-debug-base19 (0.11.25)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.4)
- selenium-webdriver (2.0.1)
- childprocess (>= 0.1.9)
+ selenium-webdriver (2.5.0)
+ childprocess (>= 0.2.1)
ffi (>= 1.0.7)
json_pure
rubyzip
- shoulda-matchers (1.0.0.beta2)
+ shoulda-matchers (1.0.0.beta3)
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
- sqlite3 (1.3.3)
- term-ansicolor (1.0.5)
+ sqlite3 (1.3.4)
+ term-ansicolor (1.0.6)
thor (0.14.6)
tilt (1.3.3)
- treetop (1.4.9)
+ treetop (1.4.10)
+ polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.29)
- warden (1.0.4)
+ warden (1.0.5)
rack (>= 1.0)
PLATFORMS
@@ -191,5 +221,7 @@ DEPENDENCIES
rest-client
rspec-rails (~> 2.4)
ruby-debug
+ ruby-debug19
+ selenium-webdriver (>= 2.5.0)
shoulda-matchers
sqlite3
View
7 README.md
@@ -6,4 +6,11 @@
[Diaspora](https://github.com/diaspora/diaspora-client)
+Note:
+The manifest(/public/manifest.json) is bundled for the url for use with
+cucumber (i.e. port 9887). If you would like to use it on a different
+port change the config (/config/diaspora_client.rb) and repackage (run:
+rake diaspora:package_manifest).
+
+
See LICENSE.txt for licensing details.
View
2  app/models/user.rb
@@ -1,5 +1,5 @@
class User < ActiveRecord::Base
- devise :database_authenticatable, :registerable, :rememberable, :trackable
+ devise :registerable, :rememberable, :trackable
validates_length_of :diaspora_id, :maximum => 127
View
6 config/initializers/diaspora_client.rb
@@ -1,9 +1,9 @@
DiasporaClient.config do |d|
d.test_mode = true
- d.application_base_url = "http://localhost:4000/" #"https://www.awesomeapp.com:443/"
+ d.application_base_url = "http://localhost:9887/" #"https://www.awesomeapp.com:443/"
- d.manifest_field(:name, "AwesomeApp.")
- d.manifest_field(:description, "desc")
+ d.manifest_field(:name, "SampleApp")
+ d.manifest_field(:description, "This is a description of this Salmple App")
d.manifest_field(:icon_url, "/images/icon48.png")
d.manifest_field(:permissions_overview, "SampleApp wants to post back to your Diaspora account.")
View
5 db/migrate/20110713070511_devise_create_users.rb
@@ -1,10 +1,10 @@
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
- t.database_authenticatable :null => false
t.rememberable
t.trackable
+ #t.database_authenticatable :null => false
# t.encryptable
# t.confirmable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
@@ -14,8 +14,9 @@ def self.up
t.timestamps
end
- add_index :users, :email, :unique => true
add_index :users, :diaspora_id, :unique => true
+
+ #add_index :users, :email, :unique => true
# add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
View
25 features/logs_in_and_out.feature
@@ -0,0 +1,25 @@
+@javascript @no-ci
+Feature: oauth
+ Exchanging oauth credentials
+
+ Background:
+ Given Diaspora has been killed
+ And Diaspora is running
+ And I go to the home page
+
+ Scenario: Login/Authorize using Diaspora ID
+ When I fill in "diaspora_id" with "bob@localhost:3000"
+ And I press "connect"
+
+ Then I should be on "/users/sign_in" on Diaspora
+ And I fill in "Username" with "bob"
+ And I fill in "Password" with "evankorth"
+ And I press "Sign in"
+
+ Then I should see "SampleApp"
+ And I should see "SampleApp wants to post back to your Diaspora account."
+ When I press "Authorize"
+
+ Then I should see "success"
+
+
View
9 features/step_definitions/debug_steps.rb
@@ -0,0 +1,9 @@
+When 'I debug' do
+ puts "I SHOULD BE DEBUGGING NOW!!!"
+ debugger
+ true
+end
+
+When /^I wait for (\d+) seconds?$/ do |seconds|
+ sleep seconds.to_i
+end
View
87 features/step_definitions/oauth_steps.rb
@@ -0,0 +1,87 @@
+Given /^Diaspora is running$/ do
+ Diaspora.run unless Diaspora.running?
+end
+
+Given /^Diaspora has been killed$/ do
+ Diaspora.kill
+end
+
+And /^there is only one Diaspora$/ do
+ OAuth2::Provider.client_class.where(:name => "Diaspora").count.should == 1
+end
+
+And /^I remove all traces of Diaspora on the pod$/ do
+ OAuth2::Provider.client_class.destroy_all
+end
+
+When /^I visit "([^"]+)" on Diaspora$/ do |path|
+ former_host = Capybara.app_host
+ Capybara.app_host = "localhost:#{Diaspora::PORT}"
+ visit(path)
+ Capybara.app_host = former_host
+end
+
+class Diaspora
+ PORT = 3000
+
+ def self.run
+ @pid = fork do
+ command = "/bin/bash -l -c '" +
+ " unset BUNDLE_GEMFILE" +
+ " && unset RAILS_ENV" +
+ " && unset RUBYOPT" +
+ " && unset BUNDLE_BIN_PATH" +
+ " && cd #{Rails.root}/../diaspora/ " +
+
+ #" && rvm use ree-1.8.7-2011.03@diaspora" +
+ " && bundle install" +
+ " && bundle exec rake db:reset" +
+ " && bundle exec #{run_command} #{nullify}'"
+
+ Process.exec command
+ end
+
+ at_exit do
+ Diaspora.kill
+ end
+
+ while(!running?) do
+ sleep(1)
+ end
+ end
+
+ def self.nullify
+ #"2> /dev/null > /dev/null"
+ end
+
+ def self.kill
+ pid = self.get_pid
+ `kill -9 #{pid}` if pid.present?
+ end
+
+ def self.running?
+ begin
+ begin
+ RestClient.get("localhost:#{PORT}/running")
+ rescue RestClient::ResourceNotFound
+ end
+ true
+ rescue Errno::ECONNREFUSED, Errno::ECONNRESET
+ false
+ end
+ end
+
+ def self.run_command
+ "thin start -p #{PORT}"
+ end
+
+ def self.get_pid
+ processes = `ps ax -o pid,command | grep "#{run_command}"`.split("\n")
+ processes = processes.select{|p| !p.include?("grep") }
+ if processes.any?
+ processes.first.split(" ").first
+ else
+ nil
+ end
+ end
+end
View
221 features/step_definitions/web_steps.rb
@@ -0,0 +1,221 @@
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
+# It is recommended to regenerate this file in the future when you upgrade to a
+# newer version of cucumber-rails. Consider adding your own code to a new file
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
+# files.
+
+
+require 'uri'
+require 'cgi'
+require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
+
+module WithinHelpers
+ def with_scope(locator)
+ locator ? within(locator) { yield } : yield
+ end
+end
+World(WithinHelpers)
+
+Given /^(?:|I )am on (.+)$/ do |page_name|
+ visit path_to(page_name)
+end
+
+When /^(?:|I )go to (.+)$/ do |page_name|
+ visit path_to(page_name)
+end
+
+When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
+ with_scope(selector) do
+ silence_warnings {
+ sleep 1 if button == "Share"
+ click_button(button) } # ruby 1.9 produces a warning about UTF8 from rack-util
+ end
+end
+
+When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
+ with_scope(selector) do
+ click_link(link)
+ end
+end
+
+When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
+ with_scope(selector) do
+ fill_in(field, :with => value)
+ end
+end
+
+When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
+ with_scope(selector) do
+ fill_in(field, :with => value)
+ end
+end
+
+# Use this to fill in an entire form with data from a table. Example:
+#
+# When I fill in the following:
+# | Account Number | 5002 |
+# | Expiry date | 2009-11-01 |
+# | Note | Nice guy |
+# | Wants Email? | |
+#
+# TODO: Add support for checkbox, select og option
+# based on naming conventions.
+#
+When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
+ with_scope(selector) do
+ fields.rows_hash.each do |name, value|
+ When %{I fill in "#{name}" with "#{value}"}
+ end
+ end
+end
+
+When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
+ with_scope(selector) do
+ select(value, :from => field)
+ end
+end
+
+When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
+ with_scope(selector) do
+ check(field)
+ end
+end
+
+When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
+ with_scope(selector) do
+ uncheck(field)
+ end
+end
+
+When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
+ with_scope(selector) do
+ choose(field)
+ end
+end
+
+When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
+ with_scope(selector) do
+ attach_file(field, path)
+ end
+end
+
+Then /^(?:|I )should see JSON:$/ do |expected_json|
+ require 'json'
+ expected = JSON.pretty_generate(JSON.parse(expected_json))
+ actual = JSON.pretty_generate(JSON.parse(response.body))
+ expected.should == actual
+end
+
+Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
+ with_scope(selector) do
+ if page.respond_to? :should
+ page.should have_content(text)
+ else
+ assert page.has_content?(text)
+ end
+ end
+end
+
+Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
+ regexp = Regexp.new(regexp)
+ with_scope(selector) do
+ if page.respond_to? :should
+ page.should have_xpath('//*', :text => regexp)
+ else
+ assert page.has_xpath?('//*', :text => regexp)
+ end
+ end
+end
+
+Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
+ with_scope(selector) do
+ if page.respond_to? :should
+ page.should have_no_content(text)
+ else
+ assert page.has_no_content?(text)
+ end
+ end
+end
+
+Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
+ regexp = Regexp.new(regexp)
+ with_scope(selector) do
+ if page.respond_to? :should
+ page.should have_no_xpath('//*', :text => regexp)
+ else
+ assert page.has_no_xpath?('//*', :text => regexp)
+ end
+ end
+end
+
+Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
+ with_scope(selector) do
+ field = find_field(field)
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
+ if field_value.respond_to? :should
+ field_value.should =~ /#{value}/
+ else
+ assert_match(/#{value}/, field_value)
+ end
+ end
+end
+
+Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
+ with_scope(selector) do
+ field = find_field(field)
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
+ if field_value.respond_to? :should_not
+ field_value.should_not =~ /#{value}/
+ else
+ assert_no_match(/#{value}/, field_value)
+ end
+ end
+end
+
+Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
+ with_scope(selector) do
+ field_checked = find_field(label)['checked']
+ if field_checked.respond_to? :should
+ field_checked.should be_true
+ else
+ assert field_checked
+ end
+ end
+end
+
+Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
+ with_scope(selector) do
+ field_checked = find_field(label)['checked']
+ if field_checked.respond_to? :should
+ field_checked.should be_false
+ else
+ assert !field_checked
+ end
+ end
+end
+
+Then /^(?:|I )should be on (.+)$/ do |page_name|
+ current_path = URI.parse(current_url).path
+ if current_path.respond_to? :should
+ current_path.should == path_to(page_name)
+ else
+ assert_equal path_to(page_name), current_path
+ end
+end
+
+Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
+ query = URI.parse(current_url).query
+ actual_params = query ? CGI.parse(query) : {}
+ expected_params = {}
+ expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
+
+ if actual_params.respond_to? :should
+ actual_params.should == expected_params
+ else
+ assert_equal expected_params, actual_params
+ end
+end
+
+Then /^show me the page$/ do
+ save_and_open_page
+end
View
87 features/support/env.rb
@@ -0,0 +1,87 @@
+# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
+# It is recommended to regenerate this file in the future when you upgrade to a
+# newer version of cucumber-rails. Consider adding your own code to a new file
+# instead of editing this one. Cucumber will automatically load all features/**/*.rb
+# files.
+
+ENV["RAILS_ENV"] ||= "test"
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') unless defined?(Rails)
+
+require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
+require 'cucumber/rails/rspec'
+require 'cucumber/rails/world'
+require 'cucumber/web/tableish'
+
+require 'capybara/rails'
+require 'capybara/cucumber'
+require 'capybara/session'
+require 'cucumber/rails/capybara_javascript_emulation' # Lets you click links with onclick javascript handlers without using @culerity or @javascript
+# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
+# order to ease the transition to Capybara we set the default here. If you'd
+# prefer to use XPath just remove this line and adjust any selectors in your
+# steps to use the XPath syntax.
+Capybara.default_selector = :css
+
+# We have a ridiculously high wait time to account for build machines of various beefiness.
+Capybara.default_wait_time = 5
+
+# If you set this to false, any error raised from within your app will bubble
+# up to your step definition and out to cucumber unless you catch it somewhere
+# on the way. You can make Rails rescue errors and render error pages on a
+# per-scenario basis by tagging a scenario or feature with the @allow-rescue tag.
+#
+# If you set this to true, Rails will rescue all errors and render error
+# pages, more or less in the same way your application would behave in the
+# default production environment. It's not recommended to do this for all
+# of your scenarios, as this makes it hard to discover errors in your application.
+ActionController::Base.allow_rescue = true#false
+
+require 'database_cleaner'
+require 'database_cleaner/cucumber'
+DatabaseCleaner.strategy = :truncation
+DatabaseCleaner.orm = "active_record"
+Cucumber::Rails::World.use_transactional_fixtures = false
+
+#require File.join(File.dirname(__FILE__), "database_cleaner_patches")
+#require File.join(File.dirname(__FILE__), "poor_mans_webmock")
+
+Before do
+ DatabaseCleaner.clean
+ Devise.mailer.deliveries = []
+end
+
+After do
+ if Capybara.current_session.driver.respond_to?(:browser)
+ Capybara.current_session.driver.browser.manage.delete_all_cookies
+ end
+end
+
+
+Before('@localserver') do
+ TestServerFixture.start_if_needed
+ CapybaraSettings.instance.save
+ Capybara.current_driver = :selenium
+ Capybara.run_server = false
+end
+
+After('@localserver') do
+ CapybaraSettings.instance.restore
+end
+
+#class Capybara::Driver::Selenium < Capybara::Driver::Base
+# class Node < Capybara::Node
+# def [](name)
+# node.attribute(name.to_s)
+# rescue Selenium::WebDriver::Error::WebDriverError
+# nil
+# end
+#
+# def select(option)
+# option_node = node.find_element(:xpath, ".//option[normalize-space(text())=#{Capybara::XPath.escape(option)}]") || node.find_element(:xpath, ".//option[contains(.,#{Capybara::XPath.escape(option)})]")
+# option_node.click
+# rescue
+# options = node.find_elements(:xpath, "//option").map { |o| "'#{o.text}'" }.join(', ')
+# raise Capybara::OptionNotFound, "No such option '#{option}' in this select box. Available options: #{options}"
+# end
+# end
+#end
View
18 features/support/paths.rb
@@ -0,0 +1,18 @@
+module NavigationHelpers
+ def path_to(page_name)
+ case page_name
+ when /^the home(?: )?page$/
+ root_path
+ when /^its ([\w ]+) page$/
+ send("#{$1.gsub(/\W+/, '_')}_path", @it)
+ when /^the ([\w ]+) page$/
+ send("#{$1.gsub(/\W+/, '_')}_path")
+ when /^"(\/.*)"/
+ $1
+ else
+ raise "Can't find mapping from \"#{page_name}\" to a path."
+ end
+ end
+end
+
+World(NavigationHelpers)
View
73 features/support/server.rb
@@ -0,0 +1,73 @@
+
+ENV["RAILS_ENV"] ||= "test"
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment') unless defined?(Rails)
+
+require 'timeout'
+require 'socket'
+require 'singleton'
+
+require 'capybara/rails'
+require 'capybara/cucumber'
+require 'capybara/session'
+
+class TestServerFixture
+# simple interface to script/server
+
+ def self.is_port_open(host, port, tries)
+ for i in (1..tries)
+ begin
+ Timeout::timeout(2) do
+ begin
+ s = TCPSocket.new(host, port)
+ s.close
+ return true
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
+ sleep( 2)
+ end
+ end
+ rescue Timeout::Error
+ return false
+ end
+ end
+ return false
+ end
+
+ def self.start_if_needed
+ unless TestServerFixture.is_port_open( "localhost", 3000, 2)
+ system( "script/server -d")
+ if TestServerFixture.is_port_open( "localhost", 3000, 30)
+ puts "script/server started"
+ else
+ puts "Error: can't start script/server"
+ end
+ end
+ end
+
+end
+
+class CapybaraSettings
+# simple save/restore for Capybara
+
+ include Singleton
+
+ def save
+ begin
+ @run_server = Capybara.run_server
+ @driver = Capybara.current_driver
+ @host = Capybara.app_host
+ rescue => e
+ puts "Saving exception: " + e.inspect
+ end
+ end
+
+ def restore
+ begin
+ Capybara.current_driver = @driver
+ Capybara.app_host = @host
+ Capybara.run_server = @run_server
+ rescue => e
+ puts "Restore exception: " + e.inspect
+ end
+ end
+
+end
View
2  public/manifest.json
@@ -1 +1 @@
-{"jwt":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzUxMiJ9.eyJuYW1lIjoiQXdlc29tZUFwcC4iLCJwZXJtaXNzaW9uc19vdm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b2NhbGhvc3Q6OTg4Ny8ifQ.IlieXG4sMXCPC6AZL-xJrimxFO5a0fjBnDZs7LGjKAqxwFsltowOt8Z19sR4OzQtIuBP6eWLmYFYZ4p2dXgq3C1gyy_lnxkm77cxf_qLFeYcaDkg2fDDThz3l6ndzAFdgmbh7OW26e4GnerNlgY82ujnCSsc50P5xmJW7kHNjkX6e1yJqLDAhAV3ULCO9BeEdGEwh0kZzMjfRGiTe6RmIuTx9ONoP_79O9NgPSscwWXSPpezMQE1swy_9-kt16yiO8DXSYiKV4suya4DM82qdwfZinG0hoeyTd3x9IGnBX6QUr4Ms3AV7U-X_LfVEXr-HjZvg4PrHcK56ZrosS6nZQ"}
Please sign in to comment.
Something went wrong with that request. Please try again.