How to use configure method of Project.Cucumber Package

Best Rr_ruby code snippet using Project.Cucumber.configure

ruby_app.rb

Source:ruby_app.rb Github

copy

Full Screen

...27 class_option :timecop, :type => :boolean, :desc => "Use timecop gem"28 class_option :readme, :type => :string, :desc => "README markup language to be used"29 class_option :require_me, :type => :boolean, :desc => "Use require-me gem for require DSL" 30 31 class_option :bundler, :type => :boolean, :desc => "Create a Gemfile and configure project to use Bundler"32 class_option :install_gems, :type => :boolean, :desc => "Install all gems as required by project configuration"33 attr_accessor :project_options34 def self.source_root35 # template_path(__FILE__)36 File.join(File.dirname(__FILE__), '..', 'templates') 37 end38 def load_local_settings39 local_settings_file = File.join(ENV['HOME'], '.rubyapp')40 if File.exist? local_settings_file41 str = File.open(local_settings_file).read42 arr = str.split(/\n|,|:/).map{|s| s.strip}.map do |n| 43 case n44 when "true"45 true46 when "false" 47 false48 else 49 n50 end51 end52 local_settings = Hash[*arr] 53 @project_options = local_settings.merge(options)54 end55 end56 def default_settings57 @project_options ||= options.dup 58 [:rspec2, :cucumber, :license, :autotest, :bundler].each{|key| project_options[key] ||= true} 59 project_options[:mock_lib] ||= 'mocha' 60 project_options[:readme] ||= 'markdown' 61 end62 def create_root 63 self.destination_root = File.expand_path(app_name, destination_root) 64 empty_directory '.'65 FileUtils.cd(destination_root)66 end67 def install_gems 68 return nil if !project_options[:install_gems] 69 gems = []70 gems << "heckle" if project_options[:heckle]71 gems << "rcov" if project_options[:rcov]72 gems << "fakefs" if project_options[:fakefs]73 gems << "cucumber" if project_options[:cucumber] 74 gems << "ZenTest autotest-growl autotest-fsevent" if project_options[:autotest] 75 gems << "#{project_options[:mock_lib]}"76 gems << "require-me" if project_options[:require_me]77 gems << "bundler" if project_options[:bundler] 78 gems << "shoulda" if project_options[:shoulda] 79 gems << "test-unit" if project_options[:test_unit] 80 gems << "rake" if project_options[:rake] 81 gems << "jeweler" if project_options[:jeweler]82 gems << "timecop" if project_options[:timecop] 83 84 gems << "#{project_options[:factory_lib]}"85 run "gem install rspec --pre" if project_options[:rspec]86 run "gem install #{gems.join(' ')}" 87 end88 def main_runner89 say "rubyapp v.0.1.1" 90 if project_options[:jeweler]91 run "jeweler #{appname}" 92 else93 create_app94 end95 create_gemfile if !skip? :bundler, 'Use Bundler?'96 create_binaries if !skip? :binaries, 'Create binaries?'97 configure_cucumber if !skip? :cucumber, 'Use Cucumber?'98 configure_rspec2 if project_options[:rspec2]99 configure_autotest if !skip? :autotest, 'Use autotest?'100 configure_shoulda if project_options[:shoulda] 101 configure_test_unit if project_options[:test_unit]102 create_gitignore103 create_readme104 create_signatures if project_options[:signatures] 105 copy_licence if !skip? :license, 'Use MIT license?'106 autotest_feature_notice if project_options[:cucumber] 107 end108 protected109 def create_app110 create_lib111 end112 def create_lib113 empty_directory 'lib'114 inside 'lib' do 115 empty_directory "#{app_name}"116 template 'app_name.rb.erb', "#{app_name}/#{app_name}.rb"117 template 'app_entrypoint.erb', "#{app_name}.rb"118 end119 end120 def create_gemfile121 return nil if !122 template 'Gemfile'123 end 124 125 def create_binaries 126 empty_directory 'bin'127 inside "bin" do 128 template 'binary', "#{app_name}"129 template 'binary.bat', "#{app_name}.bat" 130 end131 end132 def configure_cucumber 133 empty_directory 'features' 134 inside 'features' do135 template 'app_name.feature.erb', "#{app_name}.feature"136 empty_directory 'step_definitions'137 inside 'step_definitions' do138 template 'app_name_steps.erb', "#{app_name}_steps.rb" 139 end140 empty_directory 'support'141 inside 'support' do 142 template 'env.rb.erb', 'env.rb'143 end144 end145 end146 147 def configure_rspec2 148 empty_directory 'spec' 149 create_file 'spec/rspec.options', '.rspec'150 directory 'autotest'151 inside 'spec' do 152 empty_directory "#{app_name}"153 template 'spec_helper.rb.erb', "spec_helper.rb"154 template 'app_name/sample_spec.rb.erb', "#{app_name}/#{app_name}_spec.rb"155 156 configure_factory_lib 'spec'157 end158 end159 def configure_autotest 160 create_file 'autotest.options', '.autotest' 161 end162 163 def configure_shoulda164 empty_directory 'shoulda' 165 inside 'shoulda' do 166 template 'test_app_name.rb.erb', "test_#{app_name}.rb"167 end168 end169 def configure_test_unit170 empty_directory 'test' 171 inside 'test' do 172 template 'test_app_name.rb.erb', "test_#{app_name}.rb"173 174 configure_factory_lib 'test' 175 end 176 end177 def configure_factory_lib(test_dir)178 # factory lib setup179 case project_options[:factory_lib]180 when 'factory_girl'181 empty_directory 'factories'182 when 'machinist'183 copy_file 'machinist/blueprints.rb', "#{test_dir}/blueprints.rb"184 when 'object_daddy'185 copy_file 'object_daddy/model_exemplar.rb', "#{test_dir}/exemplars/model_exemplar.rb"186 when 'blueprints'187 empty_directory 'blueprint'188 end 189 end190 191 def create_gitignore...

