Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: convio/etapestry
base: 0c69e35ee6
...
head fork: convio/etapestry
compare: c26b9f03d1
  • 8 commits
  • 20 files changed
  • 0 commit comments
  • 1 contributor
View
1  .gitignore
@@ -2,6 +2,7 @@
*.rbc
.bundle
.config
+.idea
coverage
InstalledFiles
lib/bundler/man
View
1  Gemfile
@@ -15,5 +15,6 @@ gem 'logrotate'
gem 'bundler'
gem 'watir-webdriver', '0.6.1.1'
gem 'uuid'
+gem 'rubigen'
gem 'watir', '~>2.0.4.3', :platforms => :mingw
gem 'win32-api', :platforms => :mingw
View
6 Gemfile.lock
@@ -2,8 +2,7 @@ GEM
remote: http://gemcutter.org/
remote: http://gemserver.qa.convioanalyticstest.net:8808/
specs:
- activesupport (3.2.7)
- i18n (~> 0.6)
+ activesupport (3.1.4)
multi_json (~> 1.0)
addressable (2.3.2)
american_date (1.0.0)
@@ -44,6 +43,8 @@ GEM
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
+ rubigen (1.5.8)
+ activesupport (>= 2.3.5, < 3.2.0)
rubyzip (0.9.9)
selenium-webdriver (2.25.0)
childprocess (>= 0.2.5)
@@ -84,6 +85,7 @@ DEPENDENCIES
logrotate
rake
rspec
+ rubigen
uuid
watir (~> 2.0.4.3)
watir-webdriver (= 0.6.1.1)
View
2  features/account/add_account.feature
@@ -48,5 +48,7 @@ Feature: Account creation
| persona.short_salutation | short hi |
| persona.long_salutation | long hi |
Then I should see the [account] on the persona page
+ And the account header for [account] should contain the correct information
+
View
4 features/step_definitions/account_steps.rb
@@ -8,4 +8,8 @@
Then /^I should see the (\[[^\]]+\]) on the persona page/ do |model|
Persona.new(model).verify
+end
+
+Then /^the account header for (\[[^\]]+\]) should contain the correct information/ do |model|
+ AccountHeader.new(model).verify
end
View
58 generators/mvc/mvc_generator.rb
@@ -0,0 +1,58 @@
+require 'rubigen'
+require 'active_support/inflector'
+
+class MvcGenerator < RubiGen::Base
+ attr_reader :produc, :name
+
+ def initialize(runtime_args, runtime_options = {})
+ super
+ usage if args.empty?
+ @product = args.shift
+ @name = args.shift
+ @destination_root = File.expand_path(File.dirname(__FILE__) + '/../../')
+ extract_options
+ end
+
+ def workflow_directory
+ "lib/etapestry/workflows/#{@product}"
+ end
+
+ def manifest
+ record do |m|
+ create_directories(m)
+ m.template "model.rb.erb", File.join(workflow_directory, "#{@name}_model.rb")
+ m.template "view.rb.erb", File.join(workflow_directory,"#{@name}_view.rb")
+ m.template "controller.rb.erb", File.join(workflow_directory,"#{@name}_controller.rb")
+ end
+ end
+
+ def create_directories(m)
+ m.directory File.join('lib/etapestry/workflows',@product)
+ end
+
+ protected
+ def banner
+ <<-EOS
+USAGE: #{spec.name} path/for/your/test/mvc workflow_driectory name [options]
+ EOS
+ end
+
+ def add_options!(opts)
+ opts.separator ''
+ opts.separator 'Options:'
+ # For each option below, place the default
+ # at the top of the file next to "default_options"
+ # opts.on("-a", "--author=\"Your Name\"", String,
+ # "Some comment about this option",
+ # "Default: none") { |options[:author]| }
+ opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
+ end
+
+ def extract_options
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
+ # Templates can access these value via the attr_reader-generated methods, but not the
+ # raw instance variable value.
+ # @author = options[:author]
+ end
+
+end
View
7 generators/mvc/templates/controller.rb.erb
@@ -0,0 +1,7 @@
+module ETapestry
+ class <%= name.camelcase %> < BaseController
+ @model = <%= name.camelcase %>Model
+ @view = <%= name.camelcase %>View
+ end
+end
+
View
9 generators/mvc/templates/model.rb.erb
@@ -0,0 +1,9 @@
+module ETapestry
+ <%= name.camelcase %>Model = Watirmark::Model::Base.new(*<%= name.camelcase %>View.keywords) do
+ #search_term {name}
+ #
+ #default.name {"name_#{uuid}"}
+ #
+ #add_model SomeModelName.new
+ end
+end
View
17 generators/mvc/templates/view.rb.erb
@@ -0,0 +1,17 @@
+module ETapestry
+ class <%= name.camelcase %>View < BaseView
+ #keyword(:name) { browser.text_field(:id, 'name') }
+ #navigation_keyword(:save_button) { browser.button(:value, 'Save') }
+
+ class << self
+ def home(model)
+ end
+
+ def create(model)
+ end
+
+ def edit(model)
+ end
+ end
+ end
+end
View
0  lib/etapestry/base_controller.rb → lib/etapestry/controllers/base_controller.rb
File renamed without changes
View
12 lib/etapestry/controllers/search_controller.rb
@@ -0,0 +1,12 @@
+module ETapestry
+ class SearchController < BaseController
+
+ def current_record_visible?
+ raise "Method needs to be defined in the subclass and return a true/false value"
+ end
+
+ def populate_data
+ super unless current_record_visible?
+ end
+ end
+end
View
5 lib/etapestry/core_libraries.rb
@@ -1,7 +1,8 @@
require 'etapestry/extensions/webdriver_extensions'
require "watir-webdriver/extensions/alerts"
-require 'etapestry/base_view'
-require 'etapestry/base_controller'
+require 'etapestry/views/base_view'
+require 'etapestry/controllers/base_controller'
+require 'etapestry/controllers/search_controller'
Watirmark.loader do
base_directory File.dirname(__FILE__)
product 'ETapestry'
View
3  lib/etapestry/base_view.rb → lib/etapestry/views/base_view.rb
@@ -16,6 +16,9 @@ def content
def content_label(name)
content.td(:text, name).nextsibling
end
+
+ def home(model)
+ end
end
end
end
View
12 lib/etapestry/workflows/account/account_header_controller.rb
@@ -0,0 +1,12 @@
+module ETapestry
+ class AccountHeader < BaseController
+ @model = AccountHeaderModel
+ @view = AccountHeaderView
+ @search = AccountSearch
+
+ def verify_address
+ assert !!(@view.address.text =~ /#{@model.address}/)
+ end
+ end
+end
+
View
8 lib/etapestry/workflows/account/account_header_model.rb
@@ -0,0 +1,8 @@
+module ETapestry
+ AccountHeaderModel = Watirmark::Model::Base.new(*AccountHeaderView.keywords) do
+ default.name {parent.name}
+ default.address {parent.persona.address}
+ default.email {parent.persona.email}
+ default.website {parent.persona.web_page}
+ end
+end
View
21 lib/etapestry/workflows/account/account_header_view.rb
@@ -0,0 +1,21 @@
+module ETapestry
+ class AccountHeaderView < BaseView
+ keyword(:name) {header_section(2,1)}
+ keyword(:user_role) {header_section(0,2)}
+ keyword(:address) {header_section(3,1)}
+ keyword(:email) {header_section(3,1).link(:text, /@/)}
+ keyword(:website) {header_section(3,1).link(:text, /^((?!@).)*$/)}
+
+ class << self
+ def header
+ content.div(:id, 'followMeDiv1')
+ end
+
+ def header_section(row, col)
+ header.trs[row].tds[col]
+ end
+
+ alias :edit :home
+ end
+ end
+end
View
5 lib/etapestry/workflows/account/account_model.rb
@@ -1,5 +1,7 @@
#TODO: figure out way to not require this
require_relative 'persona_model'
+require_relative 'account_header_model'
+
module ETapestry
AccountModel = Watirmark::Model::Base.new(*AccountView.keywords) do
@@ -8,7 +10,8 @@ module ETapestry
default.name {"name_#{uuid}"}
default.sort_name {name}
- add_model AccountSearchModel.new
add_model PersonaModel.new
+ add_model AccountHeaderModel.new
+ add_model AccountSearchModel.new
end
end
View
8 lib/etapestry/workflows/account/account_search_controller.rb
@@ -1,5 +1,5 @@
module ETapestry
- class AccountSearch < BaseController
+ class AccountSearch < SearchController
@model = AccountSearchModel
@view = AccountSearchView
@@ -7,6 +7,12 @@ def search_for_value
@model.search_term
end
+ def current_record_visible?
+ AccountHeaderView.header.present? &&
+ AccountHeaderView.name.exists? &&
+ AccountHeaderView.name.text == @model.search_term
+ end
+
def submit
@view.find_button.click
@view.account_link(@model.search_term).click
View
2  lib/etapestry/workflows/account/persona_controller.rb
@@ -1,8 +1,8 @@
module ETapestry
class Persona < BaseController
@model = PersonaModel
- @search = AccountSearch
@view = PersonaView
+ @search = AccountSearch
def verify_persona_type
@model.persona_type.should == @view.persona_type.selected_options.first.text.delete('*').strip
View
9 script/generate.rb
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+require 'rubigen'
+require 'rubigen/scripts/generate'
+
+ARGV.shift if ['--help', '-h'].include?(ARGV[0])
+RubiGen::Base.use_component_sources! [:rubygems]
+RubiGen::Scripts::Generate.new.run(ARGV)

No commit comments for this range

Something went wrong with that request. Please try again.