Skip to content

Instantly share code, notes, and snippets.

View AndyObtiva's full-sized avatar

Andy Maleh AndyObtiva

View GitHub Profile
@AndyObtiva
AndyObtiva / ultra_light_wizard_spec_it.rb
Created July 30, 2017 00:15
Ultra Light Wizard Spec It Statement
it 'provides a rails generator when installed in a sample Rails app' do
result = system "cd #{app_rails_copy}
rails generate ultra_light_wizard:scaffold project steps:basic_info,detail,file_upload,preview attributes:name:string,description:text,start_date:datetime,delivery_date:datetime
rake db:migrate
rake"
expect(result).to be_truthy
end
@AndyObtiva
AndyObtiva / ultra_light_wizard_inside_spec.rb
Last active August 21, 2017 12:25
Ultra Light Wizard Inside Spec
require_relative '../rails_helper'
RSpec.feature "Ultra Light Wizard", type: :feature do
scenario 'can start wizard' do
create_project
verify_step(Project::BasicInfo)
end
scenario 'can input all 4 fields and go to step 2 in wizard' do
create_project
@AndyObtiva
AndyObtiva / ultra_light_wizard_inside_spec_output.txt
Created July 30, 2017 00:21
Ultra Light Wizard Inside Spec Output
$ rake
/Users/User/.rvm/rubies/ruby-2.4.1/bin/ruby -I/Users/User/.rvm/gems/ruby-2.4.1@ultra_light_wizard/gems/rspec-core-3.6.0/lib:/Users/User/.rvm/gems/ruby-2.4.1@ultra_light_wizard/gems/rspec-support-3.6.0/lib /Users/User/.rvm/gems/ruby-2.4.1@ultra_light_wizard/gems/rspec-core-3.6.0/exe/rspec spec/lib/ultra_light_wizard/ultra_light_wizard_spec.rb
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
generate scaffold
invoke active_record
create db/migrate/20170729234504_create_projects.rb
create app/models/project.rb
invoke test_unit
create test/models/project_test.rb
@AndyObtiva
AndyObtiva / hello_computed.rb
Created November 27, 2019 01:28
Glimmer Computed Value Data Binding Sample
class HelloComputed
extend Glimmer
include_package 'org.eclipse.swt'
include_package 'org.eclipse.swt.widgets'
include_package 'org.eclipse.swt.layout'
contact = Contact.new(
first_name: "Barry",
last_name: "McKibbin",
# Example (nesting):
require 'nested_inherited_jruby_include_package'
class OuterClass
include_package java.util
class InnerClass
def initialize
p Arrays.asList(1, 2, 3)
end
# You may clone glimmer repo, follow setup instructions, and run bin/girb then copy/paste code below
class RedLabel
include Glimmer::UI::CustomWidget
before_body {
@color = color(:red)
}
after_body {
body_root.on_mouse_up {
@AndyObtiva
AndyObtiva / hello_video_observers.rb
Created April 16, 2020 21:16
Glimmer Video Widget Observers
# ...
def display_video_status(video, status)
message_box = MessageBox.new(video.swt_widget.getShell)
message_box.setText(status)
message = "Video Position: #{video.position} seconds\n"
message += "Video Duration: #{video.duration} seconds"
message_box.setMessage(message)
message_box.open
end
shell {
menu_bar {
menu {
text "&File"
menu_item {
text "E&xit"
}
menu_item(0) {
text "&New"
}
shell {
label {
text 'Right-Click Me'
menu {
menu {
text '&History'
menu {
text "&Recent"
menu_item {
text "File 1"
shell(:no_resize, app_name: 'Glimmer Demo', app_version: '1.0') {
text "Glimmer"
label {
text "Hello, World!"
}
}.open