Full Screen

Full Screen

application.thor

Source:application.thor Github

copy

Full Screen

...23 class_option :fakefs, :type => :boolean, :desc => "Use FakeFS to fake the File system"24 class_option :readme, :type => :string, :desc => "README markup language to be used"25 class_option :require_me, :type => :boolean, :desc => "Use require-me gem for require DSL" 26 27 class_option :bundler, :type => :boolean, :desc => "Create a Gemfile and configure project to use Bundler"28 class_option :install_gems, :type => :boolean, :desc => "Install all gems as required by project configuration"29 attr_accessor :project_options30 def self.source_root31 # template_path(__FILE__)32 File.join(File.dirname(__FILE__), '..', 'templates') 33 end34 def load_local_settings35 local_settings_file = File.join(ENV['HOME'], '.rubyapp')36 if File.exist? local_settings_file37 str = File.open(local_settings_file).read38 arr = str.split(/\n|,|:/).map{|s| s.strip}.map do |n| 39 case n40 when "true"41 true42 when "false" 43 false44 else 45 n46 end47 end48 local_settings = Hash[*arr] 49 @project_options = local_settings.merge(options)50 end51 end52 def default_settings53 @project_options ||= options.dup 54 [:rspec2, :cucumber, :license, :autotest, :bundler].each{|key| project_options[key] ||= true} 55 project_options[:mock_lib] ||= 'mocha' 56 project_options[:readme] ||= 'markdown' 57 end58 def create_root 59 self.destination_root = File.expand_path(app_name, destination_root) 60 empty_directory '.'61 FileUtils.cd(destination_root)62 end63 def install_gems 64 return nil if !project_options[:install_gems] 65 gems = []66 gems << "heckle" if project_options[:heckle]67 gems << "rcov" if project_options[:rcov]68 gems << "fakefs" if project_options[:fakefs]69 gems << "cucumber" if project_options[:cucumber] 70 gems << "ZenTest autotest-growl autotest-fsevent" if project_options[:autotest] 71 gems << "#{project_options[:mock_lib]}"72 gems << "require-me" if project_options[:require_me]73 gems << "bundler" if project_options[:bundler] 74 gems << "shoulda" if project_options[:shoulda] 75 gems << "test-unit" if project_options[:test_unit] 76 gems << "rake" if project_options[:rake] 77 gems << "jeweler" if project_options[:jeweler] 78 run "gem install rspec --pre" if project_options[:rspec]79 run "gem install #{gems.join(' ')}" 80 end81 def main_runner82 say "rubyapp v.0.1.1" 83 if project_options[:jeweler]84 run "jeweler #{appname}" 85 else86 create_app87 end88 create_gemfile if !skip? :bundler, 'Use Bundler?'89 create_binaries if !skip? :binaries, 'Create binaries?'90 configure_cucumber if !skip? :cucumber, 'Use Cucumber?'91 configure_rspec2 if project_options[:rspec2]92 configure_autotest if !skip? :autotest, 'Use autotest?'93 configure_shoulda if project_options[:shoulda] 94 configure_test_unit if project_options[:test_unit] 95 create_gitignore96 create_readme97 create_signatures if project_options[:signatures] 98 copy_licence if !skip? :license, 'Use MIT license?'99 autotest_feature_notice if project_options[:cucumber] 100 end101 protected102 def create_app103 create_lib104 end105 def create_lib106 empty_directory 'lib'107 inside 'lib' do 108 empty_directory "#{app_name}"109 template 'app_name.rb.erb', "#{app_name}/#{app_name}.rb"110 template 'app_entrypoint.erb', "#{app_name}.rb"111 end112 end113 def create_gemfile114 return nil if !115 template 'Gemfile'116 end 117 118 def create_binaries 119 empty_directory 'bin'120 inside "bin" do 121 template 'binary', "#{app_name}"122 template 'binary.bat', "#{app_name}.bat" 123 end124 end125 def configure_cucumber 126 empty_directory 'features' 127 inside 'features' do128 template 'app_name.feature.erb', "#{app_name}.feature"129 empty_directory 'step_definitions'130 inside 'step_definitions' do131 template 'app_name_steps.erb', "#{app_name}_steps.rb" 132 end133 empty_directory 'support'134 inside 'support' do 135 template 'env.rb.erb', 'env.rb'136 end137 end138 end139 140 def configure_rspec2 141 empty_directory 'spec' 142 create_file 'spec/rspec.options', '.rspec'143 directory 'autotest'144 inside 'spec' do 145 empty_directory "#{app_name}"146 template 'spec_helper.rb.erb', "spec_helper.rb"147 template 'app_name/sample_spec.rb.erb', "#{app_name}/#{app_name}_spec.rb"148 end149 end150 def configure_autotest 151 create_file 'autotest.options', '.autotest' 152 end153 154 def configure_shoulda155 empty_directory 'shoulda' 156 inside 'shoulda' do 157 template 'test_app_name.rb.erb', "test_#{app_name}.rb"158 end159 end160 161 def configure_test_unit162 empty_directory 'test' 163 inside 'test' do 164 template 'test_app_name.rb.erb', "test_#{app_name}.rb"165 end 166 end167 168 def create_gitignore169 template 'gitignore', '.gitignore'170 end 171 def create_readme 172 case options[:readme]173 when 'rdoc'174 template 'readme/README.rdoc', 'README.rdoc'175 else...

