From 565e58d4d09c10e575c7eaeebdddf76af740169c Mon Sep 17 00:00:00 2001 From: Florian Hanke Date: Tue, 6 Dec 2011 16:10:46 +1100 Subject: [PATCH] + 4.0.0pre1, + integration spec examples in all_in_one --- .../generators/all_in_one/sinatra.rb | 2 +- .../prototypes/all_in_one/sinatra/Rakefile | 7 ++++- .../sinatra/spec/integration_spec.rb | 28 +++++++++++++++++++ .../all_in_one/sinatra/spec/spec_helper.rb | 6 ++++ history.textile | 2 +- version.rb | 2 +- 6 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 generators/prototypes/all_in_one/sinatra/spec/integration_spec.rb create mode 100644 generators/prototypes/all_in_one/sinatra/spec/spec_helper.rb diff --git a/generators/lib/picky-generators/generators/all_in_one/sinatra.rb b/generators/lib/picky-generators/generators/all_in_one/sinatra.rb index 1fec3892..30d85e53 100644 --- a/generators/lib/picky-generators/generators/all_in_one/sinatra.rb +++ b/generators/lib/picky-generators/generators/all_in_one/sinatra.rb @@ -20,8 +20,8 @@ def initialize identifier, name, *args def generate exclaim "Setting up Picky Sinatra Client/Server \"#{name}\"." create_target_directory - copy_all_files expand_prototype_path('server/shared') copy_all_files + copy_all_files expand_prototype_path('server/shared') exclaim "\"#{name}\" is a great project name! Have fun :)\n" exclaim "" exclaim "Next steps:" diff --git a/generators/prototypes/all_in_one/sinatra/Rakefile b/generators/prototypes/all_in_one/sinatra/Rakefile index 2277198f..38ea677f 100644 --- a/generators/prototypes/all_in_one/sinatra/Rakefile +++ b/generators/prototypes/all_in_one/sinatra/Rakefile @@ -3,4 +3,9 @@ require 'picky-client/tasks' # Pass in location of your javascript files, default is "javascripts". # -Picky::Tasks::Javascripts.new \ No newline at end of file +Picky::Tasks::Javascripts.new + +require 'rspec' +require 'rspec/core/rake_task' + +RSpec::Core::RakeTask.new :spec \ No newline at end of file diff --git a/generators/prototypes/all_in_one/sinatra/spec/integration_spec.rb b/generators/prototypes/all_in_one/sinatra/spec/integration_spec.rb new file mode 100644 index 00000000..6f52ce7c --- /dev/null +++ b/generators/prototypes/all_in_one/sinatra/spec/integration_spec.rb @@ -0,0 +1,28 @@ +# coding: utf-8 +# +require 'spec_helper' +require 'picky-client/spec' + +describe 'Integration Tests' do + + before(:all) do + Picky::Indexes.index + Picky::Indexes.load + end + + let(:books) { Picky::TestClient.new(BookSearch, :path => '/search/full') } + + # Testing a count of results. + # + it { books.search('a s').total.should == 42 } + + # Testing a specific order of result ids. + # + it { books.search('alan').ids.should == [449, 259, 307] } + + # Testing an order of result categories. + # + it { books.search('alan').should have_categories(['title'], ['author']) } + it { books.search('alan p').should have_categories(['title', 'author'], ['author', 'title']) } + +end \ No newline at end of file diff --git a/generators/prototypes/all_in_one/sinatra/spec/spec_helper.rb b/generators/prototypes/all_in_one/sinatra/spec/spec_helper.rb new file mode 100644 index 00000000..d9a1ea12 --- /dev/null +++ b/generators/prototypes/all_in_one/sinatra/spec/spec_helper.rb @@ -0,0 +1,6 @@ +ENV['PICKY_ENV'] = 'test' + +require 'picky' +require 'rspec' + +Picky::Loader.load_application \ No newline at end of file diff --git a/history.textile b/history.textile index 7af03dc4..fc2f258d 100644 --- a/history.textile +++ b/history.textile @@ -1,6 +1,6 @@ h2. Upcoming Version -h2. Version 4.0.0-pre1 +h2. Version 4.0.0pre1 * hanke: (server) BREAKING @Picky::Indexes.index@ does not index in parallel anymore. * hanke: (server) BREAKING Renamed @Picky::Indexes.index_for_tests@ to @Picky::Indexes.index@. diff --git a/version.rb b/version.rb index fd9373a9..b9f2161c 100644 --- a/version.rb +++ b/version.rb @@ -1,3 +1,3 @@ module Picky - VERSION = '4.0.0-pre1' + VERSION = '4.0.0pre1' end \ No newline at end of file