Permalink
Browse files

Updated gems and added guard for automatic testing

  • Loading branch information...
1 parent 101667f commit 58413aeacad6629367325e28c3c2348f492504d1 @visoft committed Aug 6, 2012
View
@@ -0,0 +1,14 @@
+# A sample Guardfile
+# More info at https://github.com/guard/guard#readme
+
+guard 'rspec', :version => 2 do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
+guard 'cucumber', :all_after_pass => false, :all_on_start => false do
+ watch(%r{^features/.+\.feature$})
+ watch(%r{^features/support/.+$}) { 'features' }
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
+end
View
@@ -1,9 +1,9 @@
-require 'rake/rdoctask'
+require 'rdoc/task'
require 'bundler'
require 'rspec/core/rake_task'
require 'cucumber/rake/task'
-Rake::RDocTask.new do |rd|
+RDoc::Task.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc", "CHANGELOG.rdoc", "lib/**/*.rb")
rd.rdoc_dir = 'doc'
@@ -2,16 +2,16 @@
BASICAUTH_URL = "http://#{WEBSERVER}:#{HTTP_PORT_NUMBER}/SampleService/BasicAuth/RubyOData.svc"
HTTPS_BASICAUTH_URL = "https://#{WEBSERVER}:#{HTTPS_PORT_NUMBER}/SampleService/BasicAuth/RubyOData.svc"
-When /^(.*) first (last query )?result('s)?(.*)$/ do |pre, last_query, apos, post|
- step = "#{pre} #{last_query}result#{apos}#{post}"
+When /^(.*) first (last query )?result(\'s)?(.*)$/ do |pre, last_query, apos, post|
+ the_step = "#{pre} #{last_query}result#{apos}#{post}"
first_result
- When step
+ step the_step
end
When /^(.*) first (last )?save result(.*)$/ do |pre, last, post|
- step = "#{pre} #{last}save result#{post}"
+ the_step = "#{pre} #{last}save result#{post}"
first_save
- When step
+ step the_step
end
Given /^a HTTP ODataService exists$/ do
View
@@ -1,6 +1,4 @@
lib = File.expand_path(File.join(File.dirname(__FILE__), "../..", "lib"))
require lib + '/ruby_odata'
-require 'machinist/object'
-require 'sham'
-require 'faker'
+require "machinist"
@@ -1,4 +1,3 @@
Before do
- Sham.reset
RestClient.post "http://#{WEBSERVER}:#{HTTP_PORT_NUMBER}/SampleService/RubyOData.svc/CleanDatabaseForTesting", {}
end
View
@@ -1,21 +1,22 @@
lib = File.dirname(__FILE__)
-$: << lib + '/ruby_odata/'
-require 'rubygems'
-require 'active_support' # Used for serializtion to JSON
-require 'active_support/inflector'
-require 'active_support/core_ext'
-require 'cgi'
-require 'rest_client'
-require 'nokogiri'
-require 'bigdecimal'
-require 'bigdecimal/util'
-require 'backports'
+$: << lib + "/ruby_odata/"
+require "rubygems"
+require "i18n"
+require "active_support" # Used for serializtion to JSON
+require "active_support/inflector"
+require "active_support/core_ext"
+require "cgi"
+require "rest_client"
+require "nokogiri"
+require "bigdecimal"
+require "bigdecimal/util"
+require "backports"
-require lib + '/ruby_odata/association'
-require lib + '/ruby_odata/property_metadata'
-require lib + '/ruby_odata/query_builder'
-require lib + '/ruby_odata/class_builder'
-require lib + '/ruby_odata/operation'
-require lib + '/ruby_odata/service'
-require lib + '/ruby_odata/helpers'
+require lib + "/ruby_odata/association"
+require lib + "/ruby_odata/property_metadata"
+require lib + "/ruby_odata/query_builder"
+require lib + "/ruby_odata/class_builder"
+require lib + "/ruby_odata/operation"
+require lib + "/ruby_odata/service"
+require lib + "/ruby_odata/helpers"
View
@@ -14,18 +14,21 @@ Gem::Specification.new do |s|
s.rubyforge_project = "ruby-odata"
- s.add_dependency('activesupport', '>= 2.3.5')
- s.add_dependency('rest-client', '>= 1.5.1')
- s.add_dependency('nokogiri', '>= 1.4.2')
- s.add_dependency('backports', "~> 2.3.0")
-
- s.add_development_dependency('rake', '~> 0.8.7')
- s.add_development_dependency('rspec', '~> 2.5.0')
- s.add_development_dependency('cucumber', '~> 0.10.2')
- s.add_development_dependency('pickle', '~> 0.4.10')
- s.add_development_dependency('faker', '~> 0.9.5')
- s.add_development_dependency('machinist', '~> 1.0.6')
- s.add_development_dependency('webmock', '~> 1.6.2')
+ s.add_dependency("i18n", "~> 0.6.0")
+ s.add_dependency("activesupport", ">= 3.0.0")
+ s.add_dependency("rest-client", ">= 1.5.1")
+ s.add_dependency("nokogiri", ">= 1.4.2")
+ s.add_dependency("backports", "~> 2.3.0")
+
+ s.add_development_dependency("rake", "~> 0.8.7")
+ s.add_development_dependency("rspec", "~> 2.11.0")
+ s.add_development_dependency("cucumber", "~> 1.2.1")
+ s.add_development_dependency("pickle", "~> 0.4.11")
+ s.add_development_dependency("machinist", "~> 2.0")
+ s.add_development_dependency("webmock", "~> 1.8.8")
+ s.add_development_dependency("guard", "~> 1.3.0")
+ s.add_development_dependency("guard-rspec", "~> 1.2.1")
+ s.add_development_dependency("guard-cucumber", "~> 1.2.0")
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
View
@@ -1,22 +1,28 @@
-Sham.define do
- category_name { |i| "Category #{i}" }
- product_name { |i| "Widget #{i}" }
- price(:unique => false) { ['5.00', '10.00', '20.00', '15.00' , '25.00', '7.50'].rand }
+class AuditFields
+ extend Machinist::Machinable
+end
+
+class Product
+ extend Machinist::Machinable
+end
+
+class Category
+ extend Machinist::Machinable
end
AuditFields.blueprint do
- CreatedBy "Machinist"
+ CreatedBy { "Machinist" }
end
Product.blueprint do
- Name { Sham.product_name }
- Description "Test Widget"
- Price { Sham.price }
+ Name { "Widget #{sn}" }
+ Description { "Test Widget" }
+ Price { ["10.25", "25.00", "50.00", "75.50", "100.00"].sample }
Category { Category.make }
AuditFields { AuditFields.make }
end
Category.blueprint do
- Name { Sham.category_name }
+ Name { "Category #{sn}" }
AuditFields { AuditFields.make }
end
@@ -1,8 +1,6 @@
require File.expand_path('../../../lib/ruby_odata', __FILE__)
require File.expand_path('../../../features/support/constants', __FILE__)
-require 'machinist/object'
-require 'sham'
-require 'faker'
+require "machinist"
svc = OData::Service.new "http://#{WEBSERVER}:#{HTTP_PORT_NUMBER}/SampleService/RubyOData.svc"
svc.CleanDatabaseForTesting #=> Comment this line out if you don't want to clear your test database

0 comments on commit 58413ae

Please sign in to comment.