Full Screen

Full Screen

rspec_2_rails_4_spec.rb

Source:rspec_2_rails_4_spec.rb Github

copy

Full Screen

1require File.expand_path('../../spec_helper', __FILE__)2describe 'Integration with RSpec 2 and Rails 4' do3 include IntegrationTests::RailsRSpec4 def configure_rails_project_generator(project_generator)5 super6 project_generator.configure do |project|7 project.rails_version = 48 end9 end10 def configure_project_generator(project_generator)11 super12 project_generator.configure do |project|13 project.rspec_version = 214 end15 end16 def self.including_the_adapter_manually_works17 specify "including the adapter manually works" do18 project = generate_project do |project|19 project.add_to_prelude <<-EOT20 RSpec.configure do |c|21 c.mock_with :rr22 end23 EOT24 end25 project.add_test_file do |file|26 file.add_working_test_case_with_adapter_tests do |test_case|27 test_case.add_to_body <<-EOT28 it 'loads the correct adapters' do29 assert_adapters_loaded #{adapters_that_should_be_loaded.inspect}30 end31 EOT32 end33 end34 result = project.run_tests35 result.should be_success36 result.should_not have_errors_or_failures37 end38 end39 def self.rr_hooks_into_the_test_framework_automatically40 specify "RR hooks into the test framework automatically" do41 project = generate_project42 project.add_test_file do |file|43 file.add_working_test_case44 end45 result = project.run_tests46 result.should be_success47 result.should_not have_errors_or_failures48 end49 end50 def self.using_rr_with_cucumber_works51 specify "using RR with Cucumber works" do52 pending "Cucumber doesn't work with Rails 4 just yet"53 project_generator = build_rails_project_generator do |project_generator|54 project_generator.mixin Project::Cucumber55 end56 project = project_generator.call57 result = project.run_command_within("bundle exec cucumber")58 result.should be_success59 end60 end61 context 'when Bundler is autorequiring RR' do62 def configure_project_generator(project_generator)63 super64 project_generator.configure do |project|65 project.autorequire_gems = true66 end67 end68 def adapters_that_should_be_loaded69 [:RSpec2]70 end71 including_the_adapter_manually_works72 using_rr_with_cucumber_works73 end74 context 'when RR is being required manually' do75 def configure_project_generator(project_generator)76 super77 project_generator.configure do |project|78 project.autorequire_gems = false79 end80 end81 def adapters_that_should_be_loaded82 [:RSpec2]83 end84 rr_hooks_into_the_test_framework_automatically85 including_the_adapter_manually_works86 using_rr_with_cucumber_works87 specify "when RR raises an error it raises a failure not an exception" do88 project = generate_project89 project.add_test_file do |file|90 file.add_test_case do |test_case|91 test_case.add_test <<-EOT92 object = Object.new93 mock(object).foo94 EOT95 end96 end97 result = project.run_tests98 result.should fail_with_output(/1 failure/)99 end100 specify "the database is properly rolled back after an RR error" do101 project = generate_project do |project|102 project.add_model_and_migration(:person, :people, :name => :string)103 end104 project.add_test_file do |file|105 file.add_test_case do |test_case|106 test_case.add_test <<-EOT107 Person.create!(:name => 'Joe Blow')108 object = Object.new109 mock(object).foo110 EOT111 end112 end113 expect {114 result = project.run_tests115 result.should have_errors_or_failures116 }.to leave_database_table_clear(project, :people)117 end118 specify "it is still possible to use a custom RSpec-2 adapter" do119 project = generate_project do |project|120 project.add_to_prelude <<-EOT121 module RR122 module Adapters123 module RSpec2124 include RRMethods125 def setup_mocks_for_rspec126 RR.reset127 end128 def verify_mocks_for_rspec129 RR.verify130 end131 def teardown_mocks_for_rspec132 RR.reset133 end134 def have_received(method = nil)135 RR::Adapters::Rspec::InvocationMatcher.new(method)136 end137 end138 end139 end140 RSpec.configure do |c|141 c.mock_with RR::Adapters::RSpec2142 end143 EOT144 end145 project.add_test_file do |file|146 file.add_test_case_with_adapter_tests147 end148 result = project.run_tests149 result.should be_success150 result.should_not have_errors_or_failures151 end152 end153end...

Full Screen

Full Screen

configure

Using AI Code Generation

copy

Full Screen

1CLEAN.include("report.html")2Given /^I have (\d+) cukes in my belly$/ do |n|3When /^I wait (\d+) hour$/ do |n|4Given /^I have (\d+) cukes in my belly$/ do |n|5When /^I wait (\d+) hour$/ do |n|6Given /^I have (\d+) cukes in my belly$/ do |n|7When /^I wait (\d+) hour$/ do |n|

Full Screen

Full Screen

configure

Using AI Code Generation

copy

Full Screen

1 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)2 c.options = {3 }4 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)5 c.options = {6 }7 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)8 c.options = {9 }10 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)11 c.options = {12 }13 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)14 c.options = {15 }16 c.formatter = Cucumber::Formatter::Pretty.new(STD

Full Screen

Full Screen

configure

Using AI Code Generation

copy

Full Screen

1 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)2 c.options = {3 }4 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)5 c.options = {6 }7 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)8 c.options = {9 }10 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)11 c.options = {12 }13 c.formatter = Cucumber::Formatter::Pretty.new(STDOUT)14 c.options = {15 }16 c.formatter = Cucumber::Formatter::Pretty.new(STD

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Rr_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful