diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb3489a --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile ~/.gitignore_global + +# Ignore bundler config +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 + +# Ignore all logfiles and tempfiles. +/log/*.log +/tmp diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..53607ea --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--colour diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..d742feb --- /dev/null +++ b/Gemfile @@ -0,0 +1,57 @@ +source 'https://rubygems.org' + +gem 'rails', '3.2.2' +#gem 'rspec-rails' +#gem 'cucumber-rails' +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'mysql2' +gem 'gruff' +gem 'rmagick' + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + + # See https://github.com/sstephenson/execjs#readme for more supported runtimes + # gem 'therubyracer' + + gem 'uglifier', '>= 1.0.3' +end + +gem 'jquery-rails' + +# To use ActiveModel has_secure_password +# gem 'bcrypt-ruby', '~> 3.0.0' + +# To use Jbuilder templates for JSON +# gem 'jbuilder' + +# Use unicorn as the app server +# gem 'unicorn' + +# Deploy with Capistrano +# gem 'capistrano' + +# To use debugger +# gem 'ruby-debug19', :require => 'ruby-debug' +group :development do +gem 'database_cleaner' +gem 'rspec-rails' +gem 'cucumber-rails' +gem 'capybara' +#gem 'webrat' +gem 'rack-test' +end + +group :test do +#gem 'database_cleaner' +gem 'rspec-rails' +gem 'rack-test' +#gem 'webrat' +gem 'cucumber-rails' +gem 'capybara' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..32d06ec --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,171 @@ +GEM + remote: https://rubygems.org/ + specs: + actionmailer (3.2.2) + actionpack (= 3.2.2) + mail (~> 2.4.0) + actionpack (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.1) + rack-test (~> 0.6.1) + sprockets (~> 2.1.2) + activemodel (3.2.2) + activesupport (= 3.2.2) + builder (~> 3.0.0) + activerecord (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.2) + activemodel (= 3.2.2) + activesupport (= 3.2.2) + activesupport (3.2.2) + i18n (~> 0.6) + multi_json (~> 1.0) + addressable (2.2.7) + arel (3.0.2) + builder (3.0.0) + capybara (1.1.2) + mime-types (>= 1.16) + nokogiri (>= 1.3.3) + rack (>= 1.0.0) + rack-test (>= 0.5.4) + selenium-webdriver (~> 2.0) + xpath (~> 0.1.4) + childprocess (0.3.1) + ffi (~> 1.0.6) + coffee-rails (3.2.2) + coffee-script (>= 2.2.0) + railties (~> 3.2.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.2.0) + cucumber (1.1.9) + builder (>= 2.1.2) + diff-lcs (>= 1.1.2) + gherkin (~> 2.9.0) + json (>= 1.4.6) + term-ansicolor (>= 1.0.6) + cucumber-rails (1.3.0) + capybara (>= 1.1.2) + cucumber (>= 1.1.8) + nokogiri (>= 1.5.0) + database_cleaner (0.7.2) + diff-lcs (1.1.3) + erubis (2.7.0) + execjs (1.3.0) + multi_json (~> 1.0) + ffi (1.0.11) + gherkin (2.9.3) + json (>= 1.4.6) + gruff (0.3.6) + hike (1.2.1) + i18n (0.6.0) + journey (1.0.3) + jquery-rails (2.0.2) + railties (>= 3.2.0, < 5.0) + thor (~> 0.14) + json (1.6.6) + libwebsocket (0.1.3) + addressable + mail (2.4.4) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.18) + multi_json (1.2.0) + mysql2 (0.3.11) + nokogiri (1.5.2) + polyglot (0.3.3) + rack (1.4.1) + rack-cache (1.2) + rack (>= 0.4) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.2.2) + actionmailer (= 3.2.2) + actionpack (= 3.2.2) + activerecord (= 3.2.2) + activeresource (= 3.2.2) + activesupport (= 3.2.2) + bundler (~> 1.0) + railties (= 3.2.2) + railties (3.2.2) + actionpack (= 3.2.2) + activesupport (= 3.2.2) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2.2) + rdoc (3.12) + json (~> 1.4) + rmagick (2.13.1) + rspec (2.9.0) + rspec-core (~> 2.9.0) + rspec-expectations (~> 2.9.0) + rspec-mocks (~> 2.9.0) + rspec-core (2.9.0) + rspec-expectations (2.9.1) + diff-lcs (~> 1.1.3) + rspec-mocks (2.9.0) + rspec-rails (2.9.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.9.0) + rubyzip (0.9.7) + sass (3.1.15) + sass-rails (3.2.5) + railties (~> 3.2.0) + sass (>= 3.1.10) + tilt (~> 1.3) + selenium-webdriver (2.21.2) + childprocess (>= 0.2.5) + ffi (~> 1.0) + libwebsocket (~> 0.1.3) + multi_json (~> 1.0) + rubyzip + sprockets (2.1.2) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + term-ansicolor (1.0.7) + thor (0.14.6) + tilt (1.3.3) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.32) + uglifier (1.2.4) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + xpath (0.1.4) + nokogiri (~> 1.3) + +PLATFORMS + ruby + +DEPENDENCIES + capybara + coffee-rails (~> 3.2.1) + cucumber-rails + database_cleaner + gruff + jquery-rails + mysql2 + rack-test + rails (= 3.2.2) + rmagick + rspec-rails + sass-rails (~> 3.2.3) + uglifier (>= 1.0.3) diff --git a/README.md b/README.md new file mode 100644 index 0000000..1dadb27 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +This project hoping that it would solve the issue of cattle rustling in kenya particularly sub-sahara africa countries such as sudan, tanzania, uganda. The plan the initial plan in writting this project was that A.I could be used to predict and warn the community, and police about a rustling which is about to occur. The project is written in ruby on rails + +Requirements. +This project requires Ruby at least ruby 1.8.1 to be running + +How to Run +go to the project root +then start +Rails s +visit localhost:3000 to see the project in action + +Future todos +1. Include A.I into predicting cattle rustling which is about to occur +2. Integrate with sms toolkit i.e for sending out sms + diff --git a/README.md~ b/README.md~ new file mode 100644 index 0000000..1dadb27 --- /dev/null +++ b/README.md~ @@ -0,0 +1,15 @@ +This project hoping that it would solve the issue of cattle rustling in kenya particularly sub-sahara africa countries such as sudan, tanzania, uganda. The plan the initial plan in writting this project was that A.I could be used to predict and warn the community, and police about a rustling which is about to occur. The project is written in ruby on rails + +Requirements. +This project requires Ruby at least ruby 1.8.1 to be running + +How to Run +go to the project root +then start +Rails s +visit localhost:3000 to see the project in action + +Future todos +1. Include A.I into predicting cattle rustling which is about to occur +2. Integrate with sms toolkit i.e for sending out sms + diff --git a/README.rdoc b/README.rdoc new file mode 100644 index 0000000..7c36f23 --- /dev/null +++ b/README.rdoc @@ -0,0 +1,261 @@ +== Welcome to Rails + +Rails is a web-application framework that includes everything needed to create +database-backed web applications according to the Model-View-Control pattern. + +This pattern splits the view (also called the presentation) into "dumb" +templates that are primarily responsible for inserting pre-built data in between +HTML tags. The model contains the "smart" domain objects (such as Account, +Product, Person, Post) that holds all the business logic and knows how to +persist themselves to a database. The controller handles the incoming requests +(such as Save New Account, Update Product, Show Post) by manipulating the model +and directing data to the view. + +In Rails, the model is handled by what's called an object-relational mapping +layer entitled Active Record. This layer allows you to present the data from +database rows as objects and embellish these data objects with business logic +methods. You can read more about Active Record in +link:files/vendor/rails/activerecord/README.html. + +The controller and view are handled by the Action Pack, which handles both +layers by its two parts: Action View and Action Controller. These two layers +are bundled in a single package due to their heavy interdependence. This is +unlike the relationship between the Active Record and Action Pack that is much +more separate. Each of these packages can be used independently outside of +Rails. You can read more about Action Pack in +link:files/vendor/rails/actionpack/README.html. + + +== Getting Started + +1. At the command prompt, create a new Rails application: + rails new myapp (where myapp is the application name) + +2. Change directory to myapp and start the web server: + cd myapp; rails server (run with --help for options) + +3. Go to http://localhost:3000/ and you'll see: + "Welcome aboard: You're riding Ruby on Rails!" + +4. Follow the guidelines to start developing your application. You can find +the following resources handy: + +* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html +* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ + + +== Debugging Rails + +Sometimes your application goes wrong. Fortunately there are a lot of tools that +will help you debug it and get it back on the rails. + +First area to check is the application log files. Have "tail -f" commands +running on the server.log and development.log. Rails will automatically display +debugging and runtime information to these files. Debugging info will also be +shown in the browser on requests from 127.0.0.1. + +You can also log your own messages directly into the log file from your code +using the Ruby logger class from inside your controllers. Example: + + class WeblogController < ActionController::Base + def destroy + @weblog = Weblog.find(params[:id]) + @weblog.destroy + logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") + end + end + +The result will be a message in your log file along the lines of: + + Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! + +More information on how to use the logger is at http://www.ruby-doc.org/core/ + +Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are +several books available online as well: + +* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) +* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) + +These two books will bring you up to speed on the Ruby language and also on +programming in general. + + +== Debugger + +Debugger support is available through the debugger command when you start your +Mongrel or WEBrick server with --debugger. This means that you can break out of +execution at any point in the code, investigate and change the model, and then, +resume execution! You need to install ruby-debug to run the server in debugging +mode. With gems, use sudo gem install ruby-debug. Example: + + class WeblogController < ActionController::Base + def index + @posts = Post.all + debugger + end + end + +So the controller will accept the action, run the first line, then present you +with a IRB prompt in the server window. Here you can do things like: + + >> @posts.inspect + => "[#nil, "body"=>nil, "id"=>"1"}>, + #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" + >> @posts.first.title = "hello from a debugger" + => "hello from a debugger" + +...and even better, you can examine how your runtime objects actually work: + + >> f = @posts.first + => #nil, "body"=>nil, "id"=>"1"}> + >> f. + Display all 152 possibilities? (y or n) + +Finally, when you're ready to resume execution, you can enter "cont". + + +== Console + +The console is a Ruby shell, which allows you to interact with your +application's domain model. Here you'll have all parts of the application +configured, just like it is when the application is running. You can inspect +domain models, change values, and save to the database. Starting the script +without arguments will launch it in the development environment. + +To start the console, run rails console from the application +directory. + +Options: + +* Passing the -s, --sandbox argument will rollback any modifications + made to the database. +* Passing an environment name as an argument will load the corresponding + environment. Example: rails console production. + +To reload your controllers and models after launching the console run +reload! + +More information about irb can be found at: +link:http://www.rubycentral.org/pickaxe/irb.html + + +== dbconsole + +You can go to the command line of your database directly through rails +dbconsole. You would be connected to the database with the credentials +defined in database.yml. Starting the script without arguments will connect you +to the development database. Passing an argument will connect you to a different +database, like rails dbconsole production. Currently works for MySQL, +PostgreSQL and SQLite 3. + +== Description of Contents + +The default directory structure of a generated Ruby on Rails application: + + |-- app + | |-- assets + | |-- images + | |-- javascripts + | `-- stylesheets + | |-- controllers + | |-- helpers + | |-- mailers + | |-- models + | `-- views + | `-- layouts + |-- config + | |-- environments + | |-- initializers + | `-- locales + |-- db + |-- doc + |-- lib + | `-- tasks + |-- log + |-- public + |-- script + |-- test + | |-- fixtures + | |-- functional + | |-- integration + | |-- performance + | `-- unit + |-- tmp + | |-- cache + | |-- pids + | |-- sessions + | `-- sockets + `-- vendor + |-- assets + `-- stylesheets + `-- plugins + +app + Holds all the code that's specific to this particular application. + +app/assets + Contains subdirectories for images, stylesheets, and JavaScript files. + +app/controllers + Holds controllers that should be named like weblogs_controller.rb for + automated URL mapping. All controllers should descend from + ApplicationController which itself descends from ActionController::Base. + +app/models + Holds models that should be named like post.rb. Models descend from + ActiveRecord::Base by default. + +app/views + Holds the template files for the view that should be named like + weblogs/index.html.erb for the WeblogsController#index action. All views use + eRuby syntax by default. + +app/views/layouts + Holds the template files for layouts to be used with views. This models the + common header/footer method of wrapping views. In your views, define a layout + using the layout :default and create a file named default.html.erb. + Inside default.html.erb, call <% yield %> to render the view using this + layout. + +app/helpers + Holds view helpers that should be named like weblogs_helper.rb. These are + generated for you automatically when using generators for controllers. + Helpers can be used to wrap functionality for your views into methods. + +config + Configuration files for the Rails environment, the routing map, the database, + and other dependencies. + +db + Contains the database schema in schema.rb. db/migrate contains all the + sequence of Migrations for your schema. + +doc + This directory is where your application documentation will be stored when + generated using rake doc:app + +lib + Application specific libraries. Basically, any kind of custom code that + doesn't belong under controllers, models, or helpers. This directory is in + the load path. + +public + The directory available for the web server. Also contains the dispatchers and the + default HTML files. This should be set as the DOCUMENT_ROOT of your web + server. + +script + Helper scripts for automation and generation. + +test + Unit and functional tests along with fixtures. When using the rails generate + command, template test files will be generated for you and placed in this + directory. + +vendor + External libraries that the application depends on. Also includes the plugins + subdirectory. If the app has frozen rails, those gems also go here, under + vendor/rails/. This directory is in the load path. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e0ba55f --- /dev/null +++ b/Rakefile @@ -0,0 +1,7 @@ +#!/usr/bin/env rake +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require File.expand_path('../config/application', __FILE__) + +Chw::Application.load_tasks diff --git a/app/assets/images/CHW-Good.jpg b/app/assets/images/CHW-Good.jpg new file mode 100644 index 0000000..e492adb Binary files /dev/null and b/app/assets/images/CHW-Good.jpg differ diff --git a/app/assets/images/CHW.jpg b/app/assets/images/CHW.jpg new file mode 100644 index 0000000..ba447a3 Binary files /dev/null and b/app/assets/images/CHW.jpg differ diff --git a/app/assets/images/CHyW-Good.jpg b/app/assets/images/CHyW-Good.jpg new file mode 100644 index 0000000..163f3f9 Binary files /dev/null and b/app/assets/images/CHyW-Good.jpg differ diff --git a/app/assets/images/Love.png b/app/assets/images/Love.png new file mode 100644 index 0000000..ec5d153 Binary files /dev/null and b/app/assets/images/Love.png differ diff --git a/app/assets/images/Love2.png b/app/assets/images/Love2.png new file mode 100644 index 0000000..b738f98 Binary files /dev/null and b/app/assets/images/Love2.png differ diff --git a/app/assets/images/Love3.png b/app/assets/images/Love3.png new file mode 100644 index 0000000..ea60f03 Binary files /dev/null and b/app/assets/images/Love3.png differ diff --git a/app/assets/images/dots_report.png b/app/assets/images/dots_report.png new file mode 100644 index 0000000..639a03a Binary files /dev/null and b/app/assets/images/dots_report.png differ diff --git a/app/assets/images/hiv_contraceptive_report.png b/app/assets/images/hiv_contraceptive_report.png new file mode 100644 index 0000000..8df041d Binary files /dev/null and b/app/assets/images/hiv_contraceptive_report.png differ diff --git a/app/assets/images/hiv_drugs_report.png b/app/assets/images/hiv_drugs_report.png new file mode 100644 index 0000000..ca33e0a Binary files /dev/null and b/app/assets/images/hiv_drugs_report.png differ diff --git a/app/assets/images/hiv_gender_report_pie.png b/app/assets/images/hiv_gender_report_pie.png new file mode 100644 index 0000000..f3604d2 Binary files /dev/null and b/app/assets/images/hiv_gender_report_pie.png differ diff --git a/app/assets/images/hiv_location_report_pie.png b/app/assets/images/hiv_location_report_pie.png new file mode 100644 index 0000000..cb8982f Binary files /dev/null and b/app/assets/images/hiv_location_report_pie.png differ diff --git a/app/assets/images/locations_report.png b/app/assets/images/locations_report.png new file mode 100644 index 0000000..ee51057 Binary files /dev/null and b/app/assets/images/locations_report.png differ diff --git a/app/assets/images/malaria_gender_report_pie.png b/app/assets/images/malaria_gender_report_pie.png new file mode 100644 index 0000000..26d3732 Binary files /dev/null and b/app/assets/images/malaria_gender_report_pie.png differ diff --git a/app/assets/images/malaria_location_report_pie.png b/app/assets/images/malaria_location_report_pie.png new file mode 100644 index 0000000..86cded7 Binary files /dev/null and b/app/assets/images/malaria_location_report_pie.png differ diff --git a/app/assets/images/malaria_prevention_report_line.png b/app/assets/images/malaria_prevention_report_line.png new file mode 100644 index 0000000..7f5d0ff Binary files /dev/null and b/app/assets/images/malaria_prevention_report_line.png differ diff --git a/app/assets/images/menu8.gif b/app/assets/images/menu8.gif new file mode 100644 index 0000000..927b899 Binary files /dev/null and b/app/assets/images/menu8.gif differ diff --git a/app/assets/images/mtabiri.png b/app/assets/images/mtabiri.png new file mode 100644 index 0000000..68727d4 Binary files /dev/null and b/app/assets/images/mtabiri.png differ diff --git a/app/assets/images/predictor_location_report.png b/app/assets/images/predictor_location_report.png new file mode 100644 index 0000000..cb8982f Binary files /dev/null and b/app/assets/images/predictor_location_report.png differ diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000..d5edc04 Binary files /dev/null and b/app/assets/images/rails.png differ diff --git a/app/assets/images/tb_location_report.png b/app/assets/images/tb_location_report.png new file mode 100644 index 0000000..45370e2 Binary files /dev/null and b/app/assets/images/tb_location_report.png differ diff --git a/app/assets/images/train-a-community-health-worker.jpg b/app/assets/images/train-a-community-health-worker.jpg new file mode 100644 index 0000000..bec183d Binary files /dev/null and b/app/assets/images/train-a-community-health-worker.jpg differ diff --git a/app/assets/javascripts/admin.js.coffee b/app/assets/javascripts/admin.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/admin.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..9097d83 --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,15 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD +// GO AFTER THE REQUIRES BELOW. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/javascripts/car.js.coffee b/app/assets/javascripts/car.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/car.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/cattlethefts.js.coffee b/app/assets/javascripts/cattlethefts.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/cattlethefts.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/childhealth.js.coffee b/app/assets/javascripts/childhealth.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/childhealth.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/community_health_workers.js.coffee b/app/assets/javascripts/community_health_workers.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/community_health_workers.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/conflicts.js.coffee b/app/assets/javascripts/conflicts.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/conflicts.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/dotsmembers.js.coffee b/app/assets/javascripts/dotsmembers.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/dotsmembers.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/firearms.js.coffee b/app/assets/javascripts/firearms.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/firearms.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivaid.js.coffee b/app/assets/javascripts/hivaid.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivaid.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivcases.js.coffee b/app/assets/javascripts/hivcases.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivcases.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivcontraceptionreports.js.coffee b/app/assets/javascripts/hivcontraceptionreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivcontraceptionreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivdrugreports.js.coffee b/app/assets/javascripts/hivdrugreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivdrugreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivgenderreports.js.coffee b/app/assets/javascripts/hivgenderreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivgenderreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/hivlocationreports.js.coffee b/app/assets/javascripts/hivlocationreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/hivlocationreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/immunization.js.coffee b/app/assets/javascripts/immunization.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/immunization.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/locationreports.js.coffee b/app/assets/javascripts/locationreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/locationreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/locations.js.coffee b/app/assets/javascripts/locations.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/locations.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/malaria.js.coffee b/app/assets/javascripts/malaria.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/malaria.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/malariacases.js.coffee b/app/assets/javascripts/malariacases.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/malariacases.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/malariagenderreports.js.coffee b/app/assets/javascripts/malariagenderreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/malariagenderreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/malarialocationreports.js.coffee b/app/assets/javascripts/malarialocationreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/malarialocationreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/malariapreventationreports.js.coffee b/app/assets/javascripts/malariapreventationreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/malariapreventationreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/members.js.coffee b/app/assets/javascripts/members.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/members.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/messages.js.coffee b/app/assets/javascripts/messages.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/messages.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/nightattacks.js.coffee b/app/assets/javascripts/nightattacks.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/nightattacks.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/patients.js.coffee b/app/assets/javascripts/patients.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/patients.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/roadcrimes.js.coffee b/app/assets/javascripts/roadcrimes.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/roadcrimes.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/sessions.js.coffee b/app/assets/javascripts/sessions.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/sessions.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/settings.js.coffee b/app/assets/javascripts/settings.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/settings.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/sms.js.coffee b/app/assets/javascripts/sms.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/sms.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/smsmessages.js.coffee b/app/assets/javascripts/smsmessages.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/smsmessages.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/tb.js.coffee b/app/assets/javascripts/tb.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/tb.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/tbcases.js.coffee b/app/assets/javascripts/tbcases.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/tbcases.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/tbdotreports.js.coffee b/app/assets/javascripts/tbdotreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/tbdotreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/tblocationreports.js.coffee b/app/assets/javascripts/tblocationreports.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/tblocationreports.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/test_it.js.coffee b/app/assets/javascripts/test_it.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/test_it.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/textmessage.js.coffee b/app/assets/javascripts/textmessage.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/textmessage.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/users.js.coffee b/app/assets/javascripts/users.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/users.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/villageworkers.js.coffee b/app/assets/javascripts/villageworkers.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/villageworkers.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/admin.css.scss b/app/assets/stylesheets/admin.css.scss new file mode 100644 index 0000000..6b55735 --- /dev/null +++ b/app/assets/stylesheets/admin.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the admin controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..3b5cc66 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,13 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, + * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the top of the + * compiled file, but it's generally better to create a new file per style scope. + * + *= require_self + *= require_tree . +*/ diff --git a/app/assets/stylesheets/car.css.scss b/app/assets/stylesheets/car.css.scss new file mode 100644 index 0000000..9ca18d5 --- /dev/null +++ b/app/assets/stylesheets/car.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Car controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/cattlethefts.css.scss b/app/assets/stylesheets/cattlethefts.css.scss new file mode 100644 index 0000000..ef63dae --- /dev/null +++ b/app/assets/stylesheets/cattlethefts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the cattlethefts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/childhealth.css.scss b/app/assets/stylesheets/childhealth.css.scss new file mode 100644 index 0000000..d3bd3b3 --- /dev/null +++ b/app/assets/stylesheets/childhealth.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the childhealth controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/community_health_workers.css.scss b/app/assets/stylesheets/community_health_workers.css.scss new file mode 100644 index 0000000..10379da --- /dev/null +++ b/app/assets/stylesheets/community_health_workers.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the CommunityHealthWorkers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/conflicts.css.scss b/app/assets/stylesheets/conflicts.css.scss new file mode 100644 index 0000000..a20ee33 --- /dev/null +++ b/app/assets/stylesheets/conflicts.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the conflicts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/dotsmembers.css.scss b/app/assets/stylesheets/dotsmembers.css.scss new file mode 100644 index 0000000..669ce89 --- /dev/null +++ b/app/assets/stylesheets/dotsmembers.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the dotsmembers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/firearms.css.scss b/app/assets/stylesheets/firearms.css.scss new file mode 100644 index 0000000..457310c --- /dev/null +++ b/app/assets/stylesheets/firearms.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the firearms controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivaid.css.scss b/app/assets/stylesheets/hivaid.css.scss new file mode 100644 index 0000000..a0c8874 --- /dev/null +++ b/app/assets/stylesheets/hivaid.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivaid controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivcases.css.scss b/app/assets/stylesheets/hivcases.css.scss new file mode 100644 index 0000000..fa426d0 --- /dev/null +++ b/app/assets/stylesheets/hivcases.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivcases controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivcontraceptionreports.css.scss b/app/assets/stylesheets/hivcontraceptionreports.css.scss new file mode 100644 index 0000000..fedfa88 --- /dev/null +++ b/app/assets/stylesheets/hivcontraceptionreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivcontraceptionreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivdrugreports.css.scss b/app/assets/stylesheets/hivdrugreports.css.scss new file mode 100644 index 0000000..cc3b4fe --- /dev/null +++ b/app/assets/stylesheets/hivdrugreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivdrugreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivgenderreports.css.scss b/app/assets/stylesheets/hivgenderreports.css.scss new file mode 100644 index 0000000..2eb4c36 --- /dev/null +++ b/app/assets/stylesheets/hivgenderreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivgenderreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/hivlocationreports.css.scss b/app/assets/stylesheets/hivlocationreports.css.scss new file mode 100644 index 0000000..2844dfc --- /dev/null +++ b/app/assets/stylesheets/hivlocationreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the hivlocationreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/immunization.css.scss b/app/assets/stylesheets/immunization.css.scss new file mode 100644 index 0000000..18a1668 --- /dev/null +++ b/app/assets/stylesheets/immunization.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the immunization controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/locationreports.css.scss b/app/assets/stylesheets/locationreports.css.scss new file mode 100644 index 0000000..9dc9741 --- /dev/null +++ b/app/assets/stylesheets/locationreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the locationreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/locations.css.scss b/app/assets/stylesheets/locations.css.scss new file mode 100644 index 0000000..b6e6e3a --- /dev/null +++ b/app/assets/stylesheets/locations.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Locations controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/malaria.css.scss b/app/assets/stylesheets/malaria.css.scss new file mode 100644 index 0000000..69e3fee --- /dev/null +++ b/app/assets/stylesheets/malaria.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the malaria controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/malariacases.css.scss b/app/assets/stylesheets/malariacases.css.scss new file mode 100644 index 0000000..ec8dede --- /dev/null +++ b/app/assets/stylesheets/malariacases.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the malariacases controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/malariagenderreports.css.scss b/app/assets/stylesheets/malariagenderreports.css.scss new file mode 100644 index 0000000..d4ed723 --- /dev/null +++ b/app/assets/stylesheets/malariagenderreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the malariagenderreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/malarialocationreports.css.scss b/app/assets/stylesheets/malarialocationreports.css.scss new file mode 100644 index 0000000..fcc11fd --- /dev/null +++ b/app/assets/stylesheets/malarialocationreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the malarialocationreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/malariapreventationreports.css.scss b/app/assets/stylesheets/malariapreventationreports.css.scss new file mode 100644 index 0000000..012a09a --- /dev/null +++ b/app/assets/stylesheets/malariapreventationreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the malariapreventationreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/members.css.scss b/app/assets/stylesheets/members.css.scss new file mode 100644 index 0000000..43b5cef --- /dev/null +++ b/app/assets/stylesheets/members.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the members controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/messages.css.scss b/app/assets/stylesheets/messages.css.scss new file mode 100644 index 0000000..492f0fa --- /dev/null +++ b/app/assets/stylesheets/messages.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Messages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/nightattacks.css.scss b/app/assets/stylesheets/nightattacks.css.scss new file mode 100644 index 0000000..fb68ffc --- /dev/null +++ b/app/assets/stylesheets/nightattacks.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the nightattacks controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/patients.css.scss b/app/assets/stylesheets/patients.css.scss new file mode 100644 index 0000000..f3c6973 --- /dev/null +++ b/app/assets/stylesheets/patients.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the patients controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/roadcrimes.css.scss b/app/assets/stylesheets/roadcrimes.css.scss new file mode 100644 index 0000000..366a844 --- /dev/null +++ b/app/assets/stylesheets/roadcrimes.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the roadcrimes controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/scaffolds.css.scss b/app/assets/stylesheets/scaffolds.css.scss new file mode 100644 index 0000000..05188f0 --- /dev/null +++ b/app/assets/stylesheets/scaffolds.css.scss @@ -0,0 +1,56 @@ +body { + background-color: #fff; + color: #333; + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; } + +p, ol, ul, td { + font-family: verdana, arial, helvetica, sans-serif; + font-size: 13px; + line-height: 18px; } + +pre { + background-color: #eee; + padding: 10px; + font-size: 11px; } + +a { + color: #000; + &:visited { + color: #666; } + &:hover { + color: #fff; + background-color: #000; } } + +div { + &.field, &.actions { + margin-bottom: 10px; } } + +#notice { + color: green; } + +.field_with_errors { + padding: 2px; + background-color: red; + display: table; } + +#error_explanation { + width: 450px; + border: 2px solid red; + padding: 7px; + padding-bottom: 0; + margin-bottom: 20px; + background-color: #f0f0f0; + h2 { + text-align: left; + font-weight: bold; + padding: 5px 5px 5px 15px; + font-size: 12px; + margin: -7px; + margin-bottom: 0px; + background-color: #c00; + color: #fff; } + ul li { + font-size: 12px; + list-style: square; } } diff --git a/app/assets/stylesheets/sessions.css.scss b/app/assets/stylesheets/sessions.css.scss new file mode 100644 index 0000000..be7e354 --- /dev/null +++ b/app/assets/stylesheets/sessions.css.scss @@ -0,0 +1,8 @@ +// Place all the styles related to the sessions controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.class login{ +margin-left:30%; +margin-right:40%; +} diff --git a/app/assets/stylesheets/settings.css.scss b/app/assets/stylesheets/settings.css.scss new file mode 100644 index 0000000..fbe6690 --- /dev/null +++ b/app/assets/stylesheets/settings.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the settings controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/sms.css.scss b/app/assets/stylesheets/sms.css.scss new file mode 100644 index 0000000..ea04153 --- /dev/null +++ b/app/assets/stylesheets/sms.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the sms controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/smsmessages.css.scss b/app/assets/stylesheets/smsmessages.css.scss new file mode 100644 index 0000000..3a09cd5 --- /dev/null +++ b/app/assets/stylesheets/smsmessages.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the smsmessages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/style.css b/app/assets/stylesheets/style.css new file mode 100644 index 0000000..76336b2 --- /dev/null +++ b/app/assets/stylesheets/style.css @@ -0,0 +1,201 @@ +// Place all the styles related to the sessions controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ + +.class login{ +margin-left:30%; +margin-right:40%; +} + +body { +background-color: white; +} + +/*This is the div that wraps around the content of the webpage*/ +.content { +width:100%; +height:auto; +margin:auto; +} + +.top_menu { +height:40px; +width:100%; +background-color:blue; +border: 0px solid #ccc; +margin-top:10px; + +} +.top_menu ul{ +margin-left: 20%; + +} +.top_menu li{ +float: left; +display: block; +font-size: 19px; +font-weight:bold; +color: white; +padding-left:10px; +padding-right: 7px; +margin-top:10px; +} + + + +.top_menu ul li a{ +float: left; +display: block; +font-size: 19px; +font-weight:bold; +color: white; +padding: 0 5px; +background-color: inherit; +text-decoration:none; +} +.top_menu li a:hover{ +color: white; +text-decoration: none; +border-bottom: 5px solid white; +} + + + +.logo { +width:25%; +height:70px; +background-color: white; +float:left; +} + + +.user_login { +margin-top:0px; +font-size: 16px; +width:20%; +height: 60px; +float: right; +} + +.depot_form{ +margin-top:5%; +margin-left:25%; +width:500px; +} + +.depot_form label { +width: 50px; +} + +.header{ +width:100%; +height:75px; +} + + +.side_menu{ +width: 17%; +height: 500px; +float:left; +display:block; +} +.main_content{ +width: 82%; +height:auto; +float: left; +border: 2px solid #eee; +margin-top:15px; +padding-left: 5px; +} + +#menu8 { + width: 200px; + margin-top: 15px; +} + +#menu8 li a { + text-decoration: none; + margin-bottom: 10px; + height: 38px; + voice-family: "\"}\""; + voice-family: inherit; + height: 24px; +} + +#menu8 li a:link, #menu8 li a:visited { + color: #777; + display: block; + background: url(menu8.gif); + padding: 8px 0 0 20px; +} + +#menu8 li a:hover { + color: #257EB7; + background: url(menu8.gif) 0 -32px; + padding: 8px 0 0 25px; +} + +#menu8 li a:active { + color: #fff; + background: url(menu8.gif) 0 -64px; + padding: 8px 0 0 25px; +} + +#menu8 ul { + list-style: none; + margin: 0; + padding: 0; + +} + +/* Report options dialog */ +.report_dlg{ +font-size:30px; +width:100%; +height:30px; +background-color:#ccc; +border: 2px solid brown; +margin-left:-5px; +} + +.table_list { + background-color: #f5f5f5; + padding: 5px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border: 1px solid #ebebeb; + width:98%; + margin-left:1%; +} +.table_list tr th { + text-align:center; +} +.table_list td, .table_list th { + padding: 1px 5px; + text-align:center; +} +.table_list thead { + font: normal 15px Helvetica Neue,Helvetica,sans-serif; + text-shadow: 0 1px 0 white; + color: #999; + text-align:center; +} +.table_list th { + text-align: left; + border-bottom: 1px solid #fff; +} +.table_list td { + font-size: 14px; +} +.table_list td:hover { + background-color: #fff; +} + +.footer{ +width:100%; +height:70px; +border: 1px solid #ccc; +background-color:black; +} + diff --git a/app/assets/stylesheets/tb.css.scss b/app/assets/stylesheets/tb.css.scss new file mode 100644 index 0000000..850cd45 --- /dev/null +++ b/app/assets/stylesheets/tb.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the tb controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/tbcases.css.scss b/app/assets/stylesheets/tbcases.css.scss new file mode 100644 index 0000000..c17784e --- /dev/null +++ b/app/assets/stylesheets/tbcases.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the tbcases controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/tbdotreports.css.scss b/app/assets/stylesheets/tbdotreports.css.scss new file mode 100644 index 0000000..bc00145 --- /dev/null +++ b/app/assets/stylesheets/tbdotreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the tbdotreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/tblocationreports.css.scss b/app/assets/stylesheets/tblocationreports.css.scss new file mode 100644 index 0000000..c3c1c98 --- /dev/null +++ b/app/assets/stylesheets/tblocationreports.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the tblocationreports controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/test_it.css.scss b/app/assets/stylesheets/test_it.css.scss new file mode 100644 index 0000000..dc2d876 --- /dev/null +++ b/app/assets/stylesheets/test_it.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the test_it controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/textmessage.css.scss b/app/assets/stylesheets/textmessage.css.scss new file mode 100644 index 0000000..52b61ec --- /dev/null +++ b/app/assets/stylesheets/textmessage.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the textmessage controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss new file mode 100644 index 0000000..1efc835 --- /dev/null +++ b/app/assets/stylesheets/users.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the users controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/villageworkers.css.scss b/app/assets/stylesheets/villageworkers.css.scss new file mode 100644 index 0000000..541e8d8 --- /dev/null +++ b/app/assets/stylesheets/villageworkers.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the villageworkers controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/.car_controller.rb.swp b/app/controllers/.car_controller.rb.swp new file mode 100644 index 0000000..59993c9 Binary files /dev/null and b/app/controllers/.car_controller.rb.swp differ diff --git a/app/controllers/.community_health_workers_controller.rb.swp b/app/controllers/.community_health_workers_controller.rb.swp new file mode 100644 index 0000000..2821198 Binary files /dev/null and b/app/controllers/.community_health_workers_controller.rb.swp differ diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb new file mode 100644 index 0000000..4f48d75 --- /dev/null +++ b/app/controllers/admin_controller.rb @@ -0,0 +1,30 @@ +class AdminController < ApplicationController + def index + @locations = Location.find(:all) + @drop_down_array = Array.new + + if(defined? params[:location][:id]) + @test = params[:location][:id] + @year = params[:date][:year] + if @test.empty? + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + else + @location_id = @test.to_i + @location_object = Location.find(@location_id) + @location_name = @location_object.name + end + else + #Basically this sets the default location + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + + end + + @hivlocationreports = Hivlocationreport.new + @hivlocationreports.drawLocationGraph(@location_name,@location_id,@year) + + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..1607ec7 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,12 @@ +class ApplicationController < ActionController::Base +before_filter :authorize +protect_from_forgery + +protected + +def authorize +unless User.find_by_id(session[:user_id]) +redirect_to login_url, :notice => "Please log in" +end +end +end diff --git a/app/controllers/cattlethefts_controller.rb b/app/controllers/cattlethefts_controller.rb new file mode 100644 index 0000000..f991ca0 --- /dev/null +++ b/app/controllers/cattlethefts_controller.rb @@ -0,0 +1,85 @@ +class CattletheftsController < ApplicationController + # GET /cattlethefts + # GET /cattlethefts.json + + layout 'conflict' + def index + @cattlethefts = Cattletheft.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @cattlethefts } + end + end + + # GET /cattlethefts/1 + # GET /cattlethefts/1.json + def show + @cattletheft = Cattletheft.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @cattletheft } + end + end + + # GET /cattlethefts/new + # GET /cattlethefts/new.json + def new + @cattletheft = Cattletheft.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @cattletheft } + end + end + + # GET /cattlethefts/1/edit + def edit + @cattletheft = Cattletheft.find(params[:id]) + end + + # POST /cattlethefts + # POST /cattlethefts.json + def create + @cattletheft = Cattletheft.new(params[:cattletheft]) + + respond_to do |format| + if @cattletheft.save + format.html { redirect_to @cattletheft, notice: 'Cattletheft was successfully created.' } + format.json { render json: @cattletheft, status: :created, location: @cattletheft } + else + format.html { render action: "new" } + format.json { render json: @cattletheft.errors, status: :unprocessable_entity } + end + end + end + + # PUT /cattlethefts/1 + # PUT /cattlethefts/1.json + def update + @cattletheft = Cattletheft.find(params[:id]) + + respond_to do |format| + if @cattletheft.update_attributes(params[:cattletheft]) + format.html { redirect_to @cattletheft, notice: 'Cattletheft was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @cattletheft.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /cattlethefts/1 + # DELETE /cattlethefts/1.json + def destroy + @cattletheft = Cattletheft.find(params[:id]) + @cattletheft.destroy + + respond_to do |format| + format.html { redirect_to cattlethefts_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/conflicts_controller.rb b/app/controllers/conflicts_controller.rb new file mode 100644 index 0000000..ab4df7e --- /dev/null +++ b/app/controllers/conflicts_controller.rb @@ -0,0 +1,80 @@ +class ConflictsController < ApplicationController + # GET /conflicts + # GET /conflicts.json +layout "conflict" + def index + redirect_to "/firearms" + end + + + # GET /conflicts/1 + # GET /conflicts/1.json + def show + @conflict = Conflict.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @conflict } + end + end + + # GET /conflicts/new + # GET /conflicts/new.json + def new + @conflict = Conflict.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @conflict } + end + end + + # GET /conflicts/1/edit + def edit + @conflict = Conflict.find(params[:id]) + end + + # POST /conflicts + # POST /conflicts.json + def create + @conflict = Conflict.new(params[:conflict]) + + respond_to do |format| + if @conflict.save + format.html { redirect_to @conflict, notice: 'Conflict was successfully created.' } + format.json { render json: @conflict, status: :created, location: @conflict } + else + format.html { render action: "new" } + format.json { render json: @conflict.errors, status: :unprocessable_entity } + end + end + end + + # PUT /conflicts/1 + # PUT /conflicts/1.json + def update + @conflict = Conflict.find(params[:id]) + + respond_to do |format| + if @conflict.update_attributes(params[:conflict]) + format.html { redirect_to @conflict, notice: 'Conflict was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @conflict.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /conflicts/1 + # DELETE /conflicts/1.json + def destroy + @conflict = Conflict.find(params[:id]) + @conflict.destroy + + respond_to do |format| + format.html { redirect_to conflicts_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/firearms_controller.rb b/app/controllers/firearms_controller.rb new file mode 100644 index 0000000..26c4c33 --- /dev/null +++ b/app/controllers/firearms_controller.rb @@ -0,0 +1,85 @@ +class FirearmsController < ApplicationController + # GET /firearms + # GET /firearms.json +layout 'conflict' + + def index + @firearms = Firearm.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @firearms } + end + end + + # GET /firearms/1 + # GET /firearms/1.json + def show + @firearm = Firearm.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @firearm } + end + end + + # GET /firearms/new + # GET /firearms/new.json + def new + @firearm = Firearm.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @firearm } + end + end + + # GET /firearms/1/edit + def edit + @firearm = Firearm.find(params[:id]) + end + + # POST /firearms + # POST /firearms.json + def create + @firearm = Firearm.new(params[:firearm]) + + respond_to do |format| + if @firearm.save + format.html { redirect_to @firearm, notice: 'Firearm was successfully created.' } + format.json { render json: @firearm, status: :created, location: @firearm } + else + format.html { render action: "new" } + format.json { render json: @firearm.errors, status: :unprocessable_entity } + end + end + end + + # PUT /firearms/1 + # PUT /firearms/1.json + def update + @firearm = Firearm.find(params[:id]) + + respond_to do |format| + if @firearm.update_attributes(params[:firearm]) + format.html { redirect_to @firearm, notice: 'Firearm was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @firearm.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /firearms/1 + # DELETE /firearms/1.json + def destroy + @firearm = Firearm.find(params[:id]) + @firearm.destroy + + respond_to do |format| + format.html { redirect_to firearms_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/hivcases_controller.rb b/app/controllers/hivcases_controller.rb new file mode 100644 index 0000000..2093885 --- /dev/null +++ b/app/controllers/hivcases_controller.rb @@ -0,0 +1,85 @@ +class HivcasesController < ApplicationController + # GET /hivcases + # GET /hivcases.json + +layout "hivaid" + def index + @hivcases = Hivcase.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @hivcases } + end + end + + # GET /hivcases/1 + # GET /hivcases/1.json + def show + @hivcase = Hivcase.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @hivcase } + end + end + + # GET /hivcases/new + # GET /hivcases/new.json + def new + @hivcase = Hivcase.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @hivcase } + end + end + + # GET /hivcases/1/edit + def edit + @hivcase = Hivcase.find(params[:id]) + end + + # POST /hivcases + # POST /hivcases.json + def create + @hivcase = Hivcase.new(params[:hivcase]) + + respond_to do |format| + if @hivcase.save + format.html { redirect_to @hivcase, notice: 'Hivcase was successfully created.' } + format.json { render json: @hivcase, status: :created, location: @hivcase } + else + format.html { render action: "new" } + format.json { render json: @hivcase.errors, status: :unprocessable_entity } + end + end + end + + # PUT /hivcases/1 + # PUT /hivcases/1.json + def update + @hivcase = Hivcase.find(params[:id]) + + respond_to do |format| + if @hivcase.update_attributes(params[:hivcase]) + format.html { redirect_to @hivcase, notice: 'Hivcase was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @hivcase.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /hivcases/1 + # DELETE /hivcases/1.json + def destroy + @hivcase = Hivcase.find(params[:id]) + @hivcase.destroy + + respond_to do |format| + format.html { redirect_to hivcases_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/hivcontraceptionreports_controller.rb b/app/controllers/hivcontraceptionreports_controller.rb new file mode 100644 index 0000000..6840289 --- /dev/null +++ b/app/controllers/hivcontraceptionreports_controller.rb @@ -0,0 +1,110 @@ +class HivcontraceptionreportsController < ApplicationController + # GET /hivcontraceptionreports + # GET /hivcontraceptionreports.json + layout "hivaid" + + def index + + @locations = Location.find(:all) + @drop_down_array = Array.new + + if(defined? params[:location][:id]) + @test = params[:location][:id] + @year = params[:date][:year] + if @test.empty? + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + else + @location_id = @test.to_i + @location_object = Location.find(@location_id) + @location_name = @location_object.name + end + else + #Basically this sets the default location + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + + end + + @hivcontraceptionreports = Hivcontraceptionreport.new + @hivcontraceptionreports.drawContraceptionGraph(@location_name,@location_id,@year) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @hivcontraceptionreports } + end + end + + # GET /hivcontraceptionreports/1 + # GET /hivcontraceptionreports/1.json + def show + @hivcontraceptionreport = Hivcontraceptionreport.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @hivcontraceptionreport } + end + end + + # GET /hivcontraceptionreports/new + # GET /hivcontraceptionreports/new.json + def new + @hivcontraceptionreport = Hivcontraceptionreport.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @hivcontraceptionreport } + end + end + + # GET /hivcontraceptionreports/1/edit + def edit + @hivcontraceptionreport = Hivcontraceptionreport.find(params[:id]) + end + + # POST /hivcontraceptionreports + # POST /hivcontraceptionreports.json + def create + @hivcontraceptionreport = Hivcontraceptionreport.new(params[:hivcontraceptionreport]) + + respond_to do |format| + if @hivcontraceptionreport.save + format.html { redirect_to @hivcontraceptionreport, notice: 'Hivcontraceptionreport was successfully created.' } + format.json { render json: @hivcontraceptionreport, status: :created, location: @hivcontraceptionreport } + else + format.html { render action: "new" } + format.json { render json: @hivcontraceptionreport.errors, status: :unprocessable_entity } + end + end + end + + # PUT /hivcontraceptionreports/1 + # PUT /hivcontraceptionreports/1.json + def update + @hivcontraceptionreport = Hivcontraceptionreport.find(params[:id]) + + respond_to do |format| + if @hivcontraceptionreport.update_attributes(params[:hivcontraceptionreport]) + format.html { redirect_to @hivcontraceptionreport, notice: 'Hivcontraceptionreport was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @hivcontraceptionreport.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /hivcontraceptionreports/1 + # DELETE /hivcontraceptionreports/1.json + def destroy + @hivcontraceptionreport = Hivcontraceptionreport.find(params[:id]) + @hivcontraceptionreport.destroy + + respond_to do |format| + format.html { redirect_to hivcontraceptionreports_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/hivlocationreports_controller.rb b/app/controllers/hivlocationreports_controller.rb new file mode 100644 index 0000000..d7c351b --- /dev/null +++ b/app/controllers/hivlocationreports_controller.rb @@ -0,0 +1,108 @@ +class HivlocationreportsController < ApplicationController + # GET /hivlocationreports + # GET /hivlocationreports.json +layout "hivaid" + def index + @locations = Location.find(:all) + @drop_down_array = Array.new + + if(defined? params[:location][:id]) + @test = params[:location][:id] + @year = params[:date][:year] + if @test.empty? + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + else + @location_id = @test.to_i + @location_object = Location.find(@location_id) + @location_name = @location_object.name + end + else + #Basically this sets the default location + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + + end + + @predictorreports = Predictorreport.new + @predictorreports.drawLocationGraph(@location_name,@location_id,@year) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @hivlocationreports } + end + end + + # GET /hivlocationreports/1 + # GET /hivlocationreports/1.json + def show + @hivlocationreport = Hivlocationreport.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @hivlocationreport } + end + end + + # GET /hivlocationreports/new + # GET /hivlocationreports/new.json + def new + @hivlocationreport = Hivlocationreport.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @hivlocationreport } + end + end + + # GET /hivlocationreports/1/edit + def edit + @hivlocationreport = Hivlocationreport.find(params[:id]) + end + + # POST /hivlocationreports + # POST /hivlocationreports.json + def create + @hivlocationreport = Hivlocationreport.new(params[:hivlocationreport]) + + respond_to do |format| + if @hivlocationreport.save + format.html { redirect_to @hivlocationreport, notice: 'Hivlocationreport was successfully created.' } + format.json { render json: @hivlocationreport, status: :created, location: @hivlocationreport } + else + format.html { render action: "new" } + format.json { render json: @hivlocationreport.errors, status: :unprocessable_entity } + end + end + end + + # PUT /hivlocationreports/1 + # PUT /hivlocationreports/1.json + def update + @hivlocationreport = Hivlocationreport.find(params[:id]) + + respond_to do |format| + if @hivlocationreport.update_attributes(params[:hivlocationreport]) + format.html { redirect_to @hivlocationreport, notice: 'Hivlocationreport was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @hivlocationreport.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /hivlocationreports/1 + # DELETE /hivlocationreports/1.json + def destroy + @hivlocationreport = Hivlocationreport.find(params[:id]) + @hivlocationreport.destroy + + respond_to do |format| + format.html { redirect_to hivlocationreports_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/locationreports_controller.rb b/app/controllers/locationreports_controller.rb new file mode 100644 index 0000000..fdb7437 --- /dev/null +++ b/app/controllers/locationreports_controller.rb @@ -0,0 +1,113 @@ +class LocationreportsController < ApplicationController + # GET /locationreports + # GET /locationreports.json + +layout 'locations' + def index + @malarialocationreports = Malarialocationreport.new + @stuff = Malarialocationreport.new + @locations = Location.find(:all) + @drop_down_array = Array.new + + if(defined? params[:location][:id]) + @test = params[:location][:id] + @year = params[:date][:year] + if @test.empty? + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + else + @location_id = @test.to_i + @location_object = Location.find(@location_id) + @location_name = @location_object.name + end + else + #Basically this sets the default location + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + + end + + + + + + @malarialocationreports.drawLocationGraph(@location_name,@location_id,@year) + respond_to do |format| + format.html # index.html.erb + format.json { render json: @locationreports } + end + end + + # GET /locationreports/1 + # GET /locationreports/1.json + def show + @locationreport = Locationreport.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @locationreport } + end + end + + # GET /locationreports/new + # GET /locationreports/new.json + def new + @locationreport = Locationreport.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @locationreport } + end + end + + # GET /locationreports/1/edit + def edit + @locationreport = Locationreport.find(params[:id]) + end + + # POST /locationreports + # POST /locationreports.json + def create + @locationreport = Locationreport.new(params[:locationreport]) + + respond_to do |format| + if @locationreport.save + format.html { redirect_to @locationreport, notice: 'Locationreport was successfully created.' } + format.json { render json: @locationreport, status: :created, location: @locationreport } + else + format.html { render action: "new" } + format.json { render json: @locationreport.errors, status: :unprocessable_entity } + end + end + end + + # PUT /locationreports/1 + # PUT /locationreports/1.json + def update + @locationreport = Locationreport.find(params[:id]) + + respond_to do |format| + if @locationreport.update_attributes(params[:locationreport]) + format.html { redirect_to @locationreport, notice: 'Locationreport was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @locationreport.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /locationreports/1 + # DELETE /locationreports/1.json + def destroy + @locationreport = Locationreport.find(params[:id]) + @locationreport.destroy + + respond_to do |format| + format.html { redirect_to locationreports_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/locations_controller.rb b/app/controllers/locations_controller.rb new file mode 100644 index 0000000..259b5be --- /dev/null +++ b/app/controllers/locations_controller.rb @@ -0,0 +1,85 @@ +class LocationsController < ApplicationController + # GET /locations + # GET /locations.json + + layout "locations" + def index + @locations = Location.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @locations } + end + end + + # GET /locations/1 + # GET /locations/1.json + def show + @location = Location.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @location } + end + end + + # GET /locations/new + # GET /locations/new.json + def new + @location = Location.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @location } + end + end + + # GET /locations/1/edit + def edit + @location = Location.find(params[:id]) + end + + # POST /locations + # POST /locations.json + def create + @location = Location.new(params[:location]) + + respond_to do |format| + if @location.save + format.html { redirect_to @location, notice: 'Location was successfully created.' } + format.json { render json: @location, status: :created, location: @location } + else + format.html { render action: "new" } + format.json { render json: @location.errors, status: :unprocessable_entity } + end + end + end + + # PUT /locations/1 + # PUT /locations/1.json + def update + @location = Location.find(params[:id]) + + respond_to do |format| + if @location.update_attributes(params[:location]) + format.html { redirect_to @location, notice: 'Location was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @location.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /locations/1 + # DELETE /locations/1.json + def destroy + @location = Location.find(params[:id]) + @location.destroy + + respond_to do |format| + format.html { redirect_to locations_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/malaria_controller.rb b/app/controllers/malaria_controller.rb new file mode 100644 index 0000000..c90955a --- /dev/null +++ b/app/controllers/malaria_controller.rb @@ -0,0 +1,6 @@ +class MalariaController < ApplicationController + +def index +redirect_to malariacases_path +end +end diff --git a/app/controllers/malariacases_controller.rb b/app/controllers/malariacases_controller.rb new file mode 100644 index 0000000..ebea149 --- /dev/null +++ b/app/controllers/malariacases_controller.rb @@ -0,0 +1,101 @@ +class MalariacasesController < ApplicationController + # GET /malariacases + # GET /malariacases.json +layout "malaria" + def index + @malariacases = Malariacase.all + @locations = Villageworker.find(:all) + @drop_down_array = Array.new + + @locations.each do |location| + @loc = Array.new + @loc << location.firstname + @loc << location.id + @drop_down_array << @loc + end + respond_to do |format| + format.html # index.html.erb + format.json { render json: @malariacases } + end + end + + # GET /malariacases/1 + # GET /malariacases/1.json + def show + @malariacase = Malariacase.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @malariacase } + end + end + + # GET /malariacases/new + # GET /malariacases/new.json + def new + @malariacase = Malariacase.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @malariacase } + end + end + +#show malaria case report + +def showreport +respond_to do |format| +format.html +end +end + + + # GET /malariacases/1/edit + def edit + @malariacase = Malariacase.find(params[:id]) + end + + # POST /malariacases + # POST /malariacases.json + def create + @malariacase = Malariacase.new(params[:malariacase]) + + respond_to do |format| + if @malariacase.save + format.html { redirect_to @malariacase, notice: 'Malariacase was successfully created.' } + format.json { render json: @malariacase, status: :created, location: @malariacase } + else + format.html { render action: "new" } + format.json { render json: @malariacase.errors, status: :unprocessable_entity } + end + end + end + + # PUT /malariacases/1 + # PUT /malariacases/1.json + def update + @malariacase = Malariacase.find(params[:id]) + + respond_to do |format| + if @malariacase.update_attributes(params[:malariacase]) + format.html { redirect_to @malariacase, notice: 'Malariacase was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @malariacase.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /malariacases/1 + # DELETE /malariacases/1.json + def destroy + @malariacase = Malariacase.find(params[:id]) + @malariacase.destroy + + respond_to do |format| + format.html { redirect_to malariacases_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/malarialocationreports_controller.rb b/app/controllers/malarialocationreports_controller.rb new file mode 100644 index 0000000..c6a24a5 --- /dev/null +++ b/app/controllers/malarialocationreports_controller.rb @@ -0,0 +1,135 @@ +class MalarialocationreportsController < ApplicationController +layout "malaria" +# GET /malarialocationreports + # GET /malarialocationreports.json + def index + @malarialocationreports = Malarialocationreport.new + @stuff = Malarialocationreport.new + @locations = Location.find(:all) + @drop_down_array = Array.new + + if(defined? params[:location][:id]) + @test = params[:location][:id] + @year = params[:date][:year] + if @test.empty? + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + else + @location_id = @test.to_i + @location_object = Location.find(@location_id) + @location_name = @location_object.name + end + else + #Basically this sets the default location + @location_id = 1 + @location_object = Location.find(@location_id) + @location_name = @location_object.name + + end + + + + + + @malarialocationreports.drawLocationGraph(@location_name,@location_id,@year) + respond_to do |format| + format.html # index.html.erb + format.json { render json: @malarialocationreports } + end + end + + + + # GET /malarialocationreports/1 + # GET /malarialocationreports/1.json + def show + @malarialocationreport = Malarialocationreport.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @malarialocationreport } + end + end + + def show + @malarialocationreports = Malarialocationreport.all +drawGraph + respond_to do |format| + format.html # index.html.erb + format.json { render json: @malarialocationreports } + end + end + + # GET /malarialocationreports/1 + # GET /malarialocationreports/1.json + def show + @malarialocationreport = Malarialocationreport.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @malarialocationreport } + end + end + + + # GET /malarialocationreports/new + # GET /malarialocationreports/new.json + def new + @malarialocationreport = Malarialocationreport.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @malarialocationreport } + end + end + + # GET /malarialocationreports/1/edit + def edit + @malarialocationreport = Malarialocationreport.find(params[:id]) + end + + # POST /malarialocationreports + # POST /malarialocationreports.json + def create + @malarialocationreport = Malarialocationreport.new(params[:malarialocationreport]) + + respond_to do |format| + if @malarialocationreport.save + format.html { redirect_to @malarialocationreport, notice: 'Malarialocationreport was successfully created.' } + format.json { render json: @malarialocationreport, status: :created, location: @malarialocationreport } + else + format.html { render action: "new" } + format.json { render json: @malarialocationreport.errors, status: :unprocessable_entity } + end + end + end + + # PUT /malarialocationreports/1 + # PUT /malarialocationreports/1.json + def update + @malarialocationreport = Malarialocationreport.find(params[:id]) + + respond_to do |format| + if @malarialocationreport.update_attributes(params[:malarialocationreport]) + format.html { redirect_to @malarialocationreport, notice: 'Malarialocationreport was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @malarialocationreport.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /malarialocationreports/1 + # DELETE /malarialocationreports/1.json + def destroy + @malarialocationreport = Malarialocationreport.find(params[:id]) + @malarialocationreport.destroy + + respond_to do |format| + format.html { redirect_to malarialocationreports_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb new file mode 100644 index 0000000..1a31b0d --- /dev/null +++ b/app/controllers/members_controller.rb @@ -0,0 +1,83 @@ +class MembersController < ApplicationController + # GET /members + # GET /members.json + def index + @members = Member.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @members } + end + end + + # GET /members/1 + # GET /members/1.json + def show + @member = Member.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @member } + end + end + + # GET /members/new + # GET /members/new.json + def new + @member = Member.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @member } + end + end + + # GET /members/1/edit + def edit + @member = Member.find(params[:id]) + end + + # POST /members + # POST /members.json + def create + @member = Member.new(params[:member]) + + respond_to do |format| + if @member.save + format.html { redirect_to @member, notice: 'Member was successfully created.' } + format.json { render json: @member, status: :created, location: @member } + else + format.html { render action: "new" } + format.json { render json: @member.errors, status: :unprocessable_entity } + end + end + end + + # PUT /members/1 + # PUT /members/1.json + def update + @member = Member.find(params[:id]) + + respond_to do |format| + if @member.update_attributes(params[:member]) + format.html { redirect_to @member, notice: 'Member was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @member.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /members/1 + # DELETE /members/1.json + def destroy + @member = Member.find(params[:id]) + @member.destroy + + respond_to do |format| + format.html { redirect_to members_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb new file mode 100644 index 0000000..2f2cdfe --- /dev/null +++ b/app/controllers/messages_controller.rb @@ -0,0 +1,6 @@ +class MessagesController < ApplicationController +def create +Messages.new(params[:message]) +redirect_to :action => "index" +end +end diff --git a/app/controllers/nightattacks_controller.rb b/app/controllers/nightattacks_controller.rb new file mode 100644 index 0000000..2f028ab --- /dev/null +++ b/app/controllers/nightattacks_controller.rb @@ -0,0 +1,83 @@ +class NightattacksController < ApplicationController + # GET /nightattacks + # GET /nightattacks.json + def index + @nightattacks = Nightattack.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @nightattacks } + end + end + + # GET /nightattacks/1 + # GET /nightattacks/1.json + def show + @nightattack = Nightattack.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @nightattack } + end + end + + # GET /nightattacks/new + # GET /nightattacks/new.json + def new + @nightattack = Nightattack.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @nightattack } + end + end + + # GET /nightattacks/1/edit + def edit + @nightattack = Nightattack.find(params[:id]) + end + + # POST /nightattacks + # POST /nightattacks.json + def create + @nightattack = Nightattack.new(params[:nightattack]) + + respond_to do |format| + if @nightattack.save + format.html { redirect_to @nightattack, notice: 'Nightattack was successfully created.' } + format.json { render json: @nightattack, status: :created, location: @nightattack } + else + format.html { render action: "new" } + format.json { render json: @nightattack.errors, status: :unprocessable_entity } + end + end + end + + # PUT /nightattacks/1 + # PUT /nightattacks/1.json + def update + @nightattack = Nightattack.find(params[:id]) + + respond_to do |format| + if @nightattack.update_attributes(params[:nightattack]) + format.html { redirect_to @nightattack, notice: 'Nightattack was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @nightattack.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /nightattacks/1 + # DELETE /nightattacks/1.json + def destroy + @nightattack = Nightattack.find(params[:id]) + @nightattack.destroy + + respond_to do |format| + format.html { redirect_to nightattacks_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/roadcrimes_controller.rb b/app/controllers/roadcrimes_controller.rb new file mode 100644 index 0000000..0c5973a --- /dev/null +++ b/app/controllers/roadcrimes_controller.rb @@ -0,0 +1,84 @@ +class RoadcrimesController < ApplicationController + # GET /roadcrimes + # GET /roadcrimes.json +layout 'conflict' + def index + @roadcrimes = Roadcrime.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @roadcrimes } + end + end + + # GET /roadcrimes/1 + # GET /roadcrimes/1.json + def show + @roadcrime = Roadcrime.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @roadcrime } + end + end + + # GET /roadcrimes/new + # GET /roadcrimes/new.json + def new + @roadcrime = Roadcrime.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @roadcrime } + end + end + + # GET /roadcrimes/1/edit + def edit + @roadcrime = Roadcrime.find(params[:id]) + end + + # POST /roadcrimes + # POST /roadcrimes.json + def create + @roadcrime = Roadcrime.new(params[:roadcrime]) + + respond_to do |format| + if @roadcrime.save + format.html { redirect_to @roadcrime, notice: 'Roadcrime was successfully created.' } + format.json { render json: @roadcrime, status: :created, location: @roadcrime } + else + format.html { render action: "new" } + format.json { render json: @roadcrime.errors, status: :unprocessable_entity } + end + end + end + + # PUT /roadcrimes/1 + # PUT /roadcrimes/1.json + def update + @roadcrime = Roadcrime.find(params[:id]) + + respond_to do |format| + if @roadcrime.update_attributes(params[:roadcrime]) + format.html { redirect_to @roadcrime, notice: 'Roadcrime was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @roadcrime.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /roadcrimes/1 + # DELETE /roadcrimes/1.json + def destroy + @roadcrime = Roadcrime.find(params[:id]) + @roadcrime.destroy + + respond_to do |format| + format.html { redirect_to roadcrimes_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..2f67133 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,22 @@ +class SessionsController < ApplicationController +skip_before_filter :authorize + +def new +end + +def create + if user = User.authenticate(params[:name],params[:password]) + session[:user_id] = user.id + session[:user_name] = params[:name] + redirect_to admin_url + else + redirect_to login_url, :alert => "Invalid User/password combination" + end + + def destroy + session[:user_id] = nil + redirect_to store_url, :notice => "Logged out" + end +end +end + diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb new file mode 100644 index 0000000..fe0dea9 --- /dev/null +++ b/app/controllers/settings_controller.rb @@ -0,0 +1,6 @@ +class SettingsController < ApplicationController +layout "settings" +def index +redirect_to smsmessages_path +end +end diff --git a/app/controllers/sms_controller.rb b/app/controllers/sms_controller.rb new file mode 100644 index 0000000..e9e8abb --- /dev/null +++ b/app/controllers/sms_controller.rb @@ -0,0 +1,106 @@ +class SmsController < ApplicationController +skip_before_filter :authorize + +layout "settings" + + # GET /sms + # GET /sms.json + def index + @sms = Sm.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sms } + end + end + + # GET /sms/1 + # GET /sms/1.json + def show + @sm = Sm.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @sm } + end + end + + # GET /sms/new + # GET /sms/new.json + def new + @sm = Sm.new + @sm.phone =params[:phone] + @sm.text = params[:text] + @sm.save + #redirect_to @sm + + respond_to do |format| +format.all { render :text=>'Thank you, your request is being processed'} + end + end + + # when an sms is send we save it in the database then + # we analyse the sms + +def getsms + @new_sms = Sm.new + @new_sms.phone = params[:phone] + @new_sms.text = params[:text] + @new_sms.save + + respond_to do |format| + format.all {render :text=>'Thank you , Your sms has been received'} + end +end + + + # GET /sms/1/edit + def edit + @sm = Sm.find(params[:id]) + end + + # POST /sms + # POST /sms.json + def create + @sm = Sm.new + + + respond_to do |format| + if @sm.save + format.html { redirect_to @sm, notice: 'Sm was successfully created.' } + format.json { render json: @sm, status: :created, location: @sm } + else + format.html { render action: "new" } + format.json { render json: @sm.errors, status: :unprocessable_entity } + end + end + end + + # PUT /sms/1 + # PUT /sms/1.json + def update + @sm = Sm.find(params[:id]) + + respond_to do |format| + if @sm.update_attributes(params[:sm]) + format.html { redirect_to @sm, notice: 'Sm was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @sm.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /sms/1 + # DELETE /sms/1.json + def destroy + @sm = Sm.find(params[:id]) + @sm.destroy + + respond_to do |format| + format.html { redirect_to sms_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/smsmessages_controller.rb b/app/controllers/smsmessages_controller.rb new file mode 100644 index 0000000..90eed2a --- /dev/null +++ b/app/controllers/smsmessages_controller.rb @@ -0,0 +1,89 @@ +class SmsmessagesController < ApplicationController + # GET /smsmessages + # GET /smsmessages.json +skip_before_filter :authorize + +layout "settings" + def index + @smsmessages = Smsmessage.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @smsmessages } + end + end + + # GET /smsmessages/1 + # GET /smsmessages/1.json + def show + @smsmessage = Smsmessage.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @smsmessage } + end + end + + # GET /smsmessages/new + # GET /smsmessages/new.json + def new + @smsmessage = Smsmessage.new + + + #redirect_to @sm + + respond_to do |format| + format.all { render :text=>@smsmessage.render(params[:phone],params[:text])} + end + + end + + # GET /smsmessages/1/edit + def edit + @smsmessage = Smsmessage.find(params[:id]) + end + + # POST /smsmessages + # POST /smsmessages.json + def create + @smsmessage = Smsmessage.new(params[:smsmessage]) + + respond_to do |format| + if @smsmessage.save + format.html { redirect_to @smsmessage, notice: 'Smsmessage was successfully created.' } + format.json { render json: @smsmessage, status: :created, location: @smsmessage } + else + format.html { render action: "new" } + format.json { render json: @smsmessage.errors, status: :unprocessable_entity } + end + end + end + + # PUT /smsmessages/1 + # PUT /smsmessages/1.json + def update + @smsmessage = Smsmessage.find(params[:id]) + + respond_to do |format| + if @smsmessage.update_attributes(params[:smsmessage]) + format.html { redirect_to @smsmessage, notice: 'Smsmessage was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @smsmessage.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /smsmessages/1 + # DELETE /smsmessages/1.json + def destroy + @smsmessage = Smsmessage.find(params[:id]) + @smsmessage.destroy + + respond_to do |format| + format.html { redirect_to smsmessages_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/test_it_controller.rb b/app/controllers/test_it_controller.rb new file mode 100644 index 0000000..8d16563 --- /dev/null +++ b/app/controllers/test_it_controller.rb @@ -0,0 +1,15 @@ +class TestItController < ApplicationController + def index + @graph = open_flash_chart_object(600,300,"/test_it/graph_code") + end + + def graph_code + title = Title.new("MY TITLE") + bar = BarGlass.new + bar.set_values([1,2,3,4,5,6,7,8,9]) + chart = OpenFlashChart.new + chart.set_title(title) + chart.add_element(bar) + render :text => chart.to_s + end +end diff --git a/app/controllers/textmessage_controller.rb b/app/controllers/textmessage_controller.rb new file mode 100644 index 0000000..9e4988d --- /dev/null +++ b/app/controllers/textmessage_controller.rb @@ -0,0 +1,35 @@ +class TextmessageController < ApplicationController +skip_before_filter :authorize + + def new + @textmessage = TextMessage.new("Love","love") + @textmessage.text = params[:text] + @textmessage.phone = params[:phone] + @textmessage.save + + respond_to do |format| + format.all {render :text=>'Thank you! Your request is being processed'} + end + end + + + def index + @textmessage = TextMessage.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @textmessage } + end + + def show + @textmessage = TextMessage.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @textmessage } + end + end + + end + +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..0a9e1f8 --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,86 @@ +class UsersController < ApplicationController + # GET /users + # GET /users.json + +layout "settings" +skip_before_filter :authorize +def index + @users = User.order(:name) + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @users } + end + end + + # GET /users/1 + # GET /users/1.json + def show + @user = User.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @user } + end + end + + # GET /users/new + # GET /users/new.json + def new + @user = User.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @user } + end + end + + # GET /users/1/edit + def edit + @user = User.find(params[:id]) + end + + # POST /users + # POST /users.json + def create + @user = User.new(params[:user]) + + respond_to do |format| + if @user.save + format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' } + format.json { render json: @user, status: :created, location: @user } + else + format.html { render action: "new" } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # PUT /users/1 + # PUT /users/1.json + def update + @user = User.find(params[:id]) + + respond_to do |format| + if @user.update_attributes(params[:user]) + format.html { redirect_to users_url, notice: 'User {@user.name} was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /users/1 + # DELETE /users/1.json + def destroy + @user = User.find(params[:id]) + @user.destroy + + respond_to do |format| + format.html { redirect_to users_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb new file mode 100644 index 0000000..d5c6d35 --- /dev/null +++ b/app/helpers/admin_helper.rb @@ -0,0 +1,2 @@ +module AdminHelper +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/cattlethefts_helper.rb b/app/helpers/cattlethefts_helper.rb new file mode 100644 index 0000000..7ededf7 --- /dev/null +++ b/app/helpers/cattlethefts_helper.rb @@ -0,0 +1,2 @@ +module CattletheftsHelper +end diff --git a/app/helpers/childhealth_helper.rb b/app/helpers/childhealth_helper.rb new file mode 100644 index 0000000..fbfd316 --- /dev/null +++ b/app/helpers/childhealth_helper.rb @@ -0,0 +1,2 @@ +module ChildhealthHelper +end diff --git a/app/helpers/community_health_workers_helper.rb b/app/helpers/community_health_workers_helper.rb new file mode 100644 index 0000000..18d44b2 --- /dev/null +++ b/app/helpers/community_health_workers_helper.rb @@ -0,0 +1,2 @@ +module CommunityHealthWorkersHelper +end diff --git a/app/helpers/conflicts_helper.rb b/app/helpers/conflicts_helper.rb new file mode 100644 index 0000000..ffd5767 --- /dev/null +++ b/app/helpers/conflicts_helper.rb @@ -0,0 +1,2 @@ +module ConflictsHelper +end diff --git a/app/helpers/dotsmembers_helper.rb b/app/helpers/dotsmembers_helper.rb new file mode 100644 index 0000000..81c4440 --- /dev/null +++ b/app/helpers/dotsmembers_helper.rb @@ -0,0 +1,2 @@ +module DotsmembersHelper +end diff --git a/app/helpers/firearms_helper.rb b/app/helpers/firearms_helper.rb new file mode 100644 index 0000000..b782059 --- /dev/null +++ b/app/helpers/firearms_helper.rb @@ -0,0 +1,2 @@ +module FirearmsHelper +end diff --git a/app/helpers/hivaid_helper.rb b/app/helpers/hivaid_helper.rb new file mode 100644 index 0000000..9af9c2b --- /dev/null +++ b/app/helpers/hivaid_helper.rb @@ -0,0 +1,2 @@ +module HivaidHelper +end diff --git a/app/helpers/hivcases_helper.rb b/app/helpers/hivcases_helper.rb new file mode 100644 index 0000000..d8a08cf --- /dev/null +++ b/app/helpers/hivcases_helper.rb @@ -0,0 +1,2 @@ +module HivcasesHelper +end diff --git a/app/helpers/hivcontraceptionreports_helper.rb b/app/helpers/hivcontraceptionreports_helper.rb new file mode 100644 index 0000000..adfd1f1 --- /dev/null +++ b/app/helpers/hivcontraceptionreports_helper.rb @@ -0,0 +1,2 @@ +module HivcontraceptionreportsHelper +end diff --git a/app/helpers/hivdrugreports_helper.rb b/app/helpers/hivdrugreports_helper.rb new file mode 100644 index 0000000..c94af75 --- /dev/null +++ b/app/helpers/hivdrugreports_helper.rb @@ -0,0 +1,2 @@ +module HivdrugreportsHelper +end diff --git a/app/helpers/hivgenderreports_helper.rb b/app/helpers/hivgenderreports_helper.rb new file mode 100644 index 0000000..86a8ed8 --- /dev/null +++ b/app/helpers/hivgenderreports_helper.rb @@ -0,0 +1,2 @@ +module HivgenderreportsHelper +end diff --git a/app/helpers/hivlocationreports_helper.rb b/app/helpers/hivlocationreports_helper.rb new file mode 100644 index 0000000..f8b514e --- /dev/null +++ b/app/helpers/hivlocationreports_helper.rb @@ -0,0 +1,2 @@ +module HivlocationreportsHelper +end diff --git a/app/helpers/immunization_helper.rb b/app/helpers/immunization_helper.rb new file mode 100644 index 0000000..557e008 --- /dev/null +++ b/app/helpers/immunization_helper.rb @@ -0,0 +1,2 @@ +module ImmunizationHelper +end diff --git a/app/helpers/locationreports_helper.rb b/app/helpers/locationreports_helper.rb new file mode 100644 index 0000000..30698e7 --- /dev/null +++ b/app/helpers/locationreports_helper.rb @@ -0,0 +1,2 @@ +module LocationreportsHelper +end diff --git a/app/helpers/locations_helper.rb b/app/helpers/locations_helper.rb new file mode 100644 index 0000000..46f9428 --- /dev/null +++ b/app/helpers/locations_helper.rb @@ -0,0 +1,2 @@ +module LocationsHelper +end diff --git a/app/helpers/malaria_helper.rb b/app/helpers/malaria_helper.rb new file mode 100644 index 0000000..5baf21c --- /dev/null +++ b/app/helpers/malaria_helper.rb @@ -0,0 +1,2 @@ +module MalariaHelper +end diff --git a/app/helpers/malariacases_helper.rb b/app/helpers/malariacases_helper.rb new file mode 100644 index 0000000..efaef41 --- /dev/null +++ b/app/helpers/malariacases_helper.rb @@ -0,0 +1,2 @@ +module MalariacasesHelper +end diff --git a/app/helpers/malariagenderreports_helper.rb b/app/helpers/malariagenderreports_helper.rb new file mode 100644 index 0000000..e7a0c7a --- /dev/null +++ b/app/helpers/malariagenderreports_helper.rb @@ -0,0 +1,2 @@ +module MalariagenderreportsHelper +end diff --git a/app/helpers/malarialocationreports_helper.rb b/app/helpers/malarialocationreports_helper.rb new file mode 100644 index 0000000..beae6f2 --- /dev/null +++ b/app/helpers/malarialocationreports_helper.rb @@ -0,0 +1,2 @@ +module MalarialocationreportsHelper +end diff --git a/app/helpers/malariapreventationreports_helper.rb b/app/helpers/malariapreventationreports_helper.rb new file mode 100644 index 0000000..c447f96 --- /dev/null +++ b/app/helpers/malariapreventationreports_helper.rb @@ -0,0 +1,2 @@ +module MalariapreventationreportsHelper +end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb new file mode 100644 index 0000000..e3fa623 --- /dev/null +++ b/app/helpers/members_helper.rb @@ -0,0 +1,2 @@ +module MembersHelper +end diff --git a/app/helpers/nightattacks_helper.rb b/app/helpers/nightattacks_helper.rb new file mode 100644 index 0000000..12ef8d7 --- /dev/null +++ b/app/helpers/nightattacks_helper.rb @@ -0,0 +1,2 @@ +module NightattacksHelper +end diff --git a/app/helpers/patients_helper.rb b/app/helpers/patients_helper.rb new file mode 100644 index 0000000..e3835d0 --- /dev/null +++ b/app/helpers/patients_helper.rb @@ -0,0 +1,2 @@ +module PatientsHelper +end diff --git a/app/helpers/roadcrimes_helper.rb b/app/helpers/roadcrimes_helper.rb new file mode 100644 index 0000000..90d71ad --- /dev/null +++ b/app/helpers/roadcrimes_helper.rb @@ -0,0 +1,2 @@ +module RoadcrimesHelper +end diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb new file mode 100644 index 0000000..309f8b2 --- /dev/null +++ b/app/helpers/sessions_helper.rb @@ -0,0 +1,2 @@ +module SessionsHelper +end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb new file mode 100644 index 0000000..ffbedba --- /dev/null +++ b/app/helpers/settings_helper.rb @@ -0,0 +1,2 @@ +module SettingsHelper +end diff --git a/app/helpers/sms_helper.rb b/app/helpers/sms_helper.rb new file mode 100644 index 0000000..61cb239 --- /dev/null +++ b/app/helpers/sms_helper.rb @@ -0,0 +1,2 @@ +module SmsHelper +end diff --git a/app/helpers/smsmessages_helper.rb b/app/helpers/smsmessages_helper.rb new file mode 100644 index 0000000..5929ada --- /dev/null +++ b/app/helpers/smsmessages_helper.rb @@ -0,0 +1,2 @@ +module SmsmessagesHelper +end diff --git a/app/helpers/tb_helper.rb b/app/helpers/tb_helper.rb new file mode 100644 index 0000000..576044e --- /dev/null +++ b/app/helpers/tb_helper.rb @@ -0,0 +1,2 @@ +module TbHelper +end diff --git a/app/helpers/tbcases_helper.rb b/app/helpers/tbcases_helper.rb new file mode 100644 index 0000000..3426fb2 --- /dev/null +++ b/app/helpers/tbcases_helper.rb @@ -0,0 +1,2 @@ +module TbcasesHelper +end diff --git a/app/helpers/tbdotreports_helper.rb b/app/helpers/tbdotreports_helper.rb new file mode 100644 index 0000000..357d880 --- /dev/null +++ b/app/helpers/tbdotreports_helper.rb @@ -0,0 +1,2 @@ +module TbdotreportsHelper +end diff --git a/app/helpers/tblocationreports_helper.rb b/app/helpers/tblocationreports_helper.rb new file mode 100644 index 0000000..5b50eaf --- /dev/null +++ b/app/helpers/tblocationreports_helper.rb @@ -0,0 +1,2 @@ +module TblocationreportsHelper +end diff --git a/app/helpers/test_it_helper.rb b/app/helpers/test_it_helper.rb new file mode 100644 index 0000000..f14774f --- /dev/null +++ b/app/helpers/test_it_helper.rb @@ -0,0 +1,2 @@ +module TestItHelper +end diff --git a/app/helpers/textmessage_helper.rb b/app/helpers/textmessage_helper.rb new file mode 100644 index 0000000..feb9bad --- /dev/null +++ b/app/helpers/textmessage_helper.rb @@ -0,0 +1,2 @@ +module TextmessageHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/helpers/villageworkers_helper.rb b/app/helpers/villageworkers_helper.rb new file mode 100644 index 0000000..83548f0 --- /dev/null +++ b/app/helpers/villageworkers_helper.rb @@ -0,0 +1,2 @@ +module VillageworkersHelper +end diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/car.rb b/app/models/car.rb new file mode 100644 index 0000000..a8b2a0f --- /dev/null +++ b/app/models/car.rb @@ -0,0 +1,2 @@ +class Car < ActiveRecord::Base +end diff --git a/app/models/cattletheft.rb b/app/models/cattletheft.rb new file mode 100644 index 0000000..3bf5f34 --- /dev/null +++ b/app/models/cattletheft.rb @@ -0,0 +1,2 @@ +class Cattletheft < ActiveRecord::Base +end diff --git a/app/models/conflict.rb b/app/models/conflict.rb new file mode 100644 index 0000000..d3a1223 --- /dev/null +++ b/app/models/conflict.rb @@ -0,0 +1,2 @@ +class Conflict < ActiveRecord::Base +end diff --git a/app/models/firearm.rb b/app/models/firearm.rb new file mode 100644 index 0000000..0b71211 --- /dev/null +++ b/app/models/firearm.rb @@ -0,0 +1,2 @@ +class Firearm < ActiveRecord::Base +end diff --git a/app/models/hivlocationreport.rb b/app/models/hivlocationreport.rb new file mode 100644 index 0000000..a706ccd --- /dev/null +++ b/app/models/hivlocationreport.rb @@ -0,0 +1,11 @@ +require 'predictor/locationrpt' +class Hivlocationreport < ActiveRecord::Base + + +def drawLocationGraph(locationName,locationId,year) +@hiv_location_rpt = Hivlocationrpt.new +@hiv_location_rpt.executeCommand(locationName,locationId,year) #draw a graph with the title command +end + + +end diff --git a/app/models/location.rb b/app/models/location.rb new file mode 100644 index 0000000..a6388f6 --- /dev/null +++ b/app/models/location.rb @@ -0,0 +1,3 @@ +class Location < ActiveRecord::Base +has_many :villageworkers +end diff --git a/app/models/locationreport.rb b/app/models/locationreport.rb new file mode 100644 index 0000000..a8a051c --- /dev/null +++ b/app/models/locationreport.rb @@ -0,0 +1,2 @@ +class Locationreport < ActiveRecord::Base +end diff --git a/app/models/locations/genderrpt.rb b/app/models/locations/genderrpt.rb new file mode 100644 index 0000000..db22e20 --- /dev/null +++ b/app/models/locations/genderrpt.rb @@ -0,0 +1,32 @@ +class Genderrpt +#initialize the class with nothing +def initailize +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(title) + +# With more options now +g = Gruff::Pie.new('800x400') # Define a custom size +g.sort = false # Do NOT sort data based on values + +g.theme_pastel # Declare a theme from the presets available + +g.title = title + +g.data('Men', [5, 10, 24]) +g.data('Women', [15, 3, 10]) +g.labels = {0 => 'Last year', 1 => 'This year'} # Define labels for each of the "columns" in data + +g.write('app/assets/images/malaria_gender_report_pie.png') +end + +public +#Execute command to generate the graph +def executeCommand(title) + drawGenderReportGraph(title) +end + +end + + diff --git a/app/models/locations/locationrpt.rb b/app/models/locations/locationrpt.rb new file mode 100644 index 0000000..1e143bc --- /dev/null +++ b/app/models/locations/locationrpt.rb @@ -0,0 +1,77 @@ +class Locationrpt + +def initialize +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(locationName,locationId,year) +# Let's hack almost everything +g = Gruff::Pie.new # Define a custom size +g.theme_pastel +g.title = locationName + +if year == nil +@graph_title = "Location Report" +else +@graph_title = "Location Report for year "<< year +end + +#Count the number of malaria cases for january + +#January +january_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#February +february_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#March +march_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#April +april_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#May +may_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '2012' and location_id =#{locationId}" +#June +june_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#july +july_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#August +august_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#September +september_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#October +october_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'octomber' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#November +november_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#December +december_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" + + +@jan_malaria_cases = Malariacase.count_by_sql(january_sql) +@feb_malaria_cases = Malariacase.count_by_sql(february_sql) +@mar_malaria_cases = Malariacase.count_by_sql(march_sql) +@apr_malaria_cases = Malariacase.count_by_sql(april_sql) +@may_malaria_cases = Malariacase.count_by_sql(may_sql) +@jun_malaria_cases = Malariacase.count_by_sql(june_sql) +@jul_malaria_cases = Malariacase.count_by_sql(july_sql) +@aug_malaria_cases = Malariacase.count_by_sql(august_sql) +@sep_malaria_cases = Malariacase.count_by_sql(september_sql) +@oct_malaria_cases = Malariacase.count_by_sql(october_sql) +@nov_malaria_cases = Malariacase.count_by_sql(november_sql) +@dec_malaria_cases = Malariacase.count_by_sql(december_sql) + + +g.data 'Cattle rustling', 30 +g.data 'Road Crime', 30 +g.data 'Firearms', 30 + +g.write('app/assets/images/locations_report.png') +end + +public + +#Execute command to generate the graph +def executeCommand(locationName,locationId,year) + drawGenderReportGraph(locationName,locationId,year) +end + +end + + diff --git a/app/models/locations/malariaprocessor.rb b/app/models/locations/malariaprocessor.rb new file mode 100644 index 0000000..9a68c12 --- /dev/null +++ b/app/models/locations/malariaprocessor.rb @@ -0,0 +1,57 @@ +class Malariaprocessor +def initialize(createMalariaCommand) + +#Split the strings into individual substrings +@commands = createMalariaCommand.split(',') +end +#rpt malaria,[patientId] + +#Validate addition of malaria command +def validNewMalariaCommand? + if @commands.size < 2 + return false + elsif @commands[1].size <=0 + return false + end + return true +end +#validate if the patient Id send is valid i.e if it exists in the database +def invalidPatientId +@patients =Patient.where("patient_number =?",@commands[1]) + if @patients.size == 0 + return true + end +return false +end + +public +def executeCommand(malariacaseModel) + @newMalariaCase = malariacaseModel + #validate the patient command + if not validNewMalariaCommand? + return "To report a malaria case send sms command like this report malaria,patient id" + elsif invalidPatientId + return "invalid Patient Id" + else + + #get the patient who has the patient_number so that we can get the location of this patient + @patient_list = Patient.where("patient_number = ?",@commands[1]) + #Find the Patient Location from the community health worker's location this is vital for reporting + @community_worker_id = @patient_list[0].communityworker_id + + #Find a model that corresponds to this community health worker + @model_community_worker = Villageworker.find(@community_worker_id) + + + @newMalariaCase.date_diagnosed = Time.now + @newMalariaCase.location_id = @model_community_worker.location_id + @newMalariaCase.patient_number = @commands[1] + @newMalariaCase.save + + return "Thank you the malaria case has been reported" + end +end + +end + + diff --git a/app/models/locations/prevention.rb b/app/models/locations/prevention.rb new file mode 100644 index 0000000..fc6c0b3 --- /dev/null +++ b/app/models/locations/prevention.rb @@ -0,0 +1,30 @@ +class Preventionrpt +def initialize + +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(title) +##LINE GRAPH +g = Gruff::Line.new('900x500') #Define a New Graph +g.title = "Malaria Infections for year 2012" #Title for the Graph +g.theme_pastel # Declare a theme from the presets available + +g.data("Malaria Cases", [1, 2, 3, 4, 4, 3]) #Graph Data +g.data("Use of Mosquito Nets", [4, 8, 7, 9, 8, 9,5,6,3,4,2,4,2]) +g.data("Availability of Drugs", [2, 3, 1, 5, 6, 8,3,5,4,6,5,2]) + +g.labels = {0 => 'Jan', 1 => 'Feb', 2 => 'Mar', 3 => 'Apr', 4 => 'May', 5 => 'Jun', 6 => 'July', 7 => 'Aug', 8 => 'Sep', 9 => 'Oct', 10 => 'Nov', 11 => 'Dec'} #Labels for Each of the Graph + +g.write('app/assets/images/malaria_prevention_report_line.png') +end + +public +#Execute command to generate the graph +def executeCommand(title) + drawGenderReportGraph(title) +end + +end + + diff --git a/app/models/malariacase.rb b/app/models/malariacase.rb new file mode 100644 index 0000000..7add39a --- /dev/null +++ b/app/models/malariacase.rb @@ -0,0 +1,11 @@ +require 'locations/malariaprocessor' + +class Malariacase < ActiveRecord::Base +belongs_to :patients, :foreign_key => :patient_id, :class_name => "Patient" + +def executeSmsCommand(command) +@newmalariaCase = Malariaprocessor.new(command) +@newmalariaCase.executeCommand(self) +end + +end diff --git a/app/models/malarialocationreport.rb b/app/models/malarialocationreport.rb new file mode 100644 index 0000000..aace3ab --- /dev/null +++ b/app/models/malarialocationreport.rb @@ -0,0 +1,9 @@ +require 'locations/locationrpt' +class Malarialocationreport < ActiveRecord::Base + +def drawLocationGraph(location_name,location_id,year) +@malaria_location_rpt = Locationrpt.new +@malaria_location_rpt.executeCommand(location_name,location_id,year) #draw a graph with the title command +end + +end diff --git a/app/models/member.rb b/app/models/member.rb new file mode 100644 index 0000000..999bd44 --- /dev/null +++ b/app/models/member.rb @@ -0,0 +1,2 @@ +class Member < ActiveRecord::Base +end diff --git a/app/models/members/genderrpt.rb b/app/models/members/genderrpt.rb new file mode 100644 index 0000000..db22e20 --- /dev/null +++ b/app/models/members/genderrpt.rb @@ -0,0 +1,32 @@ +class Genderrpt +#initialize the class with nothing +def initailize +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(title) + +# With more options now +g = Gruff::Pie.new('800x400') # Define a custom size +g.sort = false # Do NOT sort data based on values + +g.theme_pastel # Declare a theme from the presets available + +g.title = title + +g.data('Men', [5, 10, 24]) +g.data('Women', [15, 3, 10]) +g.labels = {0 => 'Last year', 1 => 'This year'} # Define labels for each of the "columns" in data + +g.write('app/assets/images/malaria_gender_report_pie.png') +end + +public +#Execute command to generate the graph +def executeCommand(title) + drawGenderReportGraph(title) +end + +end + + diff --git a/app/models/members/locationrpt.rb b/app/models/members/locationrpt.rb new file mode 100644 index 0000000..1e143bc --- /dev/null +++ b/app/models/members/locationrpt.rb @@ -0,0 +1,77 @@ +class Locationrpt + +def initialize +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(locationName,locationId,year) +# Let's hack almost everything +g = Gruff::Pie.new # Define a custom size +g.theme_pastel +g.title = locationName + +if year == nil +@graph_title = "Location Report" +else +@graph_title = "Location Report for year "<< year +end + +#Count the number of malaria cases for january + +#January +january_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#February +february_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#March +march_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#April +april_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#May +may_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '2012' and location_id =#{locationId}" +#June +june_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#july +july_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#August +august_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#September +september_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#October +october_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'octomber' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#November +november_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#December +december_sql = "SELECT COUNT(*) from malariacases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" + + +@jan_malaria_cases = Malariacase.count_by_sql(january_sql) +@feb_malaria_cases = Malariacase.count_by_sql(february_sql) +@mar_malaria_cases = Malariacase.count_by_sql(march_sql) +@apr_malaria_cases = Malariacase.count_by_sql(april_sql) +@may_malaria_cases = Malariacase.count_by_sql(may_sql) +@jun_malaria_cases = Malariacase.count_by_sql(june_sql) +@jul_malaria_cases = Malariacase.count_by_sql(july_sql) +@aug_malaria_cases = Malariacase.count_by_sql(august_sql) +@sep_malaria_cases = Malariacase.count_by_sql(september_sql) +@oct_malaria_cases = Malariacase.count_by_sql(october_sql) +@nov_malaria_cases = Malariacase.count_by_sql(november_sql) +@dec_malaria_cases = Malariacase.count_by_sql(december_sql) + + +g.data 'Cattle rustling', 30 +g.data 'Road Crime', 30 +g.data 'Firearms', 30 + +g.write('app/assets/images/locations_report.png') +end + +public + +#Execute command to generate the graph +def executeCommand(locationName,locationId,year) + drawGenderReportGraph(locationName,locationId,year) +end + +end + + diff --git a/app/models/members/malariaprocessor.rb b/app/models/members/malariaprocessor.rb new file mode 100644 index 0000000..9a68c12 --- /dev/null +++ b/app/models/members/malariaprocessor.rb @@ -0,0 +1,57 @@ +class Malariaprocessor +def initialize(createMalariaCommand) + +#Split the strings into individual substrings +@commands = createMalariaCommand.split(',') +end +#rpt malaria,[patientId] + +#Validate addition of malaria command +def validNewMalariaCommand? + if @commands.size < 2 + return false + elsif @commands[1].size <=0 + return false + end + return true +end +#validate if the patient Id send is valid i.e if it exists in the database +def invalidPatientId +@patients =Patient.where("patient_number =?",@commands[1]) + if @patients.size == 0 + return true + end +return false +end + +public +def executeCommand(malariacaseModel) + @newMalariaCase = malariacaseModel + #validate the patient command + if not validNewMalariaCommand? + return "To report a malaria case send sms command like this report malaria,patient id" + elsif invalidPatientId + return "invalid Patient Id" + else + + #get the patient who has the patient_number so that we can get the location of this patient + @patient_list = Patient.where("patient_number = ?",@commands[1]) + #Find the Patient Location from the community health worker's location this is vital for reporting + @community_worker_id = @patient_list[0].communityworker_id + + #Find a model that corresponds to this community health worker + @model_community_worker = Villageworker.find(@community_worker_id) + + + @newMalariaCase.date_diagnosed = Time.now + @newMalariaCase.location_id = @model_community_worker.location_id + @newMalariaCase.patient_number = @commands[1] + @newMalariaCase.save + + return "Thank you the malaria case has been reported" + end +end + +end + + diff --git a/app/models/members/prevention.rb b/app/models/members/prevention.rb new file mode 100644 index 0000000..fc6c0b3 --- /dev/null +++ b/app/models/members/prevention.rb @@ -0,0 +1,30 @@ +class Preventionrpt +def initialize + +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(title) +##LINE GRAPH +g = Gruff::Line.new('900x500') #Define a New Graph +g.title = "Malaria Infections for year 2012" #Title for the Graph +g.theme_pastel # Declare a theme from the presets available + +g.data("Malaria Cases", [1, 2, 3, 4, 4, 3]) #Graph Data +g.data("Use of Mosquito Nets", [4, 8, 7, 9, 8, 9,5,6,3,4,2,4,2]) +g.data("Availability of Drugs", [2, 3, 1, 5, 6, 8,3,5,4,6,5,2]) + +g.labels = {0 => 'Jan', 1 => 'Feb', 2 => 'Mar', 3 => 'Apr', 4 => 'May', 5 => 'Jun', 6 => 'July', 7 => 'Aug', 8 => 'Sep', 9 => 'Oct', 10 => 'Nov', 11 => 'Dec'} #Labels for Each of the Graph + +g.write('app/assets/images/malaria_prevention_report_line.png') +end + +public +#Execute command to generate the graph +def executeCommand(title) + drawGenderReportGraph(title) +end + +end + + diff --git a/app/models/message.rb b/app/models/message.rb new file mode 100644 index 0000000..590e3e3 --- /dev/null +++ b/app/models/message.rb @@ -0,0 +1,2 @@ +class Message < ActiveRecord::Base +end diff --git a/app/models/messageparser.rb b/app/models/messageparser.rb new file mode 100644 index 0000000..b8a4c4d --- /dev/null +++ b/app/models/messageparser.rb @@ -0,0 +1,6 @@ +class Messageparser < ActiveRecord::Base + +def render +end + +end diff --git a/app/models/nightattack.rb b/app/models/nightattack.rb new file mode 100644 index 0000000..c276bcc --- /dev/null +++ b/app/models/nightattack.rb @@ -0,0 +1,2 @@ +class Nightattack < ActiveRecord::Base +end diff --git a/app/models/patient.rb b/app/models/patient.rb new file mode 100644 index 0000000..995cd0a --- /dev/null +++ b/app/models/patient.rb @@ -0,0 +1,14 @@ +require 'patients/patientprocessor' + +class Patient < ActiveRecord::Base + +has_many :malariacases +belongs_to :villageworker,:foreign_key => "communityworker_id" +belongs_to :location + +def executeSmsCommand(phone,smscommand) +@patientProcessor = Patientprocessor.new(phone,smscommand) +@patientProcessor.executeCommand(self) +end + +end diff --git a/app/models/predictor/hivprocessor.rb b/app/models/predictor/hivprocessor.rb new file mode 100644 index 0000000..c85de6a --- /dev/null +++ b/app/models/predictor/hivprocessor.rb @@ -0,0 +1,30 @@ +class Predictorprocessor +def initialize(rptHivCommand) + +#Split the strings into individual substrings +@commands = rptHivCommand.split(',') +end +#rpt hiv,[patientId] + +#Validate addition of malaria command +def validrptHivCommand? + if @commands.size < 2 + return false + elsif @commands[1].size <=0 + return false + elsif @commands[2].size <=0 + return false + elsif @commands[3].size <=0 + return false + end + return true +end + +public +def executeCommand(hivcaseModel) + +end + +end + + diff --git a/app/models/predictor/locationrpt.rb b/app/models/predictor/locationrpt.rb new file mode 100644 index 0000000..7893999 --- /dev/null +++ b/app/models/predictor/locationrpt.rb @@ -0,0 +1,85 @@ +class Hivlocationrpt + +def initialize +end + +#Method to draw the Gender Pie chart +def drawGenderReportGraph(locationName,locationId,year) + +#January +#Count the number of malaria cases for january + +#January +january_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'january' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#February +february_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'february' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#March +march_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'march' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#April +april_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'april' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#May +may_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'may' and Year(date_diagnosed) = '2012' and location_id =#{locationId}" +#June +june_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'june' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#july +july_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'july' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#August +august_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'august' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#September +september_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'september' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#October +october_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'octomber' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#November +november_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'november' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" +#December +december_sql = "SELECT COUNT(*) from hivcases where MonthName(date_diagnosed) = 'december' and Year(date_diagnosed) = '#{year}' and location_id =#{locationId}" + + +#@jan_hiv_cases = Hivcase.count_by_sql(january_sql) +#@feb_hiv_cases = Hivcase.count_by_sql(february_sql) +#@mar_hiv_cases = Hivcase.count_by_sql(march_sql) +#@apr_hiv_cases = Hivcase.count_by_sql(april_sql) +#@may_hiv_cases = Hivcase.count_by_sql(may_sql) +#@jun_hiv_cases = Hivcase.count_by_sql(june_sql) +#@jul_hiv_cases = Hivcase.count_by_sql(july_sql) +#@aug_hiv_cases = Hivcase.count_by_sql(august_sql) +#@sep_hiv_cases = Hivcase.count_by_sql(september_sql) +#@oct_hiv_cases = Hivcase.count_by_sql(october_sql) +#@nov_hiv_cases = Hivcase.count_by_sql(november_sql) +#@dec_hiv_cases = Hivcase.count_by_sql(december_sql) + +@jan_hiv_cases = 9 +@feb_hiv_cases = 9 +@mar_hiv_cases = 5 +@apr_hiv_cases = 65 +@may_hiv_cases = 3 +@jun_hiv_cases = 34 +@jul_hiv_cases = 5 +@aug_hiv_cases = 21 +@sep_hiv_cases = 23 +@oct_hiv_cases = 54 +@nov_hiv_cases = 65 +@dec_hiv_cases = 6 + + + +# Let's hack almost everything +g = Gruff::Line.new('900x500') # Define a custom size +g.theme_pastel +g.title = "Location Name:"+ locationName + +g.data " Distaster Prediction ", [@jan_hiv_cases, @feb_hiv_cases, @mar_hiv_cases, @apr_hiv_cases, @may_hiv_cases,@jun_hiv_cases,@jul_hiv_cases,@aug_hiv_cases,@sep_hiv_cases,@oct_hiv_cases,@nov_hiv_cases,@dec_hiv_cases] +g.labels = { 0 => "Jan", 1 => "Feb", 2 => "March", 3 => "April", 4 => "May", 5 => "June",6 => "July" , +7 => "Aug" ,8 => "Sept",9 => "Oct",10 => "Nov",11 => "Dec" } +g.write('app/assets/images/predictor_location_report.png') +end + +public +#Execute command to generate the graph +def executeCommand(locationName,locationId,year) + drawGenderReportGraph(locationName,locationId,year) +end + +end + + diff --git a/app/models/roadcrime.rb b/app/models/roadcrime.rb new file mode 100644 index 0000000..dc6b852 --- /dev/null +++ b/app/models/roadcrime.rb @@ -0,0 +1,2 @@ +class Roadcrime < ActiveRecord::Base +end diff --git a/app/models/sm.rb b/app/models/sm.rb new file mode 100644 index 0000000..05e3a3f --- /dev/null +++ b/app/models/sm.rb @@ -0,0 +1,5 @@ +class Sm < ActiveRecord::Base +def render +"Thank you , a new patient has been registered" +end +end diff --git a/app/models/smsmessage.rb b/app/models/smsmessage.rb new file mode 100644 index 0000000..bb6b069 --- /dev/null +++ b/app/models/smsmessage.rb @@ -0,0 +1,12 @@ +require 'textmessageparser/smsparser.rb' + +class Smsmessage < ActiveRecord::Base + + +def render(phone_number,message) +@smsparser = Textmessageparser.new(phone_number,message) +@smsparser.render +end + + +end diff --git a/app/models/tblocationreport.rb b/app/models/tblocationreport.rb new file mode 100644 index 0000000..5cb49d9 --- /dev/null +++ b/app/models/tblocationreport.rb @@ -0,0 +1,11 @@ +require 'tb/locationrpt' + +class Tblocationreport < ActiveRecord::Base + +def drawLocationGraph(locationName,locationId,year) +@tb_location_rpt = Tblocationrpt.new +@tb_location_rpt.executeCommand(locationName,locationId,year) #draw a graph with the title command +end + + +end diff --git a/app/models/text_message.rb b/app/models/text_message.rb new file mode 100644 index 0000000..1da3d9b --- /dev/null +++ b/app/models/text_message.rb @@ -0,0 +1,2 @@ +class TextMessage < ActiveRecord::Base +end diff --git a/app/models/textmessageparser/smsparser.rb b/app/models/textmessageparser/smsparser.rb new file mode 100644 index 0000000..d01d469 --- /dev/null +++ b/app/models/textmessageparser/smsparser.rb @@ -0,0 +1,72 @@ +class Textmessageparser + +def initialize(phone,message) + + +@phone_number = phone +@textmessage = message + +@textmessagerecord = Smsmessage.new +@textmessagerecord.phone = @phone_number +@textmessagerecord.message = @textmessage +@textmessagerecord.save + +#Split the strings into individual substrings +@commands = @textmessage.split(',') +@command = @commands[0].downcase #put in in lower case + +#this is the list of all the valid acceptable substrings +@start_commands = "rpt roadcrime,rpt cattletheft,rpt firearms,get alert" +@start_command_array = @start_commands.split(',') + +end + + +#render +def render +if @command == "rpt roadcrime" + + return "Thank you ! the case has been successfully reported." +elsif @command == "rpt cattletheft" + @numberStolen = @commands[1] + @dateReported = Date.now + @location = @commands[2] + + @cattlecrime = Cattletheft.new + @cattlecrime.numberstolen = @numberStolen + @cattlecrime.location = @location + @cattlecrime.save + + return "Thank you the Cattle theft case has been reported" + +elsif @command == "rpt firearms" + + return "Thank you Firearm case has been reported" +else + return "Unrecoginsed Command" +end + +end + + + +#Validate the start command +def validStartCommand +#Check if the command is valid +@start_command_array.each do |commands| +#convert to lowercase +commands = commands.downcase + +#if a match is found then return true +if @command == commands +return true +end +return false +end + +#if start command is not valid +false +end + + +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..151bf5b --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,47 @@ +require 'digest/sha2' + +class User < ActiveRecord::Base +validates :name, :presence => true, :uniqueness => true + +validates :password, :confirmation => true + +attr_accessor :password_confirmation +attr_reader :password + +validate :password_must_be_present + +class << self +def authenticate(name,password) +if user = find_by_name(name) +if user.hashed_password == encrypt_password(password,user.salt) +user +end +end +end + + +def encrypt_password(password,salt) +Digest::SHA2.hexdigest(password + "village" +salt) +end +end + +def password=(password) +@password = password + +if password.present? +generate_salt +self.hashed_password = self.class.encrypt_password(password,salt) +end +end + + +private + +def password_must_be_present +errors.add(:password, "Missing passwords") unless hashed_password.present? +end + +def generate_salt +self.salt = self.object_id.to_s + rand.to_s +end +end diff --git a/app/views/admin/_admin_menu.html.erb b/app/views/admin/_admin_menu.html.erb new file mode 100644 index 0000000..8988e42 --- /dev/null +++ b/app/views/admin/_admin_menu.html.erb @@ -0,0 +1,5 @@ + diff --git a/app/views/admin/_footer.html.erb b/app/views/admin/_footer.html.erb new file mode 100644 index 0000000..41c76eb --- /dev/null +++ b/app/views/admin/_footer.html.erb @@ -0,0 +1,6 @@ + + + + diff --git a/app/views/admin/_header.html.erb b/app/views/admin/_header.html.erb new file mode 100644 index 0000000..00de3ff --- /dev/null +++ b/app/views/admin/_header.html.erb @@ -0,0 +1,29 @@ + + + + Mtabiri : Predicting the next conflict + <%= stylesheet_link_tag "application", :media => "all" %> + <%= stylesheet_link_tag "style", :media => "all" %> + + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + +
+ + +
+ + + +
+<%= render "admin/menu" %> +
+ + diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb new file mode 100644 index 0000000..d6a1d64 --- /dev/null +++ b/app/views/admin/_menu.html.erb @@ -0,0 +1,8 @@ +
    +
  • <%= link_to 'Home', admin_path %>
  • +
  • <%= link_to 'Locations', locations_path %>
  • +
  • <%= link_to 'Members', members_path %>
  • +
  • <%= link_to 'Conflicts', conflicts_path %>
  • +
  • <%= link_to 'Settings', settings_path %>
  • +
+ diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb new file mode 100644 index 0000000..832e8f0 --- /dev/null +++ b/app/views/admin/index.html.erb @@ -0,0 +1,11 @@ +
+<%= form_tag "/hivlocationreports/" , :method => "get" do %> +<%= collection_select(:location,:id,@locations,:id,:name,options ={:prompt => "Select a Location"}) %> + + + <%= submit_tag "Predict" %> +<% end %> + +
+ +<%= image_tag("predictor_location_report.png",:alt => "Predictor Location Report") %> diff --git a/app/views/cattlethefts/_form.html.erb b/app/views/cattlethefts/_form.html.erb new file mode 100644 index 0000000..3a5cfd2 --- /dev/null +++ b/app/views/cattlethefts/_form.html.erb @@ -0,0 +1,29 @@ +<%= form_for(@cattletheft) do |f| %> + <% if @cattletheft.errors.any? %> +
+

<%= pluralize(@cattletheft.errors.count, "error") %> prohibited this cattletheft from being saved:

+ +
    + <% @cattletheft.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :numberstolen %>
+ <%= f.number_field :numberstolen %> +
+
+ <%= f.label :date_reported %>
+ <%= f.date_select :date_reported %> +
+
+ <%= f.label :location %>
+ <%= f.text_field :location %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/cattlethefts/edit.html.erb b/app/views/cattlethefts/edit.html.erb new file mode 100644 index 0000000..13326b9 --- /dev/null +++ b/app/views/cattlethefts/edit.html.erb @@ -0,0 +1,6 @@ +

Editing cattletheft

+ +<%= render 'form' %> + +<%= link_to 'Show', @cattletheft %> | +<%= link_to 'Back', cattlethefts_path %> diff --git a/app/views/cattlethefts/index.html.erb b/app/views/cattlethefts/index.html.erb new file mode 100644 index 0000000..df40572 --- /dev/null +++ b/app/views/cattlethefts/index.html.erb @@ -0,0 +1,26 @@ +

Showing Cattle Thefts

+ + + + + + + + + + + +<% @cattlethefts.each do |cattletheft| %> + + + + + + + + +<% end %> +
NumberstolenDate reportedLocation
<%= cattletheft.numberstolen %><%= cattletheft.date_reported %><%= cattletheft.location %><%= link_to 'Show', cattletheft %><%= link_to 'Edit', edit_cattletheft_path(cattletheft) %><%= link_to 'Destroy', cattletheft, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/cattlethefts/new.html.erb b/app/views/cattlethefts/new.html.erb new file mode 100644 index 0000000..80e3bb0 --- /dev/null +++ b/app/views/cattlethefts/new.html.erb @@ -0,0 +1,5 @@ +

New cattletheft

+ +<%= render 'form' %> + +<%= link_to 'Back', cattlethefts_path %> diff --git a/app/views/cattlethefts/show.html.erb b/app/views/cattlethefts/show.html.erb new file mode 100644 index 0000000..5d803c8 --- /dev/null +++ b/app/views/cattlethefts/show.html.erb @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Numberstolen: + <%= @cattletheft.numberstolen %> +

+ +

+ Date reported: + <%= @cattletheft.date_reported %> +

+ +

+ Location: + <%= @cattletheft.location %> +

+ + +<%= link_to 'Edit', edit_cattletheft_path(@cattletheft) %> | +<%= link_to 'Back', cattlethefts_path %> diff --git a/app/views/conflicts/_conflict_menu.html.erb b/app/views/conflicts/_conflict_menu.html.erb new file mode 100644 index 0000000..b2a8552 --- /dev/null +++ b/app/views/conflicts/_conflict_menu.html.erb @@ -0,0 +1,9 @@ + diff --git a/app/views/conflicts/_form.html.erb b/app/views/conflicts/_form.html.erb new file mode 100644 index 0000000..5966a4e --- /dev/null +++ b/app/views/conflicts/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@conflict) do |f| %> + <% if @conflict.errors.any? %> +
+

<%= pluralize(@conflict.errors.count, "error") %> prohibited this conflict from being saved:

+ +
    + <% @conflict.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/conflicts/edit.html.erb b/app/views/conflicts/edit.html.erb new file mode 100644 index 0000000..9e3baac --- /dev/null +++ b/app/views/conflicts/edit.html.erb @@ -0,0 +1,6 @@ +

Editing conflict

+ +<%= render 'form' %> + +<%= link_to 'Show', @conflict %> | +<%= link_to 'Back', conflicts_path %> diff --git a/app/views/conflicts/index.html.erb b/app/views/conflicts/index.html.erb new file mode 100644 index 0000000..99d5d49 --- /dev/null +++ b/app/views/conflicts/index.html.erb @@ -0,0 +1,21 @@ +

Listing conflicts

+ + + + + + + + +<% @conflicts.each do |conflict| %> + + + + + +<% end %> +
<%= link_to 'Show', conflict %><%= link_to 'Edit', edit_conflict_path(conflict) %><%= link_to 'Destroy', conflict, confirm: 'Are you sure?', method: :delete %>
+ +
+ +<%= link_to 'New Conflict', new_conflict_path %> diff --git a/app/views/conflicts/new.html.erb b/app/views/conflicts/new.html.erb new file mode 100644 index 0000000..d9ee30b --- /dev/null +++ b/app/views/conflicts/new.html.erb @@ -0,0 +1,5 @@ +

New conflict

+ +<%= render 'form' %> + +<%= link_to 'Back', conflicts_path %> diff --git a/app/views/conflicts/show.html.erb b/app/views/conflicts/show.html.erb new file mode 100644 index 0000000..6a7aa98 --- /dev/null +++ b/app/views/conflicts/show.html.erb @@ -0,0 +1,5 @@ +

<%= notice %>

+ + +<%= link_to 'Edit', edit_conflict_path(@conflict) %> | +<%= link_to 'Back', conflicts_path %> diff --git a/app/views/firearms/_form.html.erb b/app/views/firearms/_form.html.erb new file mode 100644 index 0000000..8a0dd69 --- /dev/null +++ b/app/views/firearms/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@firearm) do |f| %> + <% if @firearm.errors.any? %> +
+

<%= pluralize(@firearm.errors.count, "error") %> prohibited this firearm from being saved:

+ +
    + <% @firearm.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :location %>
+ <%= f.text_field :location %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/firearms/edit.html.erb b/app/views/firearms/edit.html.erb new file mode 100644 index 0000000..60adbbc --- /dev/null +++ b/app/views/firearms/edit.html.erb @@ -0,0 +1,6 @@ +

Editing firearm

+ +<%= render 'form' %> + +<%= link_to 'Show', @firearm %> | +<%= link_to 'Back', firearms_path %> diff --git a/app/views/firearms/index.html.erb b/app/views/firearms/index.html.erb new file mode 100644 index 0000000..972e1d6 --- /dev/null +++ b/app/views/firearms/index.html.erb @@ -0,0 +1,22 @@ +

Showing Firearms Cases

+ + + + + + + + + +<% @firearms.each do |firearm| %> + + + + + + +<% end %> +
Location
<%= firearm.location %><%= link_to 'Show', firearm %><%= link_to 'Edit', edit_firearm_path(firearm) %><%= link_to 'Destroy', firearm, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/firearms/new.html.erb b/app/views/firearms/new.html.erb new file mode 100644 index 0000000..86e65a3 --- /dev/null +++ b/app/views/firearms/new.html.erb @@ -0,0 +1,5 @@ +

New firearm

+ +<%= render 'form' %> + +<%= link_to 'Back', firearms_path %> diff --git a/app/views/firearms/show.html.erb b/app/views/firearms/show.html.erb new file mode 100644 index 0000000..a228e02 --- /dev/null +++ b/app/views/firearms/show.html.erb @@ -0,0 +1,10 @@ +

<%= notice %>

+ +

+ Location: + <%= @firearm.location %> +

+ + +<%= link_to 'Edit', edit_firearm_path(@firearm) %> | +<%= link_to 'Back', firearms_path %> diff --git a/app/views/hivlocationreports/_form.html.erb b/app/views/hivlocationreports/_form.html.erb new file mode 100644 index 0000000..b03e4e3 --- /dev/null +++ b/app/views/hivlocationreports/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@hivlocationreport) do |f| %> + <% if @hivlocationreport.errors.any? %> +
+

<%= pluralize(@hivlocationreport.errors.count, "error") %> prohibited this hivlocationreport from being saved:

+ +
    + <% @hivlocationreport.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/hivlocationreports/edit.html.erb b/app/views/hivlocationreports/edit.html.erb new file mode 100644 index 0000000..a86a520 --- /dev/null +++ b/app/views/hivlocationreports/edit.html.erb @@ -0,0 +1,6 @@ +

Editing hivlocationreport

+ +<%= render 'form' %> + +<%= link_to 'Show', @hivlocationreport %> | +<%= link_to 'Back', hivlocationreports_path %> diff --git a/app/views/hivlocationreports/index.html.erb b/app/views/hivlocationreports/index.html.erb new file mode 100644 index 0000000..b72eb50 --- /dev/null +++ b/app/views/hivlocationreports/index.html.erb @@ -0,0 +1,11 @@ +
+<%= form_tag "/hivlocationreports/" , :method => "get" do %> +<%= collection_select(:location,:id,@locations,:id,:name,options ={:prompt => "Select a Location"}) %> + +<%= select_year 2009 %> + <%= submit_tag "Generate Location Report" %> +<% end %> + +
+ +<%= image_tag("hiv_location_report_pie.png",:alt => "Hiv Location Report") %> diff --git a/app/views/hivlocationreports/new.html.erb b/app/views/hivlocationreports/new.html.erb new file mode 100644 index 0000000..7e94750 --- /dev/null +++ b/app/views/hivlocationreports/new.html.erb @@ -0,0 +1,5 @@ +

New hivlocationreport

+ +<%= render 'form' %> + +<%= link_to 'Back', hivlocationreports_path %> diff --git a/app/views/hivlocationreports/show.html.erb b/app/views/hivlocationreports/show.html.erb new file mode 100644 index 0000000..41ec09c --- /dev/null +++ b/app/views/hivlocationreports/show.html.erb @@ -0,0 +1,5 @@ +

<%= notice %>

+ + +<%= link_to 'Edit', edit_hivlocationreport_path(@hivlocationreport) %> | +<%= link_to 'Back', hivlocationreports_path %> diff --git a/app/views/layouts/.application.html.erb.swp b/app/views/layouts/.application.html.erb.swp new file mode 100644 index 0000000..8fe279d Binary files /dev/null and b/app/views/layouts/.application.html.erb.swp differ diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..325d61b --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,13 @@ +<%= render "admin/header" %> + +
+<%= render "admin/admin_menu" %> +
+ +
+<%= yield %> +
+ + + + diff --git a/app/views/layouts/childhealth.html.erb b/app/views/layouts/childhealth.html.erb new file mode 100644 index 0000000..0e10f0c --- /dev/null +++ b/app/views/layouts/childhealth.html.erb @@ -0,0 +1,11 @@ +<%= render "admin/header" %> + +
+<%= render "childhealth/childhealth_menu" %> +
+ +
+<%= yield %> +
+<%= render "admin/footer" %> + diff --git a/app/views/layouts/conflict.html.erb b/app/views/layouts/conflict.html.erb new file mode 100644 index 0000000..cd4b4b8 --- /dev/null +++ b/app/views/layouts/conflict.html.erb @@ -0,0 +1,18 @@ +<%= render "admin/header" %> + + +
+<%= render "conflicts/conflict_menu" %> +
+ +
+<%= yield %> + +
+ + + + + + + diff --git a/app/views/layouts/hivaid.html.erb b/app/views/layouts/hivaid.html.erb new file mode 100644 index 0000000..003fcae --- /dev/null +++ b/app/views/layouts/hivaid.html.erb @@ -0,0 +1,20 @@ +<%= render "admin/header" %> + +
+ + +
+<%= render "hivaid/hivaid_menu" %> +
+ +
+<%= yield %> + +
+ + + + + + + diff --git a/app/views/layouts/locations.html.erb b/app/views/layouts/locations.html.erb new file mode 100644 index 0000000..929db16 --- /dev/null +++ b/app/views/layouts/locations.html.erb @@ -0,0 +1,11 @@ +<%= render "admin/header" %> + +
+<%= render "locations/location_menu" %> +
+ +
+<%= yield %> +
+ + diff --git a/app/views/layouts/members.html.erb b/app/views/layouts/members.html.erb new file mode 100644 index 0000000..18842f6 --- /dev/null +++ b/app/views/layouts/members.html.erb @@ -0,0 +1,12 @@ +<%= render "admin/header" %> + +
+<%= render "members/members_menu" %> +
+ +
+<%= yield %> +
+ + + diff --git a/app/views/layouts/settings.html.erb b/app/views/layouts/settings.html.erb new file mode 100644 index 0000000..7fbaf74 --- /dev/null +++ b/app/views/layouts/settings.html.erb @@ -0,0 +1,12 @@ +<%= render "admin/header" %> + +
+<%= render "settings/settings_menu" %> +
+ +
+<%= yield %> +
+ + + diff --git a/app/views/layouts/tb.html.erb b/app/views/layouts/tb.html.erb new file mode 100644 index 0000000..0674790 --- /dev/null +++ b/app/views/layouts/tb.html.erb @@ -0,0 +1,12 @@ +<%= render "admin/header" %> + +
+<%= render "tb/tb_menu" %> +
+ +
+<%= yield %> +
+ + + diff --git a/app/views/locationreports/_form.html.erb b/app/views/locationreports/_form.html.erb new file mode 100644 index 0000000..e95c782 --- /dev/null +++ b/app/views/locationreports/_form.html.erb @@ -0,0 +1,21 @@ +<%= form_for(@locationreport) do |f| %> + <% if @locationreport.errors.any? %> +
+

<%= pluralize(@locationreport.errors.count, "error") %> prohibited this locationreport from being saved:

+ +
    + <% @locationreport.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :index %>
+ <%= f.text_field :index %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/locationreports/edit.html.erb b/app/views/locationreports/edit.html.erb new file mode 100644 index 0000000..0381234 --- /dev/null +++ b/app/views/locationreports/edit.html.erb @@ -0,0 +1,6 @@ +

Editing locationreport

+ +<%= render 'form' %> + +<%= link_to 'Show', @locationreport %> | +<%= link_to 'Back', locationreports_path %> diff --git a/app/views/locationreports/index.html.erb b/app/views/locationreports/index.html.erb new file mode 100644 index 0000000..984fb89 --- /dev/null +++ b/app/views/locationreports/index.html.erb @@ -0,0 +1,11 @@ +
+<%= form_tag "/ocationreports/" , :method => "get" do %> +<%= collection_select(:location,:id,@locations,:id,:name,options ={:prompt => "Select a Location"}) %> + +<%= select_year 2009 %> + <%= submit_tag "Generate Location" %> +<% end %> + +
+<%= image_tag("locations_report.png",:alt => "Isiolo Reporting") %> + diff --git a/app/views/locationreports/new.html.erb b/app/views/locationreports/new.html.erb new file mode 100644 index 0000000..5c2099c --- /dev/null +++ b/app/views/locationreports/new.html.erb @@ -0,0 +1,5 @@ +

New locationreport

+ +<%= render 'form' %> + +<%= link_to 'Back', locationreports_path %> diff --git a/app/views/locationreports/show.html.erb b/app/views/locationreports/show.html.erb new file mode 100644 index 0000000..a48b110 --- /dev/null +++ b/app/views/locationreports/show.html.erb @@ -0,0 +1,10 @@ +

<%= notice %>

+ +

+ Index: + <%= @locationreport.index %> +

+ + +<%= link_to 'Edit', edit_locationreport_path(@locationreport) %> | +<%= link_to 'Back', locationreports_path %> diff --git a/app/views/locations/_form.html.erb b/app/views/locations/_form.html.erb new file mode 100644 index 0000000..d884e20 --- /dev/null +++ b/app/views/locations/_form.html.erb @@ -0,0 +1,32 @@ +<%= form_for(@location) do |f| %> + <% if @location.errors.any? %> +
+

<%= pluralize(@location.errors.count, "error") %> prohibited this location from being saved:

+ +
    + <% @location.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :Name %>
+ <%= f.text_field :name %> +
+ + + +
+ <%= f.label :ward %>
+ <%= f.text_field :ward %> +
+
+ <%= f.label :country %>
+ <%= f.text_field :country %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/locations/_location_menu.html.erb b/app/views/locations/_location_menu.html.erb new file mode 100644 index 0000000..de6b733 --- /dev/null +++ b/app/views/locations/_location_menu.html.erb @@ -0,0 +1,7 @@ + diff --git a/app/views/locations/_smenu.html.erb b/app/views/locations/_smenu.html.erb new file mode 100644 index 0000000..4e73362 --- /dev/null +++ b/app/views/locations/_smenu.html.erb @@ -0,0 +1,2 @@ +
+
diff --git a/app/views/locations/edit.html.erb b/app/views/locations/edit.html.erb new file mode 100644 index 0000000..a961c01 --- /dev/null +++ b/app/views/locations/edit.html.erb @@ -0,0 +1,6 @@ +

Editing location

+ +<%= render 'form' %> + +<%= link_to 'Show', @location %> | +<%= link_to 'Back', locations_path %> diff --git a/app/views/locations/index.html.erb b/app/views/locations/index.html.erb new file mode 100644 index 0000000..7120b91 --- /dev/null +++ b/app/views/locations/index.html.erb @@ -0,0 +1,26 @@ +

Listing locations

+ + + + + + + + + + + +<% @locations.each do |location| %> + + + + + + + + +<% end %> +
NameWardCountry
<%= location.name %><%= location.ward %><%= location.country %><%= link_to 'Show', location %><%= link_to 'Edit', edit_location_path(location) %><%= link_to 'Destroy', location, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/locations/new.html.erb b/app/views/locations/new.html.erb new file mode 100644 index 0000000..103f3f5 --- /dev/null +++ b/app/views/locations/new.html.erb @@ -0,0 +1,5 @@ +

New location

+ +<%= render 'form' %> + + diff --git a/app/views/locations/show.html.erb b/app/views/locations/show.html.erb new file mode 100644 index 0000000..6fcbf16 --- /dev/null +++ b/app/views/locations/show.html.erb @@ -0,0 +1,20 @@ +

<%= notice %>

+ +

+ Name: + <%= @location.name %> +

+ +

+ Ward: + <%= @location.ward %> +

+ +

+ Country: + <%= @location.country %> +

+ + +<%= link_to 'Edit', edit_location_path(@location) %> | +<%= link_to 'Back', locations_path %> diff --git a/app/views/members/_form.html.erb b/app/views/members/_form.html.erb new file mode 100644 index 0000000..71aba6a --- /dev/null +++ b/app/views/members/_form.html.erb @@ -0,0 +1,41 @@ +<%= form_for(@member) do |f| %> + <% if @member.errors.any? %> +
+

<%= pluralize(@member.errors.count, "error") %> prohibited this member from being saved:

+ +
    + <% @member.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :firstname %>
+ <%= f.text_field :firstname %> +
+
+ <%= f.label :lastname %>
+ <%= f.text_field :lastname %> +
+
+ <%= f.label :age %>
+ <%= f.text_field :age %> +
+
+ <%= f.label :location %>
+ <%= f.text_field :location %> +
+
+ <%= f.label :nationalid %>
+ <%= f.text_field :nationalid %> +
+
+ <%= f.label :gender %>
+ <%= f.text_field :gender %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/members/_members_menu.html.erb b/app/views/members/_members_menu.html.erb new file mode 100644 index 0000000..81a443c --- /dev/null +++ b/app/views/members/_members_menu.html.erb @@ -0,0 +1,7 @@ + diff --git a/app/views/members/edit.html.erb b/app/views/members/edit.html.erb new file mode 100644 index 0000000..0534c54 --- /dev/null +++ b/app/views/members/edit.html.erb @@ -0,0 +1,6 @@ +

Editing member

+ +<%= render 'form' %> + +<%= link_to 'Show', @member %> | +<%= link_to 'Back', members_path %> diff --git a/app/views/members/index.html.erb b/app/views/members/index.html.erb new file mode 100644 index 0000000..32b5d6b --- /dev/null +++ b/app/views/members/index.html.erb @@ -0,0 +1,32 @@ +

Mtabiri Registered Members

+ + + + + + + + + + + + + + +<% @members.each do |member| %> + + + + + + + + + + + +<% end %> +
FirstnameLastnameAgeLocationNationalidGender
<%= member.firstname %><%= member.lastname %><%= member.age %><%= member.location %><%= member.nationalid %><%= member.gender %><%= link_to 'Show', member %><%= link_to 'Edit', edit_member_path(member) %><%= link_to 'Destroy', member, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/members/new.html.erb b/app/views/members/new.html.erb new file mode 100644 index 0000000..739fb12 --- /dev/null +++ b/app/views/members/new.html.erb @@ -0,0 +1,5 @@ +

New member

+ +<%= render 'form' %> + +<%= link_to 'Back', members_path %> diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb new file mode 100644 index 0000000..e7bd5dc --- /dev/null +++ b/app/views/members/show.html.erb @@ -0,0 +1,35 @@ +

<%= notice %>

+ +

+ Firstname: + <%= @member.firstname %> +

+ +

+ Lastname: + <%= @member.lastname %> +

+ +

+ Age: + <%= @member.age %> +

+ +

+ Location: + <%= @member.location %> +

+ +

+ Nationalid: + <%= @member.nationalid %> +

+ +

+ Gender: + <%= @member.gender %> +

+ + +<%= link_to 'Edit', edit_member_path(@member) %> | +<%= link_to 'Back', members_path %> diff --git a/app/views/nightattacks/_form.html.erb b/app/views/nightattacks/_form.html.erb new file mode 100644 index 0000000..e0d753a --- /dev/null +++ b/app/views/nightattacks/_form.html.erb @@ -0,0 +1,17 @@ +<%= form_for(@nightattack) do |f| %> + <% if @nightattack.errors.any? %> +
+

<%= pluralize(@nightattack.errors.count, "error") %> prohibited this nightattack from being saved:

+ +
    + <% @nightattack.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/nightattacks/edit.html.erb b/app/views/nightattacks/edit.html.erb new file mode 100644 index 0000000..abf6c16 --- /dev/null +++ b/app/views/nightattacks/edit.html.erb @@ -0,0 +1,6 @@ +

Editing nightattack

+ +<%= render 'form' %> + +<%= link_to 'Show', @nightattack %> | +<%= link_to 'Back', nightattacks_path %> diff --git a/app/views/nightattacks/index.html.erb b/app/views/nightattacks/index.html.erb new file mode 100644 index 0000000..4a5402c --- /dev/null +++ b/app/views/nightattacks/index.html.erb @@ -0,0 +1,21 @@ +

Listing nightattacks

+ + + + + + + + +<% @nightattacks.each do |nightattack| %> + + + + + +<% end %> +
<%= link_to 'Show', nightattack %><%= link_to 'Edit', edit_nightattack_path(nightattack) %><%= link_to 'Destroy', nightattack, confirm: 'Are you sure?', method: :delete %>
+ +
+ +<%= link_to 'New Nightattack', new_nightattack_path %> diff --git a/app/views/nightattacks/new.html.erb b/app/views/nightattacks/new.html.erb new file mode 100644 index 0000000..b31aefe --- /dev/null +++ b/app/views/nightattacks/new.html.erb @@ -0,0 +1,5 @@ +

New nightattack

+ +<%= render 'form' %> + +<%= link_to 'Back', nightattacks_path %> diff --git a/app/views/nightattacks/show.html.erb b/app/views/nightattacks/show.html.erb new file mode 100644 index 0000000..4cd2bf5 --- /dev/null +++ b/app/views/nightattacks/show.html.erb @@ -0,0 +1,5 @@ +

<%= notice %>

+ + +<%= link_to 'Edit', edit_nightattack_path(@nightattack) %> | +<%= link_to 'Back', nightattacks_path %> diff --git a/app/views/roadcrimes/_form.html.erb b/app/views/roadcrimes/_form.html.erb new file mode 100644 index 0000000..8ba8df1 --- /dev/null +++ b/app/views/roadcrimes/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@roadcrime) do |f| %> + <% if @roadcrime.errors.any? %> +
+

<%= pluralize(@roadcrime.errors.count, "error") %> prohibited this roadcrime from being saved:

+ +
    + <% @roadcrime.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :nationalid %>
+ <%= f.text_field :nationalid %> +
+
+ <%= f.label :location %>
+ <%= f.text_field :location %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/roadcrimes/edit.html.erb b/app/views/roadcrimes/edit.html.erb new file mode 100644 index 0000000..031cafd --- /dev/null +++ b/app/views/roadcrimes/edit.html.erb @@ -0,0 +1,6 @@ +

Editing roadcrime

+ +<%= render 'form' %> + +<%= link_to 'Show', @roadcrime %> | +<%= link_to 'Back', roadcrimes_path %> diff --git a/app/views/roadcrimes/index.html.erb b/app/views/roadcrimes/index.html.erb new file mode 100644 index 0000000..0e30e81 --- /dev/null +++ b/app/views/roadcrimes/index.html.erb @@ -0,0 +1,24 @@ +

Showing all RoadCrimes

+ + + + + + + + + + +<% @roadcrimes.each do |roadcrime| %> + + + + + + + +<% end %> +
NationalidLocation
<%= roadcrime.nationalid %><%= roadcrime.location %><%= link_to 'Show', roadcrime %><%= link_to 'Edit', edit_roadcrime_path(roadcrime) %><%= link_to 'Destroy', roadcrime, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/roadcrimes/new.html.erb b/app/views/roadcrimes/new.html.erb new file mode 100644 index 0000000..2992c6f --- /dev/null +++ b/app/views/roadcrimes/new.html.erb @@ -0,0 +1,5 @@ +

New roadcrime

+ +<%= render 'form' %> + +<%= link_to 'Back', roadcrimes_path %> diff --git a/app/views/roadcrimes/show.html.erb b/app/views/roadcrimes/show.html.erb new file mode 100644 index 0000000..c322dbf --- /dev/null +++ b/app/views/roadcrimes/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Nationalid: + <%= @roadcrime.nationalid %> +

+ +

+ Location: + <%= @roadcrime.location %> +

+ + +<%= link_to 'Edit', edit_roadcrime_path(@roadcrime) %> | +<%= link_to 'Back', roadcrimes_path %> diff --git a/app/views/sessions/_menu.html.erb b/app/views/sessions/_menu.html.erb new file mode 100644 index 0000000..f42c437 --- /dev/null +++ b/app/views/sessions/_menu.html.erb @@ -0,0 +1,9 @@ +
    +
  • <%= link_to 'Locations', locations_path %>
  • +
  • Malaria
  • +
  • HIV/Aids
  • +
  • TB
  • +
  • Report
  • +
  • Settings
  • +
+ diff --git a/app/views/sessions/create.html.erb b/app/views/sessions/create.html.erb new file mode 100644 index 0000000..c251174 --- /dev/null +++ b/app/views/sessions/create.html.erb @@ -0,0 +1,2 @@ +

Sessions#create

+

Find me in app/views/sessions/create.html.erb

diff --git a/app/views/sessions/destroy.html.erb b/app/views/sessions/destroy.html.erb new file mode 100644 index 0000000..d75237d --- /dev/null +++ b/app/views/sessions/destroy.html.erb @@ -0,0 +1,2 @@ +

Sessions#destroy

+

Find me in app/views/sessions/destroy.html.erb

diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..f107ec2 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,44 @@ +
+ <% if flash[:alert] %> +

<%= flash[:alert] %>

+ <% end %> + + <%= form_tag do %> +
+ Please Log In + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + +
+ + + <%= text_field_tag :name, params[:name] %> +
+ + + <%= password_field_tag :password, params[:password] %> +
+ <%= submit_tag "Login" %> +
+
+ <% end %> +
diff --git a/app/views/settings/_settings_menu.html.erb b/app/views/settings/_settings_menu.html.erb new file mode 100644 index 0000000..0cf9085 --- /dev/null +++ b/app/views/settings/_settings_menu.html.erb @@ -0,0 +1,7 @@ + diff --git a/app/views/settings/index.html.erb b/app/views/settings/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/sms/.new.html.erb.swp b/app/views/sms/.new.html.erb.swp new file mode 100644 index 0000000..6c6e05c Binary files /dev/null and b/app/views/sms/.new.html.erb.swp differ diff --git a/app/views/sms/_form.html.erb b/app/views/sms/_form.html.erb new file mode 100644 index 0000000..751dcec --- /dev/null +++ b/app/views/sms/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@sm) do |f| %> + <% if @sm.errors.any? %> +
+

<%= pluralize(@sm.errors.count, "error") %> prohibited this sm from being saved:

+ +
    + <% @sm.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :phone %>
+ <%= f.text_field :phone %> +
+
+ <%= f.label :text %>
+ <%= f.text_field :text %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/sms/_menu.html.erb b/app/views/sms/_menu.html.erb new file mode 100644 index 0000000..f42c437 --- /dev/null +++ b/app/views/sms/_menu.html.erb @@ -0,0 +1,9 @@ +
    +
  • <%= link_to 'Locations', locations_path %>
  • +
  • Malaria
  • +
  • HIV/Aids
  • +
  • TB
  • +
  • Report
  • +
  • Settings
  • +
+ diff --git a/app/views/sms/edit.html.erb b/app/views/sms/edit.html.erb new file mode 100644 index 0000000..e4485a6 --- /dev/null +++ b/app/views/sms/edit.html.erb @@ -0,0 +1,6 @@ +

Editing sm

+ +<%= render 'form' %> + +<%= link_to 'Show', @sm %> | +<%= link_to 'Back', sms_path %> diff --git a/app/views/sms/index.html.erb b/app/views/sms/index.html.erb new file mode 100644 index 0000000..81ace36 --- /dev/null +++ b/app/views/sms/index.html.erb @@ -0,0 +1,23 @@ +

Listing sms

+ + + + + + + + + + +<% @sms.each do |sm| %> + + + + + +<% end %> +
PhoneText
<%= sm.phone %><%= sm.text %><%= link_to 'Show', sm %>
+ +
+ + diff --git a/app/views/sms/new.html.erb b/app/views/sms/new.html.erb new file mode 100644 index 0000000..6260b48 --- /dev/null +++ b/app/views/sms/new.html.erb @@ -0,0 +1,5 @@ +

New sm

+ +<%= render 'form' %> + +<%= link_to 'Back', sms_path %> diff --git a/app/views/sms/show.html.erb b/app/views/sms/show.html.erb new file mode 100644 index 0000000..8f27770 --- /dev/null +++ b/app/views/sms/show.html.erb @@ -0,0 +1,17 @@ +

<%= notice %>

+ +

+ Phone: + <%= @sm.phone %> +

+ +

+ Text: + <%= @sm.text %> +

+ +

+ Created at : + +

+<%= link_to 'Back', sms_path %> diff --git a/app/views/smsmessages/_form.html.erb b/app/views/smsmessages/_form.html.erb new file mode 100644 index 0000000..73077a5 --- /dev/null +++ b/app/views/smsmessages/_form.html.erb @@ -0,0 +1,25 @@ +<%= form_for(@smsmessage) do |f| %> + <% if @smsmessage.errors.any? %> +
+

<%= pluralize(@smsmessage.errors.count, "error") %> prohibited this smsmessage from being saved:

+ +
    + <% @smsmessage.errors.full_messages.each do |msg| %> +
  • <%= msg %>
  • + <% end %> +
+
+ <% end %> + +
+ <%= f.label :phone %>
+ <%= f.text_field :phone %> +
+
+ <%= f.label :message %>
+ <%= f.text_area :message %> +
+
+ <%= f.submit %> +
+<% end %> diff --git a/app/views/smsmessages/edit.html.erb b/app/views/smsmessages/edit.html.erb new file mode 100644 index 0000000..d7a8e8f --- /dev/null +++ b/app/views/smsmessages/edit.html.erb @@ -0,0 +1,6 @@ +

Editing smsmessage

+ +<%= render 'form' %> + +<%= link_to 'Show', @smsmessage %> | +<%= link_to 'Back', smsmessages_path %> diff --git a/app/views/smsmessages/index.html.erb b/app/views/smsmessages/index.html.erb new file mode 100644 index 0000000..f7a2df0 --- /dev/null +++ b/app/views/smsmessages/index.html.erb @@ -0,0 +1,24 @@ +

Text Messages Received

+ + + + + + + + + + +<% @smsmessages.each do |smsmessage| %> + + + + + + + +<% end %> +
PhoneMessage
<%= smsmessage.phone %><%= smsmessage.message %><%= link_to 'Show', smsmessage %><%= link_to 'Edit', edit_smsmessage_path(smsmessage) %><%= link_to 'Destroy', smsmessage, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/smsmessages/new.html.erb b/app/views/smsmessages/new.html.erb new file mode 100644 index 0000000..5fccb59 --- /dev/null +++ b/app/views/smsmessages/new.html.erb @@ -0,0 +1,5 @@ +

New smsmessage

+ +<%= render 'form' %> + +<%= link_to 'Back', smsmessages_path %> diff --git a/app/views/smsmessages/show.html.erb b/app/views/smsmessages/show.html.erb new file mode 100644 index 0000000..e320277 --- /dev/null +++ b/app/views/smsmessages/show.html.erb @@ -0,0 +1,15 @@ +

<%= notice %>

+ +

+ Phone: + <%= @smsmessage.phone %> +

+ +

+ Message: + <%= @smsmessage.message %> +

+ + +<%= link_to 'Edit', edit_smsmessage_path(@smsmessage) %> | +<%= link_to 'Back', smsmessages_path %> diff --git a/app/views/test_it/index.html.erb b/app/views/test_it/index.html.erb new file mode 100644 index 0000000..2075562 --- /dev/null +++ b/app/views/test_it/index.html.erb @@ -0,0 +1,2 @@ + +<%= @graph %> diff --git a/app/views/textmessage/index.html.erb b/app/views/textmessage/index.html.erb new file mode 100644 index 0000000..8ae7fd8 --- /dev/null +++ b/app/views/textmessage/index.html.erb @@ -0,0 +1,23 @@ +

Listing sms

+ + + + + + + + + + +<% @textmessage.each do |sm| %> + + + + + +<% end %> +
PhoneText
<%= sm.phone %><%= sm.message %><%= link_to 'Show', sm %>
+ +
+ + diff --git a/app/views/textmessage/new.html.erb b/app/views/textmessage/new.html.erb new file mode 100644 index 0000000..15c57e3 --- /dev/null +++ b/app/views/textmessage/new.html.erb @@ -0,0 +1,2 @@ +

Textmessage#new

+

Find me in app/views/textmessage/new.html.erb

diff --git a/app/views/textmessage/show.html.erb b/app/views/textmessage/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/users/_form.html.erb b/app/views/users/_form.html.erb new file mode 100644 index 0000000..de3e950 --- /dev/null +++ b/app/views/users/_form.html.erb @@ -0,0 +1,34 @@ + diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb new file mode 100644 index 0000000..99bd4cc --- /dev/null +++ b/app/views/users/edit.html.erb @@ -0,0 +1,6 @@ +

Editing user

+ +<%= render 'form' %> + +<%= link_to 'Show', @user %> | +<%= link_to 'Back', users_path %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..9a797d6 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,22 @@ +

Listing users

+ + + + + + + + + +<% @users.each do |user| %> + + + + + + +<% end %> +
Name
<%= user.name %><%= link_to 'Show', user %><%= link_to 'Edit', edit_user_path(user) %><%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %>
+ +
+ diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb new file mode 100644 index 0000000..dc81d68 --- /dev/null +++ b/app/views/users/new.html.erb @@ -0,0 +1,5 @@ +

Add Authorized User

+ +<%= render 'form' %> + + diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..a8c175c --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,14 @@ +

<%= notice %>

+ +

+ Name: + <%= @user.name %> +

+ +

+ Date Created + <%= @user.created_at %> +

+ +<%= link_to 'Edit User Details', edit_user_path(@user) %> | + diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..10dee29 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Chw::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..b900e9e --- /dev/null +++ b/config/application.rb @@ -0,0 +1,59 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +if defined?(Bundler) + # If you precompile assets before deploying to production, use this line + Bundler.require(*Rails.groups(:assets => %w(development test))) + # If you want your assets lazily compiled in production, use this line + # Bundler.require(:default, :assets, Rails.env) +end + +module Chw + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Use SQL instead of Active Record's schema dumper when creating the database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Enforce whitelist mode for mass assignment. + # This will create an empty whitelist of attributes available for mass-assignment for all models + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible + # parameters by using an attr_accessible or attr_protected declaration. + # config.active_record.whitelist_attributes = true + + # Enable the asset pipeline + config.assets.enabled = true + + # Version of your assets, change this if you want to expire all your assets + config.assets.version = '1.0' + end +end diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..4489e58 --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,6 @@ +require 'rubygems' + +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) + +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/cucumber.yml b/config/cucumber.yml new file mode 100644 index 0000000..19b288d --- /dev/null +++ b/config/cucumber.yml @@ -0,0 +1,8 @@ +<% +rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" +rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" +std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" +%> +default: <%= std_opts %> features +wip: --tags @wip:3 --wip features +rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..a0b453d --- /dev/null +++ b/config/database.yml @@ -0,0 +1,45 @@ +# MySQL. Versions 4.1 and 5.0 are recommended. +# +# Install the MYSQL driver +# gem install mysql2 +# +# Ensure the MySQL gem is defined in your Gemfile +# gem 'mysql2' +# +# And be sure to use new-style password hashing: +# http://dev.mysql.com/doc/refman/5.0/en/old-client.html +development: + adapter: mysql2 + encoding: utf8 + reconnect: false + database: mtabiri_development + pool: 5 + username: root + password: + socket: /var/run/mysqld/mysqld.sock + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: &test + adapter: mysql2 + encoding: utf8 + reconnect: false + database: mtabiri_test + pool: 5 + username: root + password: + socket: /var/run/mysqld/mysqld.sock + +production: + adapter: mysql2 + encoding: utf8 + reconnect: false + database: mtabiri_production + pool: 5 + username: root + password: + socket: /var/run/mysqld/mysqld.sock + +cucumber: + <<: *test diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..a2cd675 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the rails application +require File.expand_path('../application', __FILE__) + +# Initialize the rails application +Chw::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..703e68b --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,37 @@ +Chw::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..1576826 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,67 @@ +Chw::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # Code is not reloaded between requests + config.cache_classes = true + + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true + + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = false + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH + + # Specifies the header that your server uses for sending files + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true + + # See everything in the log (default is :info) + # config.log_level = :debug + + # Prepend all log lines with the following tags + # config.log_tags = [ :subdomain, :uuid ] + + # Use a different logger for distributed setups + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + # config.action_mailer.raise_delivery_errors = false + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + # config.active_record.auto_explain_threshold_in_seconds = 0.5 +end diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..8c4bd9e --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,37 @@ +Chw::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb new file mode 100644 index 0000000..59385cd --- /dev/null +++ b/config/initializers/backtrace_silencers.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. +# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } + +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. +# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..5d8d9be --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,15 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb new file mode 100644 index 0000000..72aca7e --- /dev/null +++ b/config/initializers/mime_types.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Add new mime types for use in respond_to blocks: +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..0ff442f --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Chw::Application.config.secret_token = '94acab26916c899b4511a8db5d3f19deabc9b9fc3537b76925b966e4cc9b76735bed42b7480191aaf39eac6c544f7652f0318106076ce8d1a8581593363a9272' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..b716de6 --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +Chw::Application.config.session_store :cookie_store, key: '_chw_session' + +# Use the database for sessions instead of the cookie-based default, +# which shouldn't be used to store highly confidential information +# (create the session table with "rails generate session_migration") +# Chw::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..999df20 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..179c14c --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,5 @@ +# Sample localization file for English. Add more files in this directory for other locales. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. + +en: + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..605c17b --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,138 @@ +Chw::Application.routes.draw do + resources :cattlethefts + + resources :roadcrimes + + resources :firearms + + resources :nightattacks + + resources :locationreports + + resources :conflicts + + resources :members + + resources :tblocationreports + + resources :tbdotreports + + resources :dotsmembers + + resources :tbcases + + resources :hivdrugreports + + resources :hivcontraceptionreports + + resources :hivlocationreports + + resources :hivgenderreports + + resources :hivcases + + resources :malariapreventationreports + + resources :malariagenderreports + + resources :malarialocationreports + + resources :patients + + resources :malariacases + + resources :smsmessages + +resources :locations +resources :settings +resources :villageworkers +resources :malaria +resources :tb +resources :hivaid +resources :childhealth +resources :immunization +resources :test_it + +resources :communityhealthworker +get "textmessage/new" +resources :communityworkers + +resources :sms + +get 'admin' => 'admin#index' +get 'lol' => 'session#create' + +resources :messages + +controller :textmessage do +get 'textmessage' => :show +end + +controller :sessions do + get 'login' => :new + post 'login' => :create + delete 'logout' => :destroy + end +resources :users + + + + + + # The priority is based upon order of creation: + # first created -> highest priority. + + # Sample of regular route: + # match 'products/:id' => 'catalog#view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # resources :products + + # Sample resource route with options: + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end + + # Sample resource route with sub-resources: + # resources :products do + # resources :comments, :sales + # resource :seller + # end + + # Sample resource route with more complex sub-resources + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end + # end + + # Sample resource route within a namespace: + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + root :to => 'admin#index' + + # See how all your routes lay out with "rake routes" + + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + # match ':controller(/:action(/:id))(.:format)' +end diff --git a/db/migrate/20120421190808_create_users.rb b/db/migrate/20120421190808_create_users.rb new file mode 100644 index 0000000..015f132 --- /dev/null +++ b/db/migrate/20120421190808_create_users.rb @@ -0,0 +1,11 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :hashed_password + t.string :salt + + t.timestamps + end + end +end diff --git a/db/migrate/20120422074810_create_sms.rb b/db/migrate/20120422074810_create_sms.rb new file mode 100644 index 0000000..992d72b --- /dev/null +++ b/db/migrate/20120422074810_create_sms.rb @@ -0,0 +1,10 @@ +class CreateSms < ActiveRecord::Migration + def change + create_table :sms do |t| + t.string :phone + t.string :text + + t.timestamps + end + end +end diff --git a/db/migrate/20120426095425_create_text_messages.rb b/db/migrate/20120426095425_create_text_messages.rb new file mode 100644 index 0000000..48cc2dd --- /dev/null +++ b/db/migrate/20120426095425_create_text_messages.rb @@ -0,0 +1,10 @@ +class CreateTextMessages < ActiveRecord::Migration + def change + create_table :text_messages do |t| + t.string :phone + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20120427214610_create_messages.rb b/db/migrate/20120427214610_create_messages.rb new file mode 100644 index 0000000..fb085a4 --- /dev/null +++ b/db/migrate/20120427214610_create_messages.rb @@ -0,0 +1,8 @@ +class CreateMessages < ActiveRecord::Migration + def change + create_table :messages do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120428093947_create_villages.rb b/db/migrate/20120428093947_create_villages.rb new file mode 100644 index 0000000..4f3bc23 --- /dev/null +++ b/db/migrate/20120428093947_create_villages.rb @@ -0,0 +1,11 @@ +class CreateVillages < ActiveRecord::Migration + def change + create_table :villages do |t| + t.string :name + t.string :ward + t.string :county + + t.timestamps + end + end +end diff --git a/db/migrate/20120428220443_create_locations.rb b/db/migrate/20120428220443_create_locations.rb new file mode 100644 index 0000000..ee4312e --- /dev/null +++ b/db/migrate/20120428220443_create_locations.rb @@ -0,0 +1,11 @@ +class CreateLocations < ActiveRecord::Migration + def change + create_table :locations do |t| + t.string :name + t.string :ward + t.string :country + + t.timestamps + end + end +end diff --git a/db/migrate/20120501124434_create_messageparsers.rb b/db/migrate/20120501124434_create_messageparsers.rb new file mode 100644 index 0000000..a9b7878 --- /dev/null +++ b/db/migrate/20120501124434_create_messageparsers.rb @@ -0,0 +1,10 @@ +class CreateMessageparsers < ActiveRecord::Migration + def change + create_table :messageparsers do |t| + t.string :phonenumber + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20120501144129_create_smsmessages.rb b/db/migrate/20120501144129_create_smsmessages.rb new file mode 100644 index 0000000..f7abbc9 --- /dev/null +++ b/db/migrate/20120501144129_create_smsmessages.rb @@ -0,0 +1,10 @@ +class CreateSmsmessages < ActiveRecord::Migration + def change + create_table :smsmessages do |t| + t.string :phone + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20120506092650_create_malarialocationreports.rb b/db/migrate/20120506092650_create_malarialocationreports.rb new file mode 100644 index 0000000..c74bf02 --- /dev/null +++ b/db/migrate/20120506092650_create_malarialocationreports.rb @@ -0,0 +1,8 @@ +class CreateMalarialocationreports < ActiveRecord::Migration + def change + create_table :malarialocationreports do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120507212628_create_hivlocationreports.rb b/db/migrate/20120507212628_create_hivlocationreports.rb new file mode 100644 index 0000000..4d8ca62 --- /dev/null +++ b/db/migrate/20120507212628_create_hivlocationreports.rb @@ -0,0 +1,8 @@ +class CreateHivlocationreports < ActiveRecord::Migration + def change + create_table :hivlocationreports do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120509133658_create_tblocationreports.rb b/db/migrate/20120509133658_create_tblocationreports.rb new file mode 100644 index 0000000..e04d7c3 --- /dev/null +++ b/db/migrate/20120509133658_create_tblocationreports.rb @@ -0,0 +1,8 @@ +class CreateTblocationreports < ActiveRecord::Migration + def change + create_table :tblocationreports do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120603031747_create_members.rb b/db/migrate/20120603031747_create_members.rb new file mode 100644 index 0000000..e25d3d1 --- /dev/null +++ b/db/migrate/20120603031747_create_members.rb @@ -0,0 +1,14 @@ +class CreateMembers < ActiveRecord::Migration + def change + create_table :members do |t| + t.string :firstname + t.string :lastname + t.integer :age + t.integer :location + t.string :nationalid + t.string :gender + + t.timestamps + end + end +end diff --git a/db/migrate/20120603034210_create_conflicts.rb b/db/migrate/20120603034210_create_conflicts.rb new file mode 100644 index 0000000..988eba8 --- /dev/null +++ b/db/migrate/20120603034210_create_conflicts.rb @@ -0,0 +1,8 @@ +class CreateConflicts < ActiveRecord::Migration + def change + create_table :conflicts do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120603042805_create_locationreports.rb b/db/migrate/20120603042805_create_locationreports.rb new file mode 100644 index 0000000..b101f5b --- /dev/null +++ b/db/migrate/20120603042805_create_locationreports.rb @@ -0,0 +1,9 @@ +class CreateLocationreports < ActiveRecord::Migration + def change + create_table :locationreports do |t| + t.string :index + + t.timestamps + end + end +end diff --git a/db/migrate/20120603043237_create_nightattacks.rb b/db/migrate/20120603043237_create_nightattacks.rb new file mode 100644 index 0000000..24cbbf7 --- /dev/null +++ b/db/migrate/20120603043237_create_nightattacks.rb @@ -0,0 +1,8 @@ +class CreateNightattacks < ActiveRecord::Migration + def change + create_table :nightattacks do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20120603052915_create_firearms.rb b/db/migrate/20120603052915_create_firearms.rb new file mode 100644 index 0000000..f98ed1f --- /dev/null +++ b/db/migrate/20120603052915_create_firearms.rb @@ -0,0 +1,9 @@ +class CreateFirearms < ActiveRecord::Migration + def change + create_table :firearms do |t| + t.string :location + + t.timestamps + end + end +end diff --git a/db/migrate/20120603054553_create_roadcrimes.rb b/db/migrate/20120603054553_create_roadcrimes.rb new file mode 100644 index 0000000..093bad1 --- /dev/null +++ b/db/migrate/20120603054553_create_roadcrimes.rb @@ -0,0 +1,10 @@ +class CreateRoadcrimes < ActiveRecord::Migration + def change + create_table :roadcrimes do |t| + t.string :nationalid + t.string :location + + t.timestamps + end + end +end diff --git a/db/migrate/20120603083702_create_cattlethefts.rb b/db/migrate/20120603083702_create_cattlethefts.rb new file mode 100644 index 0000000..a0e3401 --- /dev/null +++ b/db/migrate/20120603083702_create_cattlethefts.rb @@ -0,0 +1,11 @@ +class CreateCattlethefts < ActiveRecord::Migration + def change + create_table :cattlethefts do |t| + t.integer :numberstolen + t.date :date_reported + t.string :location + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..7e249ef --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,260 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20120603054553) do + + create_table "cars", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "cattlethefts", :force => true do |t| + t.integer "numberstolen" + t.string "location" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "community_health_workers", :force => true do |t| + t.string "firstname" + t.string "lastname" + t.string "middlename" + t.string "phonenumber" + t.string "nationalid" + t.string "gender" + t.integer "village" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "conflict_reports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "conflictreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "conflictreps", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "conflicts", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "dotsmembers", :force => true do |t| + t.date "date_reported" + t.string "patient_number" + t.string "patient_phone" + t.string "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "firearms", :force => true do |t| + t.string "location" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "hivcases", :force => true do |t| + t.date "date_diagnosed" + t.string "patient_number" + t.string "availability_of_contraceptives" + t.string "availability_of_drugs" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "location_id" + end + + create_table "hivcontraceptionreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "hivdrugreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "hivgenderreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "hivlocationreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "locationreports", :force => true do |t| + t.string "index" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "locations", :force => true do |t| + t.string "name" + t.string "ward" + t.string "country" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "malariacases", :force => true do |t| + t.integer "patient_id" + t.date "date_diagnosed" + t.integer "communityworker_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "patient_number" + t.integer "location_id" + end + + create_table "malariagenderreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "malarialocationreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "malariapreventationreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "members", :force => true do |t| + t.string "firstname" + t.string "lastname" + t.integer "age" + t.integer "location" + t.string "nationalid" + t.string "gender" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messageparsers", :force => true do |t| + t.string "phonenumber" + t.text "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "messages", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "nightattacks", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "patients", :force => true do |t| + t.string "firstname" + t.string "middlename" + t.string "lastname" + t.date "year_of_birth" + t.integer "communityworker_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.date "date_added" + t.string "patient_number" + end + + create_table "roadcrimes", :force => true do |t| + t.string "nationalid" + t.string "location" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "sms", :force => true do |t| + t.string "phone" + t.string "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "smsmessages", :force => true do |t| + t.string "phone" + t.text "message" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "tbcases", :force => true do |t| + t.date "date_reported" + t.string "patient_number" + t.string "availability_of_drugs" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "location_id" + end + + create_table "tbdotreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "tblocationreports", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "text_messages", :force => true do |t| + t.string "phone" + t.text "text" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "name" + t.string "hashed_password" + t.string "salt" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "villages", :force => true do |t| + t.string "name" + t.string "ward" + t.string "county" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "villageworkers", :force => true do |t| + t.string "firstname" + t.string "lastname" + t.string "middlename" + t.string "phonenumber" + t.string "nationalid" + t.string "male" + t.integer "village" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "location_id" + end + +end diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..4edb1e8 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) +# Mayor.create(name: 'Emanuel', city: cities.first) diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP new file mode 100644 index 0000000..fe41f5c --- /dev/null +++ b/doc/README_FOR_APP @@ -0,0 +1,2 @@ +Use this README file to introduce your application and point to useful places in the API for learning more. +Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/features/new_patient_sms_create.feature b/features/new_patient_sms_create.feature new file mode 100644 index 0000000..015fea2 --- /dev/null +++ b/features/new_patient_sms_create.feature @@ -0,0 +1,15 @@ +Feature: Register new patient through sms + +In Order to register New Patient through SMS +As a community Health Worker +I want to be able to send details of the patient using text message +And get a message telling me about the patient new ID + +Scenario: Sucessfull Patient Registration + +Given the a registered Community Health Worker phone-number is "+254714136136" +When I receive text "New Patient,John M Doe,M,1978" as text message +Then a New Patient should be added to the database + + + diff --git a/features/step_definitions/.add_new_chw_steps.rb.swp b/features/step_definitions/.add_new_chw_steps.rb.swp new file mode 100644 index 0000000..a5a430c Binary files /dev/null and b/features/step_definitions/.add_new_chw_steps.rb.swp differ diff --git a/features/step_definitions/.genre_steps.rb.swp b/features/step_definitions/.genre_steps.rb.swp new file mode 100644 index 0000000..81b2278 Binary files /dev/null and b/features/step_definitions/.genre_steps.rb.swp differ diff --git a/features/step_definitions/.textmessage.swp b/features/step_definitions/.textmessage.swp new file mode 100644 index 0000000..7838173 Binary files /dev/null and b/features/step_definitions/.textmessage.swp differ diff --git a/features/step_definitions/.textmessage_steps.rb.swp b/features/step_definitions/.textmessage_steps.rb.swp new file mode 100644 index 0000000..5d46d60 Binary files /dev/null and b/features/step_definitions/.textmessage_steps.rb.swp differ diff --git a/features/step_definitions/new_patient_sms_create_steps.rb b/features/step_definitions/new_patient_sms_create_steps.rb new file mode 100644 index 0000000..ef2fb6d --- /dev/null +++ b/features/step_definitions/new_patient_sms_create_steps.rb @@ -0,0 +1,15 @@ +Given /^the a registered Community Health Worker phone\-number is "([^"]*)"$/ do |arg1| +@villageworker = Villageworker.where("phonenumber = ?",arg1) +@phoneNumber = arg1 + +end + +When /^I receive text "([^"]*)" as text message$/ do |arg1| +@messageparser = Smsmessage.new +@messageparser.render(@phoneNumber,arg1).should eq("Thank you , a new patient has been registered") +end + +Then /^a New Patient should be added to the database$/ do + pending # express the regexp above with the code you wish you had +end + diff --git a/features/support/debugging.rb b/features/support/debugging.rb new file mode 100644 index 0000000..8127869 --- /dev/null +++ b/features/support/debugging.rb @@ -0,0 +1,4 @@ +After do |scenario| +save_and_open_page if scenario.failed? +end + diff --git a/features/support/env.rb b/features/support/env.rb new file mode 100644 index 0000000..29f204c --- /dev/null +++ b/features/support/env.rb @@ -0,0 +1,59 @@ +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. +# It is recommended to regenerate this file in the future when you upgrade to a +# newer version of cucumber-rails. Consider adding your own code to a new file +# instead of editing this one. Cucumber will automatically load all features/**/*.rb +# files. + +require 'cucumber/rails' + +# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In +# order to ease the transition to Capybara we set the default here. If you'd +# prefer to use XPath just remove this line and adjust any selectors in your +# steps to use the XPath syntax. +Capybara.default_selector = :css + +# By default, any exception happening in your Rails application will bubble up +# to Cucumber so that your scenario will fail. This is a different from how +# your application behaves in the production environment, where an error page will +# be rendered instead. +# +# Sometimes we want to override this default behaviour and allow Rails to rescue +# exceptions and display an error page (just like when the app is running in production). +# Typical scenarios where you want to do this is when you test your error pages. +# There are two ways to allow Rails to rescue exceptions: +# +# 1) Tag your scenario (or feature) with @allow-rescue +# +# 2) Set the value below to true. Beware that doing this globally is not +# recommended as it will mask a lot of errors for you! +# +ActionController::Base.allow_rescue = false + +# Remove/comment out the lines below if your app doesn't have a database. +# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. +begin + DatabaseCleaner.strategy = :transaction +rescue NameError + raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." +end + +# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. +# See the DatabaseCleaner documentation for details. Example: +# +# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do +# # { :except => [:widgets] } may not do what you expect here +# # as tCucumber::Rails::Database.javascript_strategy overrides +# # this setting. +# DatabaseCleaner.strategy = :truncation +# end +# +# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do +# DatabaseCleaner.strategy = :transaction +# end +# + +# Possible values are :truncation and :transaction +# The :transaction strategy is faster, but might give you threading problems. +# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature +Cucumber::Rails::Database.javascript_strategy = :truncation + diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/tasks/cucumber.rake b/lib/tasks/cucumber.rake new file mode 100644 index 0000000..83f7947 --- /dev/null +++ b/lib/tasks/cucumber.rake @@ -0,0 +1,65 @@ +# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. +# It is recommended to regenerate this file in the future when you upgrade to a +# newer version of cucumber-rails. Consider adding your own code to a new file +# instead of editing this one. Cucumber will automatically load all features/**/*.rb +# files. + + +unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks + +vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first +$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? + +begin + require 'cucumber/rake/task' + + namespace :cucumber do + Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| + t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. + t.fork = true # You may get faster startup if you set this to false + t.profile = 'default' + end + + Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| + t.binary = vendored_cucumber_bin + t.fork = true # You may get faster startup if you set this to false + t.profile = 'wip' + end + + Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| + t.binary = vendored_cucumber_bin + t.fork = true # You may get faster startup if you set this to false + t.profile = 'rerun' + end + + desc 'Run all features' + task :all => [:ok, :wip] + + task :statsetup do + require 'rails/code_statistics' + ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features') + ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features') + end + end + desc 'Alias for cucumber:ok' + task :cucumber => 'cucumber:ok' + + task :default => :cucumber + + task :features => :cucumber do + STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" + end + + # In case we don't have ActiveRecord, append a no-op task that we can depend upon. + task 'db:test:prepare' do + end + + task :stats => 'cucumber:statsetup' +rescue LoadError + desc 'cucumber rake task not available (cucumber not installed)' + task :cucumber do + abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' + end +end + +end diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..9a48320 --- /dev/null +++ b/public/404.html @@ -0,0 +1,26 @@ + + + + The page you were looking for doesn't exist (404) + + + + + +
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+ + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..83660ab --- /dev/null +++ b/public/422.html @@ -0,0 +1,26 @@ + + + + The change you wanted was rejected (422) + + + + + +
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+ + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..f3648a0 --- /dev/null +++ b/public/500.html @@ -0,0 +1,25 @@ + + + + We're sorry, but something went wrong (500) + + + + + +
+

We're sorry, but something went wrong.

+
+ + diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e69de29 diff --git a/public/open-flash-chart.swf b/public/open-flash-chart.swf new file mode 100644 index 0000000..43e1de1 Binary files /dev/null and b/public/open-flash-chart.swf differ diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..085187f --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,5 @@ +# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# +# To ban all spiders from the entire site uncomment the next two lines: +# User-Agent: * +# Disallow: / diff --git a/script/cucumber b/script/cucumber new file mode 100644 index 0000000..7fa5c92 --- /dev/null +++ b/script/cucumber @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby + +vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first +if vendored_cucumber_bin + load File.expand_path(vendored_cucumber_bin) +else + require 'rubygems' unless ENV['NO_RUBYGEMS'] + require 'cucumber' + load Cucumber::BINARY +end diff --git a/script/rails b/script/rails new file mode 100644 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/spec/controllers/cattlethefts_controller_spec.rb b/spec/controllers/cattlethefts_controller_spec.rb new file mode 100644 index 0000000..7363b59 --- /dev/null +++ b/spec/controllers/cattlethefts_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe CattletheftsController do + + # This should return the minimal set of attributes required to create a valid + # Cattletheft. As you add validations to Cattletheft, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # CattletheftsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all cattlethefts as @cattlethefts" do + cattletheft = Cattletheft.create! valid_attributes + get :index, {}, valid_session + assigns(:cattlethefts).should eq([cattletheft]) + end + end + + describe "GET show" do + it "assigns the requested cattletheft as @cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + get :show, {:id => cattletheft.to_param}, valid_session + assigns(:cattletheft).should eq(cattletheft) + end + end + + describe "GET new" do + it "assigns a new cattletheft as @cattletheft" do + get :new, {}, valid_session + assigns(:cattletheft).should be_a_new(Cattletheft) + end + end + + describe "GET edit" do + it "assigns the requested cattletheft as @cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + get :edit, {:id => cattletheft.to_param}, valid_session + assigns(:cattletheft).should eq(cattletheft) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Cattletheft" do + expect { + post :create, {:cattletheft => valid_attributes}, valid_session + }.to change(Cattletheft, :count).by(1) + end + + it "assigns a newly created cattletheft as @cattletheft" do + post :create, {:cattletheft => valid_attributes}, valid_session + assigns(:cattletheft).should be_a(Cattletheft) + assigns(:cattletheft).should be_persisted + end + + it "redirects to the created cattletheft" do + post :create, {:cattletheft => valid_attributes}, valid_session + response.should redirect_to(Cattletheft.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved cattletheft as @cattletheft" do + # Trigger the behavior that occurs when invalid params are submitted + Cattletheft.any_instance.stub(:save).and_return(false) + post :create, {:cattletheft => {}}, valid_session + assigns(:cattletheft).should be_a_new(Cattletheft) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Cattletheft.any_instance.stub(:save).and_return(false) + post :create, {:cattletheft => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + # Assuming there are no other cattlethefts in the database, this + # specifies that the Cattletheft created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Cattletheft.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => cattletheft.to_param, :cattletheft => {'these' => 'params'}}, valid_session + end + + it "assigns the requested cattletheft as @cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + put :update, {:id => cattletheft.to_param, :cattletheft => valid_attributes}, valid_session + assigns(:cattletheft).should eq(cattletheft) + end + + it "redirects to the cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + put :update, {:id => cattletheft.to_param, :cattletheft => valid_attributes}, valid_session + response.should redirect_to(cattletheft) + end + end + + describe "with invalid params" do + it "assigns the cattletheft as @cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Cattletheft.any_instance.stub(:save).and_return(false) + put :update, {:id => cattletheft.to_param, :cattletheft => {}}, valid_session + assigns(:cattletheft).should eq(cattletheft) + end + + it "re-renders the 'edit' template" do + cattletheft = Cattletheft.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Cattletheft.any_instance.stub(:save).and_return(false) + put :update, {:id => cattletheft.to_param, :cattletheft => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested cattletheft" do + cattletheft = Cattletheft.create! valid_attributes + expect { + delete :destroy, {:id => cattletheft.to_param}, valid_session + }.to change(Cattletheft, :count).by(-1) + end + + it "redirects to the cattlethefts list" do + cattletheft = Cattletheft.create! valid_attributes + delete :destroy, {:id => cattletheft.to_param}, valid_session + response.should redirect_to(cattlethefts_url) + end + end + +end diff --git a/spec/controllers/conflicts_controller_spec.rb b/spec/controllers/conflicts_controller_spec.rb new file mode 100644 index 0000000..9f89e8c --- /dev/null +++ b/spec/controllers/conflicts_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe ConflictsController do + + # This should return the minimal set of attributes required to create a valid + # Conflict. As you add validations to Conflict, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # ConflictsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all conflicts as @conflicts" do + conflict = Conflict.create! valid_attributes + get :index, {}, valid_session + assigns(:conflicts).should eq([conflict]) + end + end + + describe "GET show" do + it "assigns the requested conflict as @conflict" do + conflict = Conflict.create! valid_attributes + get :show, {:id => conflict.to_param}, valid_session + assigns(:conflict).should eq(conflict) + end + end + + describe "GET new" do + it "assigns a new conflict as @conflict" do + get :new, {}, valid_session + assigns(:conflict).should be_a_new(Conflict) + end + end + + describe "GET edit" do + it "assigns the requested conflict as @conflict" do + conflict = Conflict.create! valid_attributes + get :edit, {:id => conflict.to_param}, valid_session + assigns(:conflict).should eq(conflict) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Conflict" do + expect { + post :create, {:conflict => valid_attributes}, valid_session + }.to change(Conflict, :count).by(1) + end + + it "assigns a newly created conflict as @conflict" do + post :create, {:conflict => valid_attributes}, valid_session + assigns(:conflict).should be_a(Conflict) + assigns(:conflict).should be_persisted + end + + it "redirects to the created conflict" do + post :create, {:conflict => valid_attributes}, valid_session + response.should redirect_to(Conflict.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved conflict as @conflict" do + # Trigger the behavior that occurs when invalid params are submitted + Conflict.any_instance.stub(:save).and_return(false) + post :create, {:conflict => {}}, valid_session + assigns(:conflict).should be_a_new(Conflict) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Conflict.any_instance.stub(:save).and_return(false) + post :create, {:conflict => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested conflict" do + conflict = Conflict.create! valid_attributes + # Assuming there are no other conflicts in the database, this + # specifies that the Conflict created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Conflict.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => conflict.to_param, :conflict => {'these' => 'params'}}, valid_session + end + + it "assigns the requested conflict as @conflict" do + conflict = Conflict.create! valid_attributes + put :update, {:id => conflict.to_param, :conflict => valid_attributes}, valid_session + assigns(:conflict).should eq(conflict) + end + + it "redirects to the conflict" do + conflict = Conflict.create! valid_attributes + put :update, {:id => conflict.to_param, :conflict => valid_attributes}, valid_session + response.should redirect_to(conflict) + end + end + + describe "with invalid params" do + it "assigns the conflict as @conflict" do + conflict = Conflict.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Conflict.any_instance.stub(:save).and_return(false) + put :update, {:id => conflict.to_param, :conflict => {}}, valid_session + assigns(:conflict).should eq(conflict) + end + + it "re-renders the 'edit' template" do + conflict = Conflict.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Conflict.any_instance.stub(:save).and_return(false) + put :update, {:id => conflict.to_param, :conflict => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested conflict" do + conflict = Conflict.create! valid_attributes + expect { + delete :destroy, {:id => conflict.to_param}, valid_session + }.to change(Conflict, :count).by(-1) + end + + it "redirects to the conflicts list" do + conflict = Conflict.create! valid_attributes + delete :destroy, {:id => conflict.to_param}, valid_session + response.should redirect_to(conflicts_url) + end + end + +end diff --git a/spec/controllers/dotsmembers_controller_spec.rb b/spec/controllers/dotsmembers_controller_spec.rb new file mode 100644 index 0000000..84da80f --- /dev/null +++ b/spec/controllers/dotsmembers_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe DotsmembersController do + + # This should return the minimal set of attributes required to create a valid + # Dotsmember. As you add validations to Dotsmember, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # DotsmembersController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all dotsmembers as @dotsmembers" do + dotsmember = Dotsmember.create! valid_attributes + get :index, {}, valid_session + assigns(:dotsmembers).should eq([dotsmember]) + end + end + + describe "GET show" do + it "assigns the requested dotsmember as @dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + get :show, {:id => dotsmember.to_param}, valid_session + assigns(:dotsmember).should eq(dotsmember) + end + end + + describe "GET new" do + it "assigns a new dotsmember as @dotsmember" do + get :new, {}, valid_session + assigns(:dotsmember).should be_a_new(Dotsmember) + end + end + + describe "GET edit" do + it "assigns the requested dotsmember as @dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + get :edit, {:id => dotsmember.to_param}, valid_session + assigns(:dotsmember).should eq(dotsmember) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Dotsmember" do + expect { + post :create, {:dotsmember => valid_attributes}, valid_session + }.to change(Dotsmember, :count).by(1) + end + + it "assigns a newly created dotsmember as @dotsmember" do + post :create, {:dotsmember => valid_attributes}, valid_session + assigns(:dotsmember).should be_a(Dotsmember) + assigns(:dotsmember).should be_persisted + end + + it "redirects to the created dotsmember" do + post :create, {:dotsmember => valid_attributes}, valid_session + response.should redirect_to(Dotsmember.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved dotsmember as @dotsmember" do + # Trigger the behavior that occurs when invalid params are submitted + Dotsmember.any_instance.stub(:save).and_return(false) + post :create, {:dotsmember => {}}, valid_session + assigns(:dotsmember).should be_a_new(Dotsmember) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Dotsmember.any_instance.stub(:save).and_return(false) + post :create, {:dotsmember => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + # Assuming there are no other dotsmembers in the database, this + # specifies that the Dotsmember created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Dotsmember.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => dotsmember.to_param, :dotsmember => {'these' => 'params'}}, valid_session + end + + it "assigns the requested dotsmember as @dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + put :update, {:id => dotsmember.to_param, :dotsmember => valid_attributes}, valid_session + assigns(:dotsmember).should eq(dotsmember) + end + + it "redirects to the dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + put :update, {:id => dotsmember.to_param, :dotsmember => valid_attributes}, valid_session + response.should redirect_to(dotsmember) + end + end + + describe "with invalid params" do + it "assigns the dotsmember as @dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Dotsmember.any_instance.stub(:save).and_return(false) + put :update, {:id => dotsmember.to_param, :dotsmember => {}}, valid_session + assigns(:dotsmember).should eq(dotsmember) + end + + it "re-renders the 'edit' template" do + dotsmember = Dotsmember.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Dotsmember.any_instance.stub(:save).and_return(false) + put :update, {:id => dotsmember.to_param, :dotsmember => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested dotsmember" do + dotsmember = Dotsmember.create! valid_attributes + expect { + delete :destroy, {:id => dotsmember.to_param}, valid_session + }.to change(Dotsmember, :count).by(-1) + end + + it "redirects to the dotsmembers list" do + dotsmember = Dotsmember.create! valid_attributes + delete :destroy, {:id => dotsmember.to_param}, valid_session + response.should redirect_to(dotsmembers_url) + end + end + +end diff --git a/spec/controllers/firearms_controller_spec.rb b/spec/controllers/firearms_controller_spec.rb new file mode 100644 index 0000000..515d209 --- /dev/null +++ b/spec/controllers/firearms_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe FirearmsController do + + # This should return the minimal set of attributes required to create a valid + # Firearm. As you add validations to Firearm, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # FirearmsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all firearms as @firearms" do + firearm = Firearm.create! valid_attributes + get :index, {}, valid_session + assigns(:firearms).should eq([firearm]) + end + end + + describe "GET show" do + it "assigns the requested firearm as @firearm" do + firearm = Firearm.create! valid_attributes + get :show, {:id => firearm.to_param}, valid_session + assigns(:firearm).should eq(firearm) + end + end + + describe "GET new" do + it "assigns a new firearm as @firearm" do + get :new, {}, valid_session + assigns(:firearm).should be_a_new(Firearm) + end + end + + describe "GET edit" do + it "assigns the requested firearm as @firearm" do + firearm = Firearm.create! valid_attributes + get :edit, {:id => firearm.to_param}, valid_session + assigns(:firearm).should eq(firearm) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Firearm" do + expect { + post :create, {:firearm => valid_attributes}, valid_session + }.to change(Firearm, :count).by(1) + end + + it "assigns a newly created firearm as @firearm" do + post :create, {:firearm => valid_attributes}, valid_session + assigns(:firearm).should be_a(Firearm) + assigns(:firearm).should be_persisted + end + + it "redirects to the created firearm" do + post :create, {:firearm => valid_attributes}, valid_session + response.should redirect_to(Firearm.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved firearm as @firearm" do + # Trigger the behavior that occurs when invalid params are submitted + Firearm.any_instance.stub(:save).and_return(false) + post :create, {:firearm => {}}, valid_session + assigns(:firearm).should be_a_new(Firearm) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Firearm.any_instance.stub(:save).and_return(false) + post :create, {:firearm => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested firearm" do + firearm = Firearm.create! valid_attributes + # Assuming there are no other firearms in the database, this + # specifies that the Firearm created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Firearm.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => firearm.to_param, :firearm => {'these' => 'params'}}, valid_session + end + + it "assigns the requested firearm as @firearm" do + firearm = Firearm.create! valid_attributes + put :update, {:id => firearm.to_param, :firearm => valid_attributes}, valid_session + assigns(:firearm).should eq(firearm) + end + + it "redirects to the firearm" do + firearm = Firearm.create! valid_attributes + put :update, {:id => firearm.to_param, :firearm => valid_attributes}, valid_session + response.should redirect_to(firearm) + end + end + + describe "with invalid params" do + it "assigns the firearm as @firearm" do + firearm = Firearm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Firearm.any_instance.stub(:save).and_return(false) + put :update, {:id => firearm.to_param, :firearm => {}}, valid_session + assigns(:firearm).should eq(firearm) + end + + it "re-renders the 'edit' template" do + firearm = Firearm.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Firearm.any_instance.stub(:save).and_return(false) + put :update, {:id => firearm.to_param, :firearm => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested firearm" do + firearm = Firearm.create! valid_attributes + expect { + delete :destroy, {:id => firearm.to_param}, valid_session + }.to change(Firearm, :count).by(-1) + end + + it "redirects to the firearms list" do + firearm = Firearm.create! valid_attributes + delete :destroy, {:id => firearm.to_param}, valid_session + response.should redirect_to(firearms_url) + end + end + +end diff --git a/spec/controllers/hivcases_controller_spec.rb b/spec/controllers/hivcases_controller_spec.rb new file mode 100644 index 0000000..3d9156c --- /dev/null +++ b/spec/controllers/hivcases_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe HivcasesController do + + # This should return the minimal set of attributes required to create a valid + # Hivcase. As you add validations to Hivcase, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # HivcasesController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all hivcases as @hivcases" do + hivcase = Hivcase.create! valid_attributes + get :index, {}, valid_session + assigns(:hivcases).should eq([hivcase]) + end + end + + describe "GET show" do + it "assigns the requested hivcase as @hivcase" do + hivcase = Hivcase.create! valid_attributes + get :show, {:id => hivcase.to_param}, valid_session + assigns(:hivcase).should eq(hivcase) + end + end + + describe "GET new" do + it "assigns a new hivcase as @hivcase" do + get :new, {}, valid_session + assigns(:hivcase).should be_a_new(Hivcase) + end + end + + describe "GET edit" do + it "assigns the requested hivcase as @hivcase" do + hivcase = Hivcase.create! valid_attributes + get :edit, {:id => hivcase.to_param}, valid_session + assigns(:hivcase).should eq(hivcase) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Hivcase" do + expect { + post :create, {:hivcase => valid_attributes}, valid_session + }.to change(Hivcase, :count).by(1) + end + + it "assigns a newly created hivcase as @hivcase" do + post :create, {:hivcase => valid_attributes}, valid_session + assigns(:hivcase).should be_a(Hivcase) + assigns(:hivcase).should be_persisted + end + + it "redirects to the created hivcase" do + post :create, {:hivcase => valid_attributes}, valid_session + response.should redirect_to(Hivcase.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved hivcase as @hivcase" do + # Trigger the behavior that occurs when invalid params are submitted + Hivcase.any_instance.stub(:save).and_return(false) + post :create, {:hivcase => {}}, valid_session + assigns(:hivcase).should be_a_new(Hivcase) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Hivcase.any_instance.stub(:save).and_return(false) + post :create, {:hivcase => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested hivcase" do + hivcase = Hivcase.create! valid_attributes + # Assuming there are no other hivcases in the database, this + # specifies that the Hivcase created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Hivcase.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => hivcase.to_param, :hivcase => {'these' => 'params'}}, valid_session + end + + it "assigns the requested hivcase as @hivcase" do + hivcase = Hivcase.create! valid_attributes + put :update, {:id => hivcase.to_param, :hivcase => valid_attributes}, valid_session + assigns(:hivcase).should eq(hivcase) + end + + it "redirects to the hivcase" do + hivcase = Hivcase.create! valid_attributes + put :update, {:id => hivcase.to_param, :hivcase => valid_attributes}, valid_session + response.should redirect_to(hivcase) + end + end + + describe "with invalid params" do + it "assigns the hivcase as @hivcase" do + hivcase = Hivcase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivcase.any_instance.stub(:save).and_return(false) + put :update, {:id => hivcase.to_param, :hivcase => {}}, valid_session + assigns(:hivcase).should eq(hivcase) + end + + it "re-renders the 'edit' template" do + hivcase = Hivcase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivcase.any_instance.stub(:save).and_return(false) + put :update, {:id => hivcase.to_param, :hivcase => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested hivcase" do + hivcase = Hivcase.create! valid_attributes + expect { + delete :destroy, {:id => hivcase.to_param}, valid_session + }.to change(Hivcase, :count).by(-1) + end + + it "redirects to the hivcases list" do + hivcase = Hivcase.create! valid_attributes + delete :destroy, {:id => hivcase.to_param}, valid_session + response.should redirect_to(hivcases_url) + end + end + +end diff --git a/spec/controllers/hivcontraceptionreports_controller_spec.rb b/spec/controllers/hivcontraceptionreports_controller_spec.rb new file mode 100644 index 0000000..2891d40 --- /dev/null +++ b/spec/controllers/hivcontraceptionreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe HivcontraceptionreportsController do + + # This should return the minimal set of attributes required to create a valid + # Hivcontraceptionreport. As you add validations to Hivcontraceptionreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # HivcontraceptionreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all hivcontraceptionreports as @hivcontraceptionreports" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + get :index, {}, valid_session + assigns(:hivcontraceptionreports).should eq([hivcontraceptionreport]) + end + end + + describe "GET show" do + it "assigns the requested hivcontraceptionreport as @hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + get :show, {:id => hivcontraceptionreport.to_param}, valid_session + assigns(:hivcontraceptionreport).should eq(hivcontraceptionreport) + end + end + + describe "GET new" do + it "assigns a new hivcontraceptionreport as @hivcontraceptionreport" do + get :new, {}, valid_session + assigns(:hivcontraceptionreport).should be_a_new(Hivcontraceptionreport) + end + end + + describe "GET edit" do + it "assigns the requested hivcontraceptionreport as @hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + get :edit, {:id => hivcontraceptionreport.to_param}, valid_session + assigns(:hivcontraceptionreport).should eq(hivcontraceptionreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Hivcontraceptionreport" do + expect { + post :create, {:hivcontraceptionreport => valid_attributes}, valid_session + }.to change(Hivcontraceptionreport, :count).by(1) + end + + it "assigns a newly created hivcontraceptionreport as @hivcontraceptionreport" do + post :create, {:hivcontraceptionreport => valid_attributes}, valid_session + assigns(:hivcontraceptionreport).should be_a(Hivcontraceptionreport) + assigns(:hivcontraceptionreport).should be_persisted + end + + it "redirects to the created hivcontraceptionreport" do + post :create, {:hivcontraceptionreport => valid_attributes}, valid_session + response.should redirect_to(Hivcontraceptionreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved hivcontraceptionreport as @hivcontraceptionreport" do + # Trigger the behavior that occurs when invalid params are submitted + Hivcontraceptionreport.any_instance.stub(:save).and_return(false) + post :create, {:hivcontraceptionreport => {}}, valid_session + assigns(:hivcontraceptionreport).should be_a_new(Hivcontraceptionreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Hivcontraceptionreport.any_instance.stub(:save).and_return(false) + post :create, {:hivcontraceptionreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + # Assuming there are no other hivcontraceptionreports in the database, this + # specifies that the Hivcontraceptionreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Hivcontraceptionreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => hivcontraceptionreport.to_param, :hivcontraceptionreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested hivcontraceptionreport as @hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + put :update, {:id => hivcontraceptionreport.to_param, :hivcontraceptionreport => valid_attributes}, valid_session + assigns(:hivcontraceptionreport).should eq(hivcontraceptionreport) + end + + it "redirects to the hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + put :update, {:id => hivcontraceptionreport.to_param, :hivcontraceptionreport => valid_attributes}, valid_session + response.should redirect_to(hivcontraceptionreport) + end + end + + describe "with invalid params" do + it "assigns the hivcontraceptionreport as @hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivcontraceptionreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivcontraceptionreport.to_param, :hivcontraceptionreport => {}}, valid_session + assigns(:hivcontraceptionreport).should eq(hivcontraceptionreport) + end + + it "re-renders the 'edit' template" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivcontraceptionreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivcontraceptionreport.to_param, :hivcontraceptionreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested hivcontraceptionreport" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + expect { + delete :destroy, {:id => hivcontraceptionreport.to_param}, valid_session + }.to change(Hivcontraceptionreport, :count).by(-1) + end + + it "redirects to the hivcontraceptionreports list" do + hivcontraceptionreport = Hivcontraceptionreport.create! valid_attributes + delete :destroy, {:id => hivcontraceptionreport.to_param}, valid_session + response.should redirect_to(hivcontraceptionreports_url) + end + end + +end diff --git a/spec/controllers/hivdrugreports_controller_spec.rb b/spec/controllers/hivdrugreports_controller_spec.rb new file mode 100644 index 0000000..c20d0ea --- /dev/null +++ b/spec/controllers/hivdrugreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe HivdrugreportsController do + + # This should return the minimal set of attributes required to create a valid + # Hivdrugreport. As you add validations to Hivdrugreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # HivdrugreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all hivdrugreports as @hivdrugreports" do + hivdrugreport = Hivdrugreport.create! valid_attributes + get :index, {}, valid_session + assigns(:hivdrugreports).should eq([hivdrugreport]) + end + end + + describe "GET show" do + it "assigns the requested hivdrugreport as @hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + get :show, {:id => hivdrugreport.to_param}, valid_session + assigns(:hivdrugreport).should eq(hivdrugreport) + end + end + + describe "GET new" do + it "assigns a new hivdrugreport as @hivdrugreport" do + get :new, {}, valid_session + assigns(:hivdrugreport).should be_a_new(Hivdrugreport) + end + end + + describe "GET edit" do + it "assigns the requested hivdrugreport as @hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + get :edit, {:id => hivdrugreport.to_param}, valid_session + assigns(:hivdrugreport).should eq(hivdrugreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Hivdrugreport" do + expect { + post :create, {:hivdrugreport => valid_attributes}, valid_session + }.to change(Hivdrugreport, :count).by(1) + end + + it "assigns a newly created hivdrugreport as @hivdrugreport" do + post :create, {:hivdrugreport => valid_attributes}, valid_session + assigns(:hivdrugreport).should be_a(Hivdrugreport) + assigns(:hivdrugreport).should be_persisted + end + + it "redirects to the created hivdrugreport" do + post :create, {:hivdrugreport => valid_attributes}, valid_session + response.should redirect_to(Hivdrugreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved hivdrugreport as @hivdrugreport" do + # Trigger the behavior that occurs when invalid params are submitted + Hivdrugreport.any_instance.stub(:save).and_return(false) + post :create, {:hivdrugreport => {}}, valid_session + assigns(:hivdrugreport).should be_a_new(Hivdrugreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Hivdrugreport.any_instance.stub(:save).and_return(false) + post :create, {:hivdrugreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + # Assuming there are no other hivdrugreports in the database, this + # specifies that the Hivdrugreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Hivdrugreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => hivdrugreport.to_param, :hivdrugreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested hivdrugreport as @hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + put :update, {:id => hivdrugreport.to_param, :hivdrugreport => valid_attributes}, valid_session + assigns(:hivdrugreport).should eq(hivdrugreport) + end + + it "redirects to the hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + put :update, {:id => hivdrugreport.to_param, :hivdrugreport => valid_attributes}, valid_session + response.should redirect_to(hivdrugreport) + end + end + + describe "with invalid params" do + it "assigns the hivdrugreport as @hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivdrugreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivdrugreport.to_param, :hivdrugreport => {}}, valid_session + assigns(:hivdrugreport).should eq(hivdrugreport) + end + + it "re-renders the 'edit' template" do + hivdrugreport = Hivdrugreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivdrugreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivdrugreport.to_param, :hivdrugreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested hivdrugreport" do + hivdrugreport = Hivdrugreport.create! valid_attributes + expect { + delete :destroy, {:id => hivdrugreport.to_param}, valid_session + }.to change(Hivdrugreport, :count).by(-1) + end + + it "redirects to the hivdrugreports list" do + hivdrugreport = Hivdrugreport.create! valid_attributes + delete :destroy, {:id => hivdrugreport.to_param}, valid_session + response.should redirect_to(hivdrugreports_url) + end + end + +end diff --git a/spec/controllers/hivgenderreports_controller_spec.rb b/spec/controllers/hivgenderreports_controller_spec.rb new file mode 100644 index 0000000..950d039 --- /dev/null +++ b/spec/controllers/hivgenderreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe HivgenderreportsController do + + # This should return the minimal set of attributes required to create a valid + # Hivgenderreport. As you add validations to Hivgenderreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # HivgenderreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all hivgenderreports as @hivgenderreports" do + hivgenderreport = Hivgenderreport.create! valid_attributes + get :index, {}, valid_session + assigns(:hivgenderreports).should eq([hivgenderreport]) + end + end + + describe "GET show" do + it "assigns the requested hivgenderreport as @hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + get :show, {:id => hivgenderreport.to_param}, valid_session + assigns(:hivgenderreport).should eq(hivgenderreport) + end + end + + describe "GET new" do + it "assigns a new hivgenderreport as @hivgenderreport" do + get :new, {}, valid_session + assigns(:hivgenderreport).should be_a_new(Hivgenderreport) + end + end + + describe "GET edit" do + it "assigns the requested hivgenderreport as @hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + get :edit, {:id => hivgenderreport.to_param}, valid_session + assigns(:hivgenderreport).should eq(hivgenderreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Hivgenderreport" do + expect { + post :create, {:hivgenderreport => valid_attributes}, valid_session + }.to change(Hivgenderreport, :count).by(1) + end + + it "assigns a newly created hivgenderreport as @hivgenderreport" do + post :create, {:hivgenderreport => valid_attributes}, valid_session + assigns(:hivgenderreport).should be_a(Hivgenderreport) + assigns(:hivgenderreport).should be_persisted + end + + it "redirects to the created hivgenderreport" do + post :create, {:hivgenderreport => valid_attributes}, valid_session + response.should redirect_to(Hivgenderreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved hivgenderreport as @hivgenderreport" do + # Trigger the behavior that occurs when invalid params are submitted + Hivgenderreport.any_instance.stub(:save).and_return(false) + post :create, {:hivgenderreport => {}}, valid_session + assigns(:hivgenderreport).should be_a_new(Hivgenderreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Hivgenderreport.any_instance.stub(:save).and_return(false) + post :create, {:hivgenderreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + # Assuming there are no other hivgenderreports in the database, this + # specifies that the Hivgenderreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Hivgenderreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => hivgenderreport.to_param, :hivgenderreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested hivgenderreport as @hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + put :update, {:id => hivgenderreport.to_param, :hivgenderreport => valid_attributes}, valid_session + assigns(:hivgenderreport).should eq(hivgenderreport) + end + + it "redirects to the hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + put :update, {:id => hivgenderreport.to_param, :hivgenderreport => valid_attributes}, valid_session + response.should redirect_to(hivgenderreport) + end + end + + describe "with invalid params" do + it "assigns the hivgenderreport as @hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivgenderreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivgenderreport.to_param, :hivgenderreport => {}}, valid_session + assigns(:hivgenderreport).should eq(hivgenderreport) + end + + it "re-renders the 'edit' template" do + hivgenderreport = Hivgenderreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivgenderreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivgenderreport.to_param, :hivgenderreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested hivgenderreport" do + hivgenderreport = Hivgenderreport.create! valid_attributes + expect { + delete :destroy, {:id => hivgenderreport.to_param}, valid_session + }.to change(Hivgenderreport, :count).by(-1) + end + + it "redirects to the hivgenderreports list" do + hivgenderreport = Hivgenderreport.create! valid_attributes + delete :destroy, {:id => hivgenderreport.to_param}, valid_session + response.should redirect_to(hivgenderreports_url) + end + end + +end diff --git a/spec/controllers/hivlocationreports_controller_spec.rb b/spec/controllers/hivlocationreports_controller_spec.rb new file mode 100644 index 0000000..1054d69 --- /dev/null +++ b/spec/controllers/hivlocationreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe HivlocationreportsController do + + # This should return the minimal set of attributes required to create a valid + # Hivlocationreport. As you add validations to Hivlocationreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # HivlocationreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all hivlocationreports as @hivlocationreports" do + hivlocationreport = Hivlocationreport.create! valid_attributes + get :index, {}, valid_session + assigns(:hivlocationreports).should eq([hivlocationreport]) + end + end + + describe "GET show" do + it "assigns the requested hivlocationreport as @hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + get :show, {:id => hivlocationreport.to_param}, valid_session + assigns(:hivlocationreport).should eq(hivlocationreport) + end + end + + describe "GET new" do + it "assigns a new hivlocationreport as @hivlocationreport" do + get :new, {}, valid_session + assigns(:hivlocationreport).should be_a_new(Hivlocationreport) + end + end + + describe "GET edit" do + it "assigns the requested hivlocationreport as @hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + get :edit, {:id => hivlocationreport.to_param}, valid_session + assigns(:hivlocationreport).should eq(hivlocationreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Hivlocationreport" do + expect { + post :create, {:hivlocationreport => valid_attributes}, valid_session + }.to change(Hivlocationreport, :count).by(1) + end + + it "assigns a newly created hivlocationreport as @hivlocationreport" do + post :create, {:hivlocationreport => valid_attributes}, valid_session + assigns(:hivlocationreport).should be_a(Hivlocationreport) + assigns(:hivlocationreport).should be_persisted + end + + it "redirects to the created hivlocationreport" do + post :create, {:hivlocationreport => valid_attributes}, valid_session + response.should redirect_to(Hivlocationreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved hivlocationreport as @hivlocationreport" do + # Trigger the behavior that occurs when invalid params are submitted + Hivlocationreport.any_instance.stub(:save).and_return(false) + post :create, {:hivlocationreport => {}}, valid_session + assigns(:hivlocationreport).should be_a_new(Hivlocationreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Hivlocationreport.any_instance.stub(:save).and_return(false) + post :create, {:hivlocationreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + # Assuming there are no other hivlocationreports in the database, this + # specifies that the Hivlocationreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Hivlocationreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => hivlocationreport.to_param, :hivlocationreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested hivlocationreport as @hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + put :update, {:id => hivlocationreport.to_param, :hivlocationreport => valid_attributes}, valid_session + assigns(:hivlocationreport).should eq(hivlocationreport) + end + + it "redirects to the hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + put :update, {:id => hivlocationreport.to_param, :hivlocationreport => valid_attributes}, valid_session + response.should redirect_to(hivlocationreport) + end + end + + describe "with invalid params" do + it "assigns the hivlocationreport as @hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivlocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivlocationreport.to_param, :hivlocationreport => {}}, valid_session + assigns(:hivlocationreport).should eq(hivlocationreport) + end + + it "re-renders the 'edit' template" do + hivlocationreport = Hivlocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Hivlocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => hivlocationreport.to_param, :hivlocationreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested hivlocationreport" do + hivlocationreport = Hivlocationreport.create! valid_attributes + expect { + delete :destroy, {:id => hivlocationreport.to_param}, valid_session + }.to change(Hivlocationreport, :count).by(-1) + end + + it "redirects to the hivlocationreports list" do + hivlocationreport = Hivlocationreport.create! valid_attributes + delete :destroy, {:id => hivlocationreport.to_param}, valid_session + response.should redirect_to(hivlocationreports_url) + end + end + +end diff --git a/spec/controllers/locationreports_controller_spec.rb b/spec/controllers/locationreports_controller_spec.rb new file mode 100644 index 0000000..6a26856 --- /dev/null +++ b/spec/controllers/locationreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe LocationreportsController do + + # This should return the minimal set of attributes required to create a valid + # Locationreport. As you add validations to Locationreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # LocationreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all locationreports as @locationreports" do + locationreport = Locationreport.create! valid_attributes + get :index, {}, valid_session + assigns(:locationreports).should eq([locationreport]) + end + end + + describe "GET show" do + it "assigns the requested locationreport as @locationreport" do + locationreport = Locationreport.create! valid_attributes + get :show, {:id => locationreport.to_param}, valid_session + assigns(:locationreport).should eq(locationreport) + end + end + + describe "GET new" do + it "assigns a new locationreport as @locationreport" do + get :new, {}, valid_session + assigns(:locationreport).should be_a_new(Locationreport) + end + end + + describe "GET edit" do + it "assigns the requested locationreport as @locationreport" do + locationreport = Locationreport.create! valid_attributes + get :edit, {:id => locationreport.to_param}, valid_session + assigns(:locationreport).should eq(locationreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Locationreport" do + expect { + post :create, {:locationreport => valid_attributes}, valid_session + }.to change(Locationreport, :count).by(1) + end + + it "assigns a newly created locationreport as @locationreport" do + post :create, {:locationreport => valid_attributes}, valid_session + assigns(:locationreport).should be_a(Locationreport) + assigns(:locationreport).should be_persisted + end + + it "redirects to the created locationreport" do + post :create, {:locationreport => valid_attributes}, valid_session + response.should redirect_to(Locationreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved locationreport as @locationreport" do + # Trigger the behavior that occurs when invalid params are submitted + Locationreport.any_instance.stub(:save).and_return(false) + post :create, {:locationreport => {}}, valid_session + assigns(:locationreport).should be_a_new(Locationreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Locationreport.any_instance.stub(:save).and_return(false) + post :create, {:locationreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested locationreport" do + locationreport = Locationreport.create! valid_attributes + # Assuming there are no other locationreports in the database, this + # specifies that the Locationreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Locationreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => locationreport.to_param, :locationreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested locationreport as @locationreport" do + locationreport = Locationreport.create! valid_attributes + put :update, {:id => locationreport.to_param, :locationreport => valid_attributes}, valid_session + assigns(:locationreport).should eq(locationreport) + end + + it "redirects to the locationreport" do + locationreport = Locationreport.create! valid_attributes + put :update, {:id => locationreport.to_param, :locationreport => valid_attributes}, valid_session + response.should redirect_to(locationreport) + end + end + + describe "with invalid params" do + it "assigns the locationreport as @locationreport" do + locationreport = Locationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Locationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => locationreport.to_param, :locationreport => {}}, valid_session + assigns(:locationreport).should eq(locationreport) + end + + it "re-renders the 'edit' template" do + locationreport = Locationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Locationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => locationreport.to_param, :locationreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested locationreport" do + locationreport = Locationreport.create! valid_attributes + expect { + delete :destroy, {:id => locationreport.to_param}, valid_session + }.to change(Locationreport, :count).by(-1) + end + + it "redirects to the locationreports list" do + locationreport = Locationreport.create! valid_attributes + delete :destroy, {:id => locationreport.to_param}, valid_session + response.should redirect_to(locationreports_url) + end + end + +end diff --git a/spec/controllers/malariacases_controller_spec.rb b/spec/controllers/malariacases_controller_spec.rb new file mode 100644 index 0000000..ac3af67 --- /dev/null +++ b/spec/controllers/malariacases_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MalariacasesController do + + # This should return the minimal set of attributes required to create a valid + # Malariacase. As you add validations to Malariacase, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MalariacasesController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all malariacases as @malariacases" do + malariacase = Malariacase.create! valid_attributes + get :index, {}, valid_session + assigns(:malariacases).should eq([malariacase]) + end + end + + describe "GET show" do + it "assigns the requested malariacase as @malariacase" do + malariacase = Malariacase.create! valid_attributes + get :show, {:id => malariacase.to_param}, valid_session + assigns(:malariacase).should eq(malariacase) + end + end + + describe "GET new" do + it "assigns a new malariacase as @malariacase" do + get :new, {}, valid_session + assigns(:malariacase).should be_a_new(Malariacase) + end + end + + describe "GET edit" do + it "assigns the requested malariacase as @malariacase" do + malariacase = Malariacase.create! valid_attributes + get :edit, {:id => malariacase.to_param}, valid_session + assigns(:malariacase).should eq(malariacase) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Malariacase" do + expect { + post :create, {:malariacase => valid_attributes}, valid_session + }.to change(Malariacase, :count).by(1) + end + + it "assigns a newly created malariacase as @malariacase" do + post :create, {:malariacase => valid_attributes}, valid_session + assigns(:malariacase).should be_a(Malariacase) + assigns(:malariacase).should be_persisted + end + + it "redirects to the created malariacase" do + post :create, {:malariacase => valid_attributes}, valid_session + response.should redirect_to(Malariacase.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved malariacase as @malariacase" do + # Trigger the behavior that occurs when invalid params are submitted + Malariacase.any_instance.stub(:save).and_return(false) + post :create, {:malariacase => {}}, valid_session + assigns(:malariacase).should be_a_new(Malariacase) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Malariacase.any_instance.stub(:save).and_return(false) + post :create, {:malariacase => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested malariacase" do + malariacase = Malariacase.create! valid_attributes + # Assuming there are no other malariacases in the database, this + # specifies that the Malariacase created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Malariacase.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => malariacase.to_param, :malariacase => {'these' => 'params'}}, valid_session + end + + it "assigns the requested malariacase as @malariacase" do + malariacase = Malariacase.create! valid_attributes + put :update, {:id => malariacase.to_param, :malariacase => valid_attributes}, valid_session + assigns(:malariacase).should eq(malariacase) + end + + it "redirects to the malariacase" do + malariacase = Malariacase.create! valid_attributes + put :update, {:id => malariacase.to_param, :malariacase => valid_attributes}, valid_session + response.should redirect_to(malariacase) + end + end + + describe "with invalid params" do + it "assigns the malariacase as @malariacase" do + malariacase = Malariacase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariacase.any_instance.stub(:save).and_return(false) + put :update, {:id => malariacase.to_param, :malariacase => {}}, valid_session + assigns(:malariacase).should eq(malariacase) + end + + it "re-renders the 'edit' template" do + malariacase = Malariacase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariacase.any_instance.stub(:save).and_return(false) + put :update, {:id => malariacase.to_param, :malariacase => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested malariacase" do + malariacase = Malariacase.create! valid_attributes + expect { + delete :destroy, {:id => malariacase.to_param}, valid_session + }.to change(Malariacase, :count).by(-1) + end + + it "redirects to the malariacases list" do + malariacase = Malariacase.create! valid_attributes + delete :destroy, {:id => malariacase.to_param}, valid_session + response.should redirect_to(malariacases_url) + end + end + +end diff --git a/spec/controllers/malariagenderreports_controller_spec.rb b/spec/controllers/malariagenderreports_controller_spec.rb new file mode 100644 index 0000000..41e77da --- /dev/null +++ b/spec/controllers/malariagenderreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MalariagenderreportsController do + + # This should return the minimal set of attributes required to create a valid + # Malariagenderreport. As you add validations to Malariagenderreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MalariagenderreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all malariagenderreports as @malariagenderreports" do + malariagenderreport = Malariagenderreport.create! valid_attributes + get :index, {}, valid_session + assigns(:malariagenderreports).should eq([malariagenderreport]) + end + end + + describe "GET show" do + it "assigns the requested malariagenderreport as @malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + get :show, {:id => malariagenderreport.to_param}, valid_session + assigns(:malariagenderreport).should eq(malariagenderreport) + end + end + + describe "GET new" do + it "assigns a new malariagenderreport as @malariagenderreport" do + get :new, {}, valid_session + assigns(:malariagenderreport).should be_a_new(Malariagenderreport) + end + end + + describe "GET edit" do + it "assigns the requested malariagenderreport as @malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + get :edit, {:id => malariagenderreport.to_param}, valid_session + assigns(:malariagenderreport).should eq(malariagenderreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Malariagenderreport" do + expect { + post :create, {:malariagenderreport => valid_attributes}, valid_session + }.to change(Malariagenderreport, :count).by(1) + end + + it "assigns a newly created malariagenderreport as @malariagenderreport" do + post :create, {:malariagenderreport => valid_attributes}, valid_session + assigns(:malariagenderreport).should be_a(Malariagenderreport) + assigns(:malariagenderreport).should be_persisted + end + + it "redirects to the created malariagenderreport" do + post :create, {:malariagenderreport => valid_attributes}, valid_session + response.should redirect_to(Malariagenderreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved malariagenderreport as @malariagenderreport" do + # Trigger the behavior that occurs when invalid params are submitted + Malariagenderreport.any_instance.stub(:save).and_return(false) + post :create, {:malariagenderreport => {}}, valid_session + assigns(:malariagenderreport).should be_a_new(Malariagenderreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Malariagenderreport.any_instance.stub(:save).and_return(false) + post :create, {:malariagenderreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + # Assuming there are no other malariagenderreports in the database, this + # specifies that the Malariagenderreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Malariagenderreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => malariagenderreport.to_param, :malariagenderreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested malariagenderreport as @malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + put :update, {:id => malariagenderreport.to_param, :malariagenderreport => valid_attributes}, valid_session + assigns(:malariagenderreport).should eq(malariagenderreport) + end + + it "redirects to the malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + put :update, {:id => malariagenderreport.to_param, :malariagenderreport => valid_attributes}, valid_session + response.should redirect_to(malariagenderreport) + end + end + + describe "with invalid params" do + it "assigns the malariagenderreport as @malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariagenderreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malariagenderreport.to_param, :malariagenderreport => {}}, valid_session + assigns(:malariagenderreport).should eq(malariagenderreport) + end + + it "re-renders the 'edit' template" do + malariagenderreport = Malariagenderreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariagenderreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malariagenderreport.to_param, :malariagenderreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested malariagenderreport" do + malariagenderreport = Malariagenderreport.create! valid_attributes + expect { + delete :destroy, {:id => malariagenderreport.to_param}, valid_session + }.to change(Malariagenderreport, :count).by(-1) + end + + it "redirects to the malariagenderreports list" do + malariagenderreport = Malariagenderreport.create! valid_attributes + delete :destroy, {:id => malariagenderreport.to_param}, valid_session + response.should redirect_to(malariagenderreports_url) + end + end + +end diff --git a/spec/controllers/malarialocationreports_controller_spec.rb b/spec/controllers/malarialocationreports_controller_spec.rb new file mode 100644 index 0000000..00255e5 --- /dev/null +++ b/spec/controllers/malarialocationreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MalarialocationreportsController do + + # This should return the minimal set of attributes required to create a valid + # Malarialocationreport. As you add validations to Malarialocationreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MalarialocationreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all malarialocationreports as @malarialocationreports" do + malarialocationreport = Malarialocationreport.create! valid_attributes + get :index, {}, valid_session + assigns(:malarialocationreports).should eq([malarialocationreport]) + end + end + + describe "GET show" do + it "assigns the requested malarialocationreport as @malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + get :show, {:id => malarialocationreport.to_param}, valid_session + assigns(:malarialocationreport).should eq(malarialocationreport) + end + end + + describe "GET new" do + it "assigns a new malarialocationreport as @malarialocationreport" do + get :new, {}, valid_session + assigns(:malarialocationreport).should be_a_new(Malarialocationreport) + end + end + + describe "GET edit" do + it "assigns the requested malarialocationreport as @malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + get :edit, {:id => malarialocationreport.to_param}, valid_session + assigns(:malarialocationreport).should eq(malarialocationreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Malarialocationreport" do + expect { + post :create, {:malarialocationreport => valid_attributes}, valid_session + }.to change(Malarialocationreport, :count).by(1) + end + + it "assigns a newly created malarialocationreport as @malarialocationreport" do + post :create, {:malarialocationreport => valid_attributes}, valid_session + assigns(:malarialocationreport).should be_a(Malarialocationreport) + assigns(:malarialocationreport).should be_persisted + end + + it "redirects to the created malarialocationreport" do + post :create, {:malarialocationreport => valid_attributes}, valid_session + response.should redirect_to(Malarialocationreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved malarialocationreport as @malarialocationreport" do + # Trigger the behavior that occurs when invalid params are submitted + Malarialocationreport.any_instance.stub(:save).and_return(false) + post :create, {:malarialocationreport => {}}, valid_session + assigns(:malarialocationreport).should be_a_new(Malarialocationreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Malarialocationreport.any_instance.stub(:save).and_return(false) + post :create, {:malarialocationreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + # Assuming there are no other malarialocationreports in the database, this + # specifies that the Malarialocationreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Malarialocationreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => malarialocationreport.to_param, :malarialocationreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested malarialocationreport as @malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + put :update, {:id => malarialocationreport.to_param, :malarialocationreport => valid_attributes}, valid_session + assigns(:malarialocationreport).should eq(malarialocationreport) + end + + it "redirects to the malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + put :update, {:id => malarialocationreport.to_param, :malarialocationreport => valid_attributes}, valid_session + response.should redirect_to(malarialocationreport) + end + end + + describe "with invalid params" do + it "assigns the malarialocationreport as @malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malarialocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malarialocationreport.to_param, :malarialocationreport => {}}, valid_session + assigns(:malarialocationreport).should eq(malarialocationreport) + end + + it "re-renders the 'edit' template" do + malarialocationreport = Malarialocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malarialocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malarialocationreport.to_param, :malarialocationreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested malarialocationreport" do + malarialocationreport = Malarialocationreport.create! valid_attributes + expect { + delete :destroy, {:id => malarialocationreport.to_param}, valid_session + }.to change(Malarialocationreport, :count).by(-1) + end + + it "redirects to the malarialocationreports list" do + malarialocationreport = Malarialocationreport.create! valid_attributes + delete :destroy, {:id => malarialocationreport.to_param}, valid_session + response.should redirect_to(malarialocationreports_url) + end + end + +end diff --git a/spec/controllers/malariapreventationreports_controller_spec.rb b/spec/controllers/malariapreventationreports_controller_spec.rb new file mode 100644 index 0000000..7fa4119 --- /dev/null +++ b/spec/controllers/malariapreventationreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MalariapreventationreportsController do + + # This should return the minimal set of attributes required to create a valid + # Malariapreventationreport. As you add validations to Malariapreventationreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MalariapreventationreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all malariapreventationreports as @malariapreventationreports" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + get :index, {}, valid_session + assigns(:malariapreventationreports).should eq([malariapreventationreport]) + end + end + + describe "GET show" do + it "assigns the requested malariapreventationreport as @malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + get :show, {:id => malariapreventationreport.to_param}, valid_session + assigns(:malariapreventationreport).should eq(malariapreventationreport) + end + end + + describe "GET new" do + it "assigns a new malariapreventationreport as @malariapreventationreport" do + get :new, {}, valid_session + assigns(:malariapreventationreport).should be_a_new(Malariapreventationreport) + end + end + + describe "GET edit" do + it "assigns the requested malariapreventationreport as @malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + get :edit, {:id => malariapreventationreport.to_param}, valid_session + assigns(:malariapreventationreport).should eq(malariapreventationreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Malariapreventationreport" do + expect { + post :create, {:malariapreventationreport => valid_attributes}, valid_session + }.to change(Malariapreventationreport, :count).by(1) + end + + it "assigns a newly created malariapreventationreport as @malariapreventationreport" do + post :create, {:malariapreventationreport => valid_attributes}, valid_session + assigns(:malariapreventationreport).should be_a(Malariapreventationreport) + assigns(:malariapreventationreport).should be_persisted + end + + it "redirects to the created malariapreventationreport" do + post :create, {:malariapreventationreport => valid_attributes}, valid_session + response.should redirect_to(Malariapreventationreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved malariapreventationreport as @malariapreventationreport" do + # Trigger the behavior that occurs when invalid params are submitted + Malariapreventationreport.any_instance.stub(:save).and_return(false) + post :create, {:malariapreventationreport => {}}, valid_session + assigns(:malariapreventationreport).should be_a_new(Malariapreventationreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Malariapreventationreport.any_instance.stub(:save).and_return(false) + post :create, {:malariapreventationreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + # Assuming there are no other malariapreventationreports in the database, this + # specifies that the Malariapreventationreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Malariapreventationreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => malariapreventationreport.to_param, :malariapreventationreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested malariapreventationreport as @malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + put :update, {:id => malariapreventationreport.to_param, :malariapreventationreport => valid_attributes}, valid_session + assigns(:malariapreventationreport).should eq(malariapreventationreport) + end + + it "redirects to the malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + put :update, {:id => malariapreventationreport.to_param, :malariapreventationreport => valid_attributes}, valid_session + response.should redirect_to(malariapreventationreport) + end + end + + describe "with invalid params" do + it "assigns the malariapreventationreport as @malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariapreventationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malariapreventationreport.to_param, :malariapreventationreport => {}}, valid_session + assigns(:malariapreventationreport).should eq(malariapreventationreport) + end + + it "re-renders the 'edit' template" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Malariapreventationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => malariapreventationreport.to_param, :malariapreventationreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested malariapreventationreport" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + expect { + delete :destroy, {:id => malariapreventationreport.to_param}, valid_session + }.to change(Malariapreventationreport, :count).by(-1) + end + + it "redirects to the malariapreventationreports list" do + malariapreventationreport = Malariapreventationreport.create! valid_attributes + delete :destroy, {:id => malariapreventationreport.to_param}, valid_session + response.should redirect_to(malariapreventationreports_url) + end + end + +end diff --git a/spec/controllers/members_controller_spec.rb b/spec/controllers/members_controller_spec.rb new file mode 100644 index 0000000..91a4c52 --- /dev/null +++ b/spec/controllers/members_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe MembersController do + + # This should return the minimal set of attributes required to create a valid + # Member. As you add validations to Member, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # MembersController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all members as @members" do + member = Member.create! valid_attributes + get :index, {}, valid_session + assigns(:members).should eq([member]) + end + end + + describe "GET show" do + it "assigns the requested member as @member" do + member = Member.create! valid_attributes + get :show, {:id => member.to_param}, valid_session + assigns(:member).should eq(member) + end + end + + describe "GET new" do + it "assigns a new member as @member" do + get :new, {}, valid_session + assigns(:member).should be_a_new(Member) + end + end + + describe "GET edit" do + it "assigns the requested member as @member" do + member = Member.create! valid_attributes + get :edit, {:id => member.to_param}, valid_session + assigns(:member).should eq(member) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Member" do + expect { + post :create, {:member => valid_attributes}, valid_session + }.to change(Member, :count).by(1) + end + + it "assigns a newly created member as @member" do + post :create, {:member => valid_attributes}, valid_session + assigns(:member).should be_a(Member) + assigns(:member).should be_persisted + end + + it "redirects to the created member" do + post :create, {:member => valid_attributes}, valid_session + response.should redirect_to(Member.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved member as @member" do + # Trigger the behavior that occurs when invalid params are submitted + Member.any_instance.stub(:save).and_return(false) + post :create, {:member => {}}, valid_session + assigns(:member).should be_a_new(Member) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Member.any_instance.stub(:save).and_return(false) + post :create, {:member => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested member" do + member = Member.create! valid_attributes + # Assuming there are no other members in the database, this + # specifies that the Member created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Member.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => member.to_param, :member => {'these' => 'params'}}, valid_session + end + + it "assigns the requested member as @member" do + member = Member.create! valid_attributes + put :update, {:id => member.to_param, :member => valid_attributes}, valid_session + assigns(:member).should eq(member) + end + + it "redirects to the member" do + member = Member.create! valid_attributes + put :update, {:id => member.to_param, :member => valid_attributes}, valid_session + response.should redirect_to(member) + end + end + + describe "with invalid params" do + it "assigns the member as @member" do + member = Member.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Member.any_instance.stub(:save).and_return(false) + put :update, {:id => member.to_param, :member => {}}, valid_session + assigns(:member).should eq(member) + end + + it "re-renders the 'edit' template" do + member = Member.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Member.any_instance.stub(:save).and_return(false) + put :update, {:id => member.to_param, :member => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested member" do + member = Member.create! valid_attributes + expect { + delete :destroy, {:id => member.to_param}, valid_session + }.to change(Member, :count).by(-1) + end + + it "redirects to the members list" do + member = Member.create! valid_attributes + delete :destroy, {:id => member.to_param}, valid_session + response.should redirect_to(members_url) + end + end + +end diff --git a/spec/controllers/nightattacks_controller_spec.rb b/spec/controllers/nightattacks_controller_spec.rb new file mode 100644 index 0000000..6a57b03 --- /dev/null +++ b/spec/controllers/nightattacks_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe NightattacksController do + + # This should return the minimal set of attributes required to create a valid + # Nightattack. As you add validations to Nightattack, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # NightattacksController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all nightattacks as @nightattacks" do + nightattack = Nightattack.create! valid_attributes + get :index, {}, valid_session + assigns(:nightattacks).should eq([nightattack]) + end + end + + describe "GET show" do + it "assigns the requested nightattack as @nightattack" do + nightattack = Nightattack.create! valid_attributes + get :show, {:id => nightattack.to_param}, valid_session + assigns(:nightattack).should eq(nightattack) + end + end + + describe "GET new" do + it "assigns a new nightattack as @nightattack" do + get :new, {}, valid_session + assigns(:nightattack).should be_a_new(Nightattack) + end + end + + describe "GET edit" do + it "assigns the requested nightattack as @nightattack" do + nightattack = Nightattack.create! valid_attributes + get :edit, {:id => nightattack.to_param}, valid_session + assigns(:nightattack).should eq(nightattack) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Nightattack" do + expect { + post :create, {:nightattack => valid_attributes}, valid_session + }.to change(Nightattack, :count).by(1) + end + + it "assigns a newly created nightattack as @nightattack" do + post :create, {:nightattack => valid_attributes}, valid_session + assigns(:nightattack).should be_a(Nightattack) + assigns(:nightattack).should be_persisted + end + + it "redirects to the created nightattack" do + post :create, {:nightattack => valid_attributes}, valid_session + response.should redirect_to(Nightattack.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved nightattack as @nightattack" do + # Trigger the behavior that occurs when invalid params are submitted + Nightattack.any_instance.stub(:save).and_return(false) + post :create, {:nightattack => {}}, valid_session + assigns(:nightattack).should be_a_new(Nightattack) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Nightattack.any_instance.stub(:save).and_return(false) + post :create, {:nightattack => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested nightattack" do + nightattack = Nightattack.create! valid_attributes + # Assuming there are no other nightattacks in the database, this + # specifies that the Nightattack created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Nightattack.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => nightattack.to_param, :nightattack => {'these' => 'params'}}, valid_session + end + + it "assigns the requested nightattack as @nightattack" do + nightattack = Nightattack.create! valid_attributes + put :update, {:id => nightattack.to_param, :nightattack => valid_attributes}, valid_session + assigns(:nightattack).should eq(nightattack) + end + + it "redirects to the nightattack" do + nightattack = Nightattack.create! valid_attributes + put :update, {:id => nightattack.to_param, :nightattack => valid_attributes}, valid_session + response.should redirect_to(nightattack) + end + end + + describe "with invalid params" do + it "assigns the nightattack as @nightattack" do + nightattack = Nightattack.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Nightattack.any_instance.stub(:save).and_return(false) + put :update, {:id => nightattack.to_param, :nightattack => {}}, valid_session + assigns(:nightattack).should eq(nightattack) + end + + it "re-renders the 'edit' template" do + nightattack = Nightattack.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Nightattack.any_instance.stub(:save).and_return(false) + put :update, {:id => nightattack.to_param, :nightattack => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested nightattack" do + nightattack = Nightattack.create! valid_attributes + expect { + delete :destroy, {:id => nightattack.to_param}, valid_session + }.to change(Nightattack, :count).by(-1) + end + + it "redirects to the nightattacks list" do + nightattack = Nightattack.create! valid_attributes + delete :destroy, {:id => nightattack.to_param}, valid_session + response.should redirect_to(nightattacks_url) + end + end + +end diff --git a/spec/controllers/patients_controller_spec.rb b/spec/controllers/patients_controller_spec.rb new file mode 100644 index 0000000..1b4aa1d --- /dev/null +++ b/spec/controllers/patients_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe PatientsController do + + # This should return the minimal set of attributes required to create a valid + # Patient. As you add validations to Patient, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # PatientsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all patients as @patients" do + patient = Patient.create! valid_attributes + get :index, {}, valid_session + assigns(:patients).should eq([patient]) + end + end + + describe "GET show" do + it "assigns the requested patient as @patient" do + patient = Patient.create! valid_attributes + get :show, {:id => patient.to_param}, valid_session + assigns(:patient).should eq(patient) + end + end + + describe "GET new" do + it "assigns a new patient as @patient" do + get :new, {}, valid_session + assigns(:patient).should be_a_new(Patient) + end + end + + describe "GET edit" do + it "assigns the requested patient as @patient" do + patient = Patient.create! valid_attributes + get :edit, {:id => patient.to_param}, valid_session + assigns(:patient).should eq(patient) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Patient" do + expect { + post :create, {:patient => valid_attributes}, valid_session + }.to change(Patient, :count).by(1) + end + + it "assigns a newly created patient as @patient" do + post :create, {:patient => valid_attributes}, valid_session + assigns(:patient).should be_a(Patient) + assigns(:patient).should be_persisted + end + + it "redirects to the created patient" do + post :create, {:patient => valid_attributes}, valid_session + response.should redirect_to(Patient.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved patient as @patient" do + # Trigger the behavior that occurs when invalid params are submitted + Patient.any_instance.stub(:save).and_return(false) + post :create, {:patient => {}}, valid_session + assigns(:patient).should be_a_new(Patient) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Patient.any_instance.stub(:save).and_return(false) + post :create, {:patient => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested patient" do + patient = Patient.create! valid_attributes + # Assuming there are no other patients in the database, this + # specifies that the Patient created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Patient.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => patient.to_param, :patient => {'these' => 'params'}}, valid_session + end + + it "assigns the requested patient as @patient" do + patient = Patient.create! valid_attributes + put :update, {:id => patient.to_param, :patient => valid_attributes}, valid_session + assigns(:patient).should eq(patient) + end + + it "redirects to the patient" do + patient = Patient.create! valid_attributes + put :update, {:id => patient.to_param, :patient => valid_attributes}, valid_session + response.should redirect_to(patient) + end + end + + describe "with invalid params" do + it "assigns the patient as @patient" do + patient = Patient.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Patient.any_instance.stub(:save).and_return(false) + put :update, {:id => patient.to_param, :patient => {}}, valid_session + assigns(:patient).should eq(patient) + end + + it "re-renders the 'edit' template" do + patient = Patient.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Patient.any_instance.stub(:save).and_return(false) + put :update, {:id => patient.to_param, :patient => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested patient" do + patient = Patient.create! valid_attributes + expect { + delete :destroy, {:id => patient.to_param}, valid_session + }.to change(Patient, :count).by(-1) + end + + it "redirects to the patients list" do + patient = Patient.create! valid_attributes + delete :destroy, {:id => patient.to_param}, valid_session + response.should redirect_to(patients_url) + end + end + +end diff --git a/spec/controllers/roadcrimes_controller_spec.rb b/spec/controllers/roadcrimes_controller_spec.rb new file mode 100644 index 0000000..4acd8bb --- /dev/null +++ b/spec/controllers/roadcrimes_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe RoadcrimesController do + + # This should return the minimal set of attributes required to create a valid + # Roadcrime. As you add validations to Roadcrime, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # RoadcrimesController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all roadcrimes as @roadcrimes" do + roadcrime = Roadcrime.create! valid_attributes + get :index, {}, valid_session + assigns(:roadcrimes).should eq([roadcrime]) + end + end + + describe "GET show" do + it "assigns the requested roadcrime as @roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + get :show, {:id => roadcrime.to_param}, valid_session + assigns(:roadcrime).should eq(roadcrime) + end + end + + describe "GET new" do + it "assigns a new roadcrime as @roadcrime" do + get :new, {}, valid_session + assigns(:roadcrime).should be_a_new(Roadcrime) + end + end + + describe "GET edit" do + it "assigns the requested roadcrime as @roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + get :edit, {:id => roadcrime.to_param}, valid_session + assigns(:roadcrime).should eq(roadcrime) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Roadcrime" do + expect { + post :create, {:roadcrime => valid_attributes}, valid_session + }.to change(Roadcrime, :count).by(1) + end + + it "assigns a newly created roadcrime as @roadcrime" do + post :create, {:roadcrime => valid_attributes}, valid_session + assigns(:roadcrime).should be_a(Roadcrime) + assigns(:roadcrime).should be_persisted + end + + it "redirects to the created roadcrime" do + post :create, {:roadcrime => valid_attributes}, valid_session + response.should redirect_to(Roadcrime.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved roadcrime as @roadcrime" do + # Trigger the behavior that occurs when invalid params are submitted + Roadcrime.any_instance.stub(:save).and_return(false) + post :create, {:roadcrime => {}}, valid_session + assigns(:roadcrime).should be_a_new(Roadcrime) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Roadcrime.any_instance.stub(:save).and_return(false) + post :create, {:roadcrime => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + # Assuming there are no other roadcrimes in the database, this + # specifies that the Roadcrime created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Roadcrime.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => roadcrime.to_param, :roadcrime => {'these' => 'params'}}, valid_session + end + + it "assigns the requested roadcrime as @roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + put :update, {:id => roadcrime.to_param, :roadcrime => valid_attributes}, valid_session + assigns(:roadcrime).should eq(roadcrime) + end + + it "redirects to the roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + put :update, {:id => roadcrime.to_param, :roadcrime => valid_attributes}, valid_session + response.should redirect_to(roadcrime) + end + end + + describe "with invalid params" do + it "assigns the roadcrime as @roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Roadcrime.any_instance.stub(:save).and_return(false) + put :update, {:id => roadcrime.to_param, :roadcrime => {}}, valid_session + assigns(:roadcrime).should eq(roadcrime) + end + + it "re-renders the 'edit' template" do + roadcrime = Roadcrime.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Roadcrime.any_instance.stub(:save).and_return(false) + put :update, {:id => roadcrime.to_param, :roadcrime => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested roadcrime" do + roadcrime = Roadcrime.create! valid_attributes + expect { + delete :destroy, {:id => roadcrime.to_param}, valid_session + }.to change(Roadcrime, :count).by(-1) + end + + it "redirects to the roadcrimes list" do + roadcrime = Roadcrime.create! valid_attributes + delete :destroy, {:id => roadcrime.to_param}, valid_session + response.should redirect_to(roadcrimes_url) + end + end + +end diff --git a/spec/controllers/tbcases_controller_spec.rb b/spec/controllers/tbcases_controller_spec.rb new file mode 100644 index 0000000..08fe5b0 --- /dev/null +++ b/spec/controllers/tbcases_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TbcasesController do + + # This should return the minimal set of attributes required to create a valid + # Tbcase. As you add validations to Tbcase, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # TbcasesController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all tbcases as @tbcases" do + tbcase = Tbcase.create! valid_attributes + get :index, {}, valid_session + assigns(:tbcases).should eq([tbcase]) + end + end + + describe "GET show" do + it "assigns the requested tbcase as @tbcase" do + tbcase = Tbcase.create! valid_attributes + get :show, {:id => tbcase.to_param}, valid_session + assigns(:tbcase).should eq(tbcase) + end + end + + describe "GET new" do + it "assigns a new tbcase as @tbcase" do + get :new, {}, valid_session + assigns(:tbcase).should be_a_new(Tbcase) + end + end + + describe "GET edit" do + it "assigns the requested tbcase as @tbcase" do + tbcase = Tbcase.create! valid_attributes + get :edit, {:id => tbcase.to_param}, valid_session + assigns(:tbcase).should eq(tbcase) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Tbcase" do + expect { + post :create, {:tbcase => valid_attributes}, valid_session + }.to change(Tbcase, :count).by(1) + end + + it "assigns a newly created tbcase as @tbcase" do + post :create, {:tbcase => valid_attributes}, valid_session + assigns(:tbcase).should be_a(Tbcase) + assigns(:tbcase).should be_persisted + end + + it "redirects to the created tbcase" do + post :create, {:tbcase => valid_attributes}, valid_session + response.should redirect_to(Tbcase.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved tbcase as @tbcase" do + # Trigger the behavior that occurs when invalid params are submitted + Tbcase.any_instance.stub(:save).and_return(false) + post :create, {:tbcase => {}}, valid_session + assigns(:tbcase).should be_a_new(Tbcase) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Tbcase.any_instance.stub(:save).and_return(false) + post :create, {:tbcase => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested tbcase" do + tbcase = Tbcase.create! valid_attributes + # Assuming there are no other tbcases in the database, this + # specifies that the Tbcase created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Tbcase.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => tbcase.to_param, :tbcase => {'these' => 'params'}}, valid_session + end + + it "assigns the requested tbcase as @tbcase" do + tbcase = Tbcase.create! valid_attributes + put :update, {:id => tbcase.to_param, :tbcase => valid_attributes}, valid_session + assigns(:tbcase).should eq(tbcase) + end + + it "redirects to the tbcase" do + tbcase = Tbcase.create! valid_attributes + put :update, {:id => tbcase.to_param, :tbcase => valid_attributes}, valid_session + response.should redirect_to(tbcase) + end + end + + describe "with invalid params" do + it "assigns the tbcase as @tbcase" do + tbcase = Tbcase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tbcase.any_instance.stub(:save).and_return(false) + put :update, {:id => tbcase.to_param, :tbcase => {}}, valid_session + assigns(:tbcase).should eq(tbcase) + end + + it "re-renders the 'edit' template" do + tbcase = Tbcase.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tbcase.any_instance.stub(:save).and_return(false) + put :update, {:id => tbcase.to_param, :tbcase => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested tbcase" do + tbcase = Tbcase.create! valid_attributes + expect { + delete :destroy, {:id => tbcase.to_param}, valid_session + }.to change(Tbcase, :count).by(-1) + end + + it "redirects to the tbcases list" do + tbcase = Tbcase.create! valid_attributes + delete :destroy, {:id => tbcase.to_param}, valid_session + response.should redirect_to(tbcases_url) + end + end + +end diff --git a/spec/controllers/tbdotreports_controller_spec.rb b/spec/controllers/tbdotreports_controller_spec.rb new file mode 100644 index 0000000..c9e1e5d --- /dev/null +++ b/spec/controllers/tbdotreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TbdotreportsController do + + # This should return the minimal set of attributes required to create a valid + # Tbdotreport. As you add validations to Tbdotreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # TbdotreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all tbdotreports as @tbdotreports" do + tbdotreport = Tbdotreport.create! valid_attributes + get :index, {}, valid_session + assigns(:tbdotreports).should eq([tbdotreport]) + end + end + + describe "GET show" do + it "assigns the requested tbdotreport as @tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + get :show, {:id => tbdotreport.to_param}, valid_session + assigns(:tbdotreport).should eq(tbdotreport) + end + end + + describe "GET new" do + it "assigns a new tbdotreport as @tbdotreport" do + get :new, {}, valid_session + assigns(:tbdotreport).should be_a_new(Tbdotreport) + end + end + + describe "GET edit" do + it "assigns the requested tbdotreport as @tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + get :edit, {:id => tbdotreport.to_param}, valid_session + assigns(:tbdotreport).should eq(tbdotreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Tbdotreport" do + expect { + post :create, {:tbdotreport => valid_attributes}, valid_session + }.to change(Tbdotreport, :count).by(1) + end + + it "assigns a newly created tbdotreport as @tbdotreport" do + post :create, {:tbdotreport => valid_attributes}, valid_session + assigns(:tbdotreport).should be_a(Tbdotreport) + assigns(:tbdotreport).should be_persisted + end + + it "redirects to the created tbdotreport" do + post :create, {:tbdotreport => valid_attributes}, valid_session + response.should redirect_to(Tbdotreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved tbdotreport as @tbdotreport" do + # Trigger the behavior that occurs when invalid params are submitted + Tbdotreport.any_instance.stub(:save).and_return(false) + post :create, {:tbdotreport => {}}, valid_session + assigns(:tbdotreport).should be_a_new(Tbdotreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Tbdotreport.any_instance.stub(:save).and_return(false) + post :create, {:tbdotreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + # Assuming there are no other tbdotreports in the database, this + # specifies that the Tbdotreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Tbdotreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => tbdotreport.to_param, :tbdotreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested tbdotreport as @tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + put :update, {:id => tbdotreport.to_param, :tbdotreport => valid_attributes}, valid_session + assigns(:tbdotreport).should eq(tbdotreport) + end + + it "redirects to the tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + put :update, {:id => tbdotreport.to_param, :tbdotreport => valid_attributes}, valid_session + response.should redirect_to(tbdotreport) + end + end + + describe "with invalid params" do + it "assigns the tbdotreport as @tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tbdotreport.any_instance.stub(:save).and_return(false) + put :update, {:id => tbdotreport.to_param, :tbdotreport => {}}, valid_session + assigns(:tbdotreport).should eq(tbdotreport) + end + + it "re-renders the 'edit' template" do + tbdotreport = Tbdotreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tbdotreport.any_instance.stub(:save).and_return(false) + put :update, {:id => tbdotreport.to_param, :tbdotreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested tbdotreport" do + tbdotreport = Tbdotreport.create! valid_attributes + expect { + delete :destroy, {:id => tbdotreport.to_param}, valid_session + }.to change(Tbdotreport, :count).by(-1) + end + + it "redirects to the tbdotreports list" do + tbdotreport = Tbdotreport.create! valid_attributes + delete :destroy, {:id => tbdotreport.to_param}, valid_session + response.should redirect_to(tbdotreports_url) + end + end + +end diff --git a/spec/controllers/tblocationreports_controller_spec.rb b/spec/controllers/tblocationreports_controller_spec.rb new file mode 100644 index 0000000..42bc5dc --- /dev/null +++ b/spec/controllers/tblocationreports_controller_spec.rb @@ -0,0 +1,164 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe TblocationreportsController do + + # This should return the minimal set of attributes required to create a valid + # Tblocationreport. As you add validations to Tblocationreport, be sure to + # update the return value of this method accordingly. + def valid_attributes + {} + end + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # TblocationreportsController. Be sure to keep this updated too. + def valid_session + {} + end + + describe "GET index" do + it "assigns all tblocationreports as @tblocationreports" do + tblocationreport = Tblocationreport.create! valid_attributes + get :index, {}, valid_session + assigns(:tblocationreports).should eq([tblocationreport]) + end + end + + describe "GET show" do + it "assigns the requested tblocationreport as @tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + get :show, {:id => tblocationreport.to_param}, valid_session + assigns(:tblocationreport).should eq(tblocationreport) + end + end + + describe "GET new" do + it "assigns a new tblocationreport as @tblocationreport" do + get :new, {}, valid_session + assigns(:tblocationreport).should be_a_new(Tblocationreport) + end + end + + describe "GET edit" do + it "assigns the requested tblocationreport as @tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + get :edit, {:id => tblocationreport.to_param}, valid_session + assigns(:tblocationreport).should eq(tblocationreport) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Tblocationreport" do + expect { + post :create, {:tblocationreport => valid_attributes}, valid_session + }.to change(Tblocationreport, :count).by(1) + end + + it "assigns a newly created tblocationreport as @tblocationreport" do + post :create, {:tblocationreport => valid_attributes}, valid_session + assigns(:tblocationreport).should be_a(Tblocationreport) + assigns(:tblocationreport).should be_persisted + end + + it "redirects to the created tblocationreport" do + post :create, {:tblocationreport => valid_attributes}, valid_session + response.should redirect_to(Tblocationreport.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved tblocationreport as @tblocationreport" do + # Trigger the behavior that occurs when invalid params are submitted + Tblocationreport.any_instance.stub(:save).and_return(false) + post :create, {:tblocationreport => {}}, valid_session + assigns(:tblocationreport).should be_a_new(Tblocationreport) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Tblocationreport.any_instance.stub(:save).and_return(false) + post :create, {:tblocationreport => {}}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + # Assuming there are no other tblocationreports in the database, this + # specifies that the Tblocationreport created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Tblocationreport.any_instance.should_receive(:update_attributes).with({'these' => 'params'}) + put :update, {:id => tblocationreport.to_param, :tblocationreport => {'these' => 'params'}}, valid_session + end + + it "assigns the requested tblocationreport as @tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + put :update, {:id => tblocationreport.to_param, :tblocationreport => valid_attributes}, valid_session + assigns(:tblocationreport).should eq(tblocationreport) + end + + it "redirects to the tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + put :update, {:id => tblocationreport.to_param, :tblocationreport => valid_attributes}, valid_session + response.should redirect_to(tblocationreport) + end + end + + describe "with invalid params" do + it "assigns the tblocationreport as @tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tblocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => tblocationreport.to_param, :tblocationreport => {}}, valid_session + assigns(:tblocationreport).should eq(tblocationreport) + end + + it "re-renders the 'edit' template" do + tblocationreport = Tblocationreport.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Tblocationreport.any_instance.stub(:save).and_return(false) + put :update, {:id => tblocationreport.to_param, :tblocationreport => {}}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested tblocationreport" do + tblocationreport = Tblocationreport.create! valid_attributes + expect { + delete :destroy, {:id => tblocationreport.to_param}, valid_session + }.to change(Tblocationreport, :count).by(-1) + end + + it "redirects to the tblocationreports list" do + tblocationreport = Tblocationreport.create! valid_attributes + delete :destroy, {:id => tblocationreport.to_param}, valid_session + response.should redirect_to(tblocationreports_url) + end + end + +end diff --git a/spec/controllers/test_it_controller_spec.rb b/spec/controllers/test_it_controller_spec.rb new file mode 100644 index 0000000..5fa480d --- /dev/null +++ b/spec/controllers/test_it_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe TestItController do + +end diff --git a/spec/helpers/cattlethefts_helper_spec.rb b/spec/helpers/cattlethefts_helper_spec.rb new file mode 100644 index 0000000..7804feb --- /dev/null +++ b/spec/helpers/cattlethefts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the CattletheftsHelper. For example: +# +# describe CattletheftsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe CattletheftsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/childhealth_helper_spec.rb b/spec/helpers/childhealth_helper_spec.rb new file mode 100644 index 0000000..f5e7638 --- /dev/null +++ b/spec/helpers/childhealth_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ChildhealthHelper. For example: +# +# describe ChildhealthHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ChildhealthHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/community_health_workers_helper_spec.rb b/spec/helpers/community_health_workers_helper_spec.rb new file mode 100644 index 0000000..54e9137 --- /dev/null +++ b/spec/helpers/community_health_workers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the CommunityHealthWorkersHelper. For example: +# +# describe CommunityHealthWorkersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe CommunityHealthWorkersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/conflicts_helper_spec.rb b/spec/helpers/conflicts_helper_spec.rb new file mode 100644 index 0000000..1d68883 --- /dev/null +++ b/spec/helpers/conflicts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ConflictsHelper. For example: +# +# describe ConflictsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ConflictsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/dotsmembers_helper_spec.rb b/spec/helpers/dotsmembers_helper_spec.rb new file mode 100644 index 0000000..58aec24 --- /dev/null +++ b/spec/helpers/dotsmembers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the DotsmembersHelper. For example: +# +# describe DotsmembersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe DotsmembersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/firearms_helper_spec.rb b/spec/helpers/firearms_helper_spec.rb new file mode 100644 index 0000000..9ce32e7 --- /dev/null +++ b/spec/helpers/firearms_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the FirearmsHelper. For example: +# +# describe FirearmsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe FirearmsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivaid_helper_spec.rb b/spec/helpers/hivaid_helper_spec.rb new file mode 100644 index 0000000..7b48c7d --- /dev/null +++ b/spec/helpers/hivaid_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivaidHelper. For example: +# +# describe HivaidHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivaidHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivcases_helper_spec.rb b/spec/helpers/hivcases_helper_spec.rb new file mode 100644 index 0000000..b05468d --- /dev/null +++ b/spec/helpers/hivcases_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivcasesHelper. For example: +# +# describe HivcasesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivcasesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivcontraceptionreports_helper_spec.rb b/spec/helpers/hivcontraceptionreports_helper_spec.rb new file mode 100644 index 0000000..a85a5ba --- /dev/null +++ b/spec/helpers/hivcontraceptionreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivcontraceptionreportsHelper. For example: +# +# describe HivcontraceptionreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivcontraceptionreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivdrugreports_helper_spec.rb b/spec/helpers/hivdrugreports_helper_spec.rb new file mode 100644 index 0000000..39259bc --- /dev/null +++ b/spec/helpers/hivdrugreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivdrugreportsHelper. For example: +# +# describe HivdrugreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivdrugreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivgenderreports_helper_spec.rb b/spec/helpers/hivgenderreports_helper_spec.rb new file mode 100644 index 0000000..b4e2aa4 --- /dev/null +++ b/spec/helpers/hivgenderreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivgenderreportsHelper. For example: +# +# describe HivgenderreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivgenderreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/hivlocationreports_helper_spec.rb b/spec/helpers/hivlocationreports_helper_spec.rb new file mode 100644 index 0000000..c18a9bb --- /dev/null +++ b/spec/helpers/hivlocationreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the HivlocationreportsHelper. For example: +# +# describe HivlocationreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe HivlocationreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/immunization_helper_spec.rb b/spec/helpers/immunization_helper_spec.rb new file mode 100644 index 0000000..b2206e0 --- /dev/null +++ b/spec/helpers/immunization_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ImmunizationHelper. For example: +# +# describe ImmunizationHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ImmunizationHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/locationreports_helper_spec.rb b/spec/helpers/locationreports_helper_spec.rb new file mode 100644 index 0000000..41e1c8c --- /dev/null +++ b/spec/helpers/locationreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the LocationreportsHelper. For example: +# +# describe LocationreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe LocationreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/locations_helper_spec.rb b/spec/helpers/locations_helper_spec.rb new file mode 100644 index 0000000..6ec6b50 --- /dev/null +++ b/spec/helpers/locations_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the LocationsHelper. For example: +# +# describe LocationsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe LocationsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/malaria_helper_spec.rb b/spec/helpers/malaria_helper_spec.rb new file mode 100644 index 0000000..2d6ad01 --- /dev/null +++ b/spec/helpers/malaria_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MalariaHelper. For example: +# +# describe MalariaHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MalariaHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/malariacases_helper_spec.rb b/spec/helpers/malariacases_helper_spec.rb new file mode 100644 index 0000000..32fdb98 --- /dev/null +++ b/spec/helpers/malariacases_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MalariacasesHelper. For example: +# +# describe MalariacasesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MalariacasesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/malariagenderreports_helper_spec.rb b/spec/helpers/malariagenderreports_helper_spec.rb new file mode 100644 index 0000000..10034c8 --- /dev/null +++ b/spec/helpers/malariagenderreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MalariagenderreportsHelper. For example: +# +# describe MalariagenderreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MalariagenderreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/malarialocationreports_helper_spec.rb b/spec/helpers/malarialocationreports_helper_spec.rb new file mode 100644 index 0000000..d427899 --- /dev/null +++ b/spec/helpers/malarialocationreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MalarialocationreportsHelper. For example: +# +# describe MalarialocationreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MalarialocationreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/malariapreventationreports_helper_spec.rb b/spec/helpers/malariapreventationreports_helper_spec.rb new file mode 100644 index 0000000..913f80b --- /dev/null +++ b/spec/helpers/malariapreventationreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MalariapreventationreportsHelper. For example: +# +# describe MalariapreventationreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MalariapreventationreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/members_helper_spec.rb b/spec/helpers/members_helper_spec.rb new file mode 100644 index 0000000..a65d502 --- /dev/null +++ b/spec/helpers/members_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the MembersHelper. For example: +# +# describe MembersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe MembersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/nightattacks_helper_spec.rb b/spec/helpers/nightattacks_helper_spec.rb new file mode 100644 index 0000000..a636542 --- /dev/null +++ b/spec/helpers/nightattacks_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the NightattacksHelper. For example: +# +# describe NightattacksHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe NightattacksHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/patients_helper_spec.rb b/spec/helpers/patients_helper_spec.rb new file mode 100644 index 0000000..bae1527 --- /dev/null +++ b/spec/helpers/patients_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the PatientsHelper. For example: +# +# describe PatientsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe PatientsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/roadcrimes_helper_spec.rb b/spec/helpers/roadcrimes_helper_spec.rb new file mode 100644 index 0000000..4f44350 --- /dev/null +++ b/spec/helpers/roadcrimes_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the RoadcrimesHelper. For example: +# +# describe RoadcrimesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe RoadcrimesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rb new file mode 100644 index 0000000..0c971f0 --- /dev/null +++ b/spec/helpers/settings_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SettingsHelper. For example: +# +# describe SettingsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe SettingsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/smsmessages_helper_spec.rb b/spec/helpers/smsmessages_helper_spec.rb new file mode 100644 index 0000000..f043d1d --- /dev/null +++ b/spec/helpers/smsmessages_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SmsmessagesHelper. For example: +# +# describe SmsmessagesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe SmsmessagesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tb_helper_spec.rb b/spec/helpers/tb_helper_spec.rb new file mode 100644 index 0000000..38c5b2f --- /dev/null +++ b/spec/helpers/tb_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TbHelper. For example: +# +# describe TbHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TbHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tbcases_helper_spec.rb b/spec/helpers/tbcases_helper_spec.rb new file mode 100644 index 0000000..2ce15f5 --- /dev/null +++ b/spec/helpers/tbcases_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TbcasesHelper. For example: +# +# describe TbcasesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TbcasesHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tbdotreports_helper_spec.rb b/spec/helpers/tbdotreports_helper_spec.rb new file mode 100644 index 0000000..b0ed7db --- /dev/null +++ b/spec/helpers/tbdotreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TbdotreportsHelper. For example: +# +# describe TbdotreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TbdotreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/tblocationreports_helper_spec.rb b/spec/helpers/tblocationreports_helper_spec.rb new file mode 100644 index 0000000..aaf27d3 --- /dev/null +++ b/spec/helpers/tblocationreports_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TblocationreportsHelper. For example: +# +# describe TblocationreportsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TblocationreportsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/test_it_helper_spec.rb b/spec/helpers/test_it_helper_spec.rb new file mode 100644 index 0000000..ad5837b --- /dev/null +++ b/spec/helpers/test_it_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the TestItHelper. For example: +# +# describe TestItHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe TestItHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/villageworkers_helper_spec.rb b/spec/helpers/villageworkers_helper_spec.rb new file mode 100644 index 0000000..739915b --- /dev/null +++ b/spec/helpers/villageworkers_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the VillageworkersHelper. For example: +# +# describe VillageworkersHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe VillageworkersHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/cattletheft_spec.rb b/spec/models/cattletheft_spec.rb new file mode 100644 index 0000000..f71dc9d --- /dev/null +++ b/spec/models/cattletheft_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Cattletheft do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/conflict_spec.rb b/spec/models/conflict_spec.rb new file mode 100644 index 0000000..898bc54 --- /dev/null +++ b/spec/models/conflict_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Conflict do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/dotsmember_spec.rb b/spec/models/dotsmember_spec.rb new file mode 100644 index 0000000..d2b7ca5 --- /dev/null +++ b/spec/models/dotsmember_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Dotsmember do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/firearm_spec.rb b/spec/models/firearm_spec.rb new file mode 100644 index 0000000..9eb6e62 --- /dev/null +++ b/spec/models/firearm_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Firearm do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hivcase_spec.rb b/spec/models/hivcase_spec.rb new file mode 100644 index 0000000..c125f52 --- /dev/null +++ b/spec/models/hivcase_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Hivcase do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hivcontraceptionreport_spec.rb b/spec/models/hivcontraceptionreport_spec.rb new file mode 100644 index 0000000..e3eac36 --- /dev/null +++ b/spec/models/hivcontraceptionreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Hivcontraceptionreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hivdrugreport_spec.rb b/spec/models/hivdrugreport_spec.rb new file mode 100644 index 0000000..be05a76 --- /dev/null +++ b/spec/models/hivdrugreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Hivdrugreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hivgenderreport_spec.rb b/spec/models/hivgenderreport_spec.rb new file mode 100644 index 0000000..2042b67 --- /dev/null +++ b/spec/models/hivgenderreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Hivgenderreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/hivlocationreport_spec.rb b/spec/models/hivlocationreport_spec.rb new file mode 100644 index 0000000..7ca33f9 --- /dev/null +++ b/spec/models/hivlocationreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Hivlocationreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/locationreport_spec.rb b/spec/models/locationreport_spec.rb new file mode 100644 index 0000000..3176d21 --- /dev/null +++ b/spec/models/locationreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Locationreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/malariacase_spec.rb b/spec/models/malariacase_spec.rb new file mode 100644 index 0000000..cbc94df --- /dev/null +++ b/spec/models/malariacase_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Malariacase do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/malariagenderreport_spec.rb b/spec/models/malariagenderreport_spec.rb new file mode 100644 index 0000000..d74a0d1 --- /dev/null +++ b/spec/models/malariagenderreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Malariagenderreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/malarialocationreport_spec.rb b/spec/models/malarialocationreport_spec.rb new file mode 100644 index 0000000..9720393 --- /dev/null +++ b/spec/models/malarialocationreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Malarialocationreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/malariapreventationreport_spec.rb b/spec/models/malariapreventationreport_spec.rb new file mode 100644 index 0000000..d88a8c0 --- /dev/null +++ b/spec/models/malariapreventationreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Malariapreventationreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb new file mode 100644 index 0000000..cd99fba --- /dev/null +++ b/spec/models/member_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Member do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/nightattack_spec.rb b/spec/models/nightattack_spec.rb new file mode 100644 index 0000000..3dce200 --- /dev/null +++ b/spec/models/nightattack_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Nightattack do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/patient_spec.rb b/spec/models/patient_spec.rb new file mode 100644 index 0000000..d76cc6e --- /dev/null +++ b/spec/models/patient_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Patient do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/patients/patientprocessor.rb b/spec/models/patients/patientprocessor.rb new file mode 100644 index 0000000..1c107c8 --- /dev/null +++ b/spec/models/patients/patientprocessor.rb @@ -0,0 +1,21 @@ +require 'spec_helper' +describe Patientprocessor do + +#Before each example spec create a new instance class of patient processor + +it "Validates Sms Add New Patient Command" do +@textmessageparse = Patientprocessor.new("New Patient,Eric Kiilu,M,1923") +@textmessageparse.validNewPatientCommand?.should == true +end + + +it "in Validates Lack of patient name " do +@textmessageparse = Patientprocessor.new("New Patient,,M,1923") +@textmessageparse.validNewPatientCommand?.should ==false +end +pending +it "Should register a new patient successfully" do +@textmessageparse = Patientprocessor.new("New Patient,Eric Kiilu,M,1923") +end + +end diff --git a/spec/models/patients/textmessageparser.rb b/spec/models/patients/textmessageparser.rb new file mode 100644 index 0000000..101b047 --- /dev/null +++ b/spec/models/patients/textmessageparser.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe Textmessageparser do + +before(:each) do + +@communityworker = Villageworker.new +@communityworker.firstname = "Eric" +@communityworker.lastname = "Kiilu" +@communityworker.middlename ="M" +@communityworker.phonenumber ="+254714136136" +@communityworker.nationalid = "32333" +@communityworker.male = "M" +@communityworker.village = 2 +@communityworker.save +end + +it "is a registered phone number" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validatePhone.should == true +end + +it "has valid starting command" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validStartCommand.should == true +end + + + + + +end + diff --git a/spec/models/roadcrime_spec.rb b/spec/models/roadcrime_spec.rb new file mode 100644 index 0000000..bcb7018 --- /dev/null +++ b/spec/models/roadcrime_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Roadcrime do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/smsmessage_spec.rb b/spec/models/smsmessage_spec.rb new file mode 100644 index 0000000..eca43f9 --- /dev/null +++ b/spec/models/smsmessage_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe Smsmessage do + pending "add some examples to (or delete) #{__FILE__}" + +before(:each) do +@sms_eater = double('smsmessage').as_null_object +end + + +end diff --git a/spec/models/tbcase_spec.rb b/spec/models/tbcase_spec.rb new file mode 100644 index 0000000..6c52776 --- /dev/null +++ b/spec/models/tbcase_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Tbcase do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tbdotreport_spec.rb b/spec/models/tbdotreport_spec.rb new file mode 100644 index 0000000..6212d50 --- /dev/null +++ b/spec/models/tbdotreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Tbdotreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/tblocationreport_spec.rb b/spec/models/tblocationreport_spec.rb new file mode 100644 index 0000000..657461a --- /dev/null +++ b/spec/models/tblocationreport_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Tblocationreport do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/textmessageparser/smsparser.rb b/spec/models/textmessageparser/smsparser.rb new file mode 100644 index 0000000..df5895d --- /dev/null +++ b/spec/models/textmessageparser/smsparser.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Textmessageparser do + +before(:each) do + +@communityworker = Villageworker.new +@communityworker.firstname = "Eric" +@communityworker.lastname = "Kiilu" +@communityworker.middlename ="M" +@communityworker.phonenumber ="+254714136136" +@communityworker.nationalid = "32333" +@communityworker.male = "M" +@communityworker.village = 2 +@communityworker.save +end + +it "is a registered phone number" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validatePhone.should == true +end + +it "has valid starting command" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validStartCommand.should == true +end + + + +end + diff --git a/spec/models/textmessageparser/textmessageparser.rb b/spec/models/textmessageparser/textmessageparser.rb new file mode 100644 index 0000000..df5895d --- /dev/null +++ b/spec/models/textmessageparser/textmessageparser.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe Textmessageparser do + +before(:each) do + +@communityworker = Villageworker.new +@communityworker.firstname = "Eric" +@communityworker.lastname = "Kiilu" +@communityworker.middlename ="M" +@communityworker.phonenumber ="+254714136136" +@communityworker.nationalid = "32333" +@communityworker.male = "M" +@communityworker.village = 2 +@communityworker.save +end + +it "is a registered phone number" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validatePhone.should == true +end + +it "has valid starting command" do +@textmessageparse = Textmessageparser.new("+254714136136","New Patient,Eric Kiilu,M,1923") +@textmessageparse.validStartCommand.should == true +end + + + +end + diff --git a/spec/requests/cattlethefts_spec.rb b/spec/requests/cattlethefts_spec.rb new file mode 100644 index 0000000..6bbb883 --- /dev/null +++ b/spec/requests/cattlethefts_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Cattlethefts" do + describe "GET /cattlethefts" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get cattlethefts_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/community_health_workers_spec.rb b/spec/requests/community_health_workers_spec.rb new file mode 100644 index 0000000..c6555c5 --- /dev/null +++ b/spec/requests/community_health_workers_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "CommunityHealthWorkers" do + describe "GET /community_health_workers" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get community_health_workers_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/conflicts_spec.rb b/spec/requests/conflicts_spec.rb new file mode 100644 index 0000000..5e0c162 --- /dev/null +++ b/spec/requests/conflicts_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Conflicts" do + describe "GET /conflicts" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get conflicts_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/dotsmembers_spec.rb b/spec/requests/dotsmembers_spec.rb new file mode 100644 index 0000000..b815807 --- /dev/null +++ b/spec/requests/dotsmembers_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Dotsmembers" do + describe "GET /dotsmembers" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get dotsmembers_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/firearms_spec.rb b/spec/requests/firearms_spec.rb new file mode 100644 index 0000000..fdabe33 --- /dev/null +++ b/spec/requests/firearms_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Firearms" do + describe "GET /firearms" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get firearms_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/hivcases_spec.rb b/spec/requests/hivcases_spec.rb new file mode 100644 index 0000000..a485b15 --- /dev/null +++ b/spec/requests/hivcases_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Hivcases" do + describe "GET /hivcases" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get hivcases_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/hivcontraceptionreports_spec.rb b/spec/requests/hivcontraceptionreports_spec.rb new file mode 100644 index 0000000..6ab528f --- /dev/null +++ b/spec/requests/hivcontraceptionreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Hivcontraceptionreports" do + describe "GET /hivcontraceptionreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get hivcontraceptionreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/hivdrugreports_spec.rb b/spec/requests/hivdrugreports_spec.rb new file mode 100644 index 0000000..694f9ea --- /dev/null +++ b/spec/requests/hivdrugreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Hivdrugreports" do + describe "GET /hivdrugreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get hivdrugreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/hivgenderreports_spec.rb b/spec/requests/hivgenderreports_spec.rb new file mode 100644 index 0000000..f389711 --- /dev/null +++ b/spec/requests/hivgenderreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Hivgenderreports" do + describe "GET /hivgenderreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get hivgenderreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/hivlocationreports_spec.rb b/spec/requests/hivlocationreports_spec.rb new file mode 100644 index 0000000..346ae11 --- /dev/null +++ b/spec/requests/hivlocationreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Hivlocationreports" do + describe "GET /hivlocationreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get hivlocationreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/locationreports_spec.rb b/spec/requests/locationreports_spec.rb new file mode 100644 index 0000000..c035216 --- /dev/null +++ b/spec/requests/locationreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Locationreports" do + describe "GET /locationreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get locationreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/locations_spec.rb b/spec/requests/locations_spec.rb new file mode 100644 index 0000000..9c59a40 --- /dev/null +++ b/spec/requests/locations_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Locations" do + describe "GET /locations" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get locations_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/malariacases_spec.rb b/spec/requests/malariacases_spec.rb new file mode 100644 index 0000000..b789fd7 --- /dev/null +++ b/spec/requests/malariacases_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Malariacases" do + describe "GET /malariacases" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get malariacases_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/malariagenderreports_spec.rb b/spec/requests/malariagenderreports_spec.rb new file mode 100644 index 0000000..3691105 --- /dev/null +++ b/spec/requests/malariagenderreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Malariagenderreports" do + describe "GET /malariagenderreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get malariagenderreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/malarialocationreports_spec.rb b/spec/requests/malarialocationreports_spec.rb new file mode 100644 index 0000000..ae76394 --- /dev/null +++ b/spec/requests/malarialocationreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Malarialocationreports" do + describe "GET /malarialocationreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get malarialocationreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/malariapreventationreports_spec.rb b/spec/requests/malariapreventationreports_spec.rb new file mode 100644 index 0000000..1c86ce2 --- /dev/null +++ b/spec/requests/malariapreventationreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Malariapreventationreports" do + describe "GET /malariapreventationreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get malariapreventationreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/members_spec.rb b/spec/requests/members_spec.rb new file mode 100644 index 0000000..b3cb615 --- /dev/null +++ b/spec/requests/members_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Members" do + describe "GET /members" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get members_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/nightattacks_spec.rb b/spec/requests/nightattacks_spec.rb new file mode 100644 index 0000000..88f0bbd --- /dev/null +++ b/spec/requests/nightattacks_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Nightattacks" do + describe "GET /nightattacks" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get nightattacks_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/patients_spec.rb b/spec/requests/patients_spec.rb new file mode 100644 index 0000000..6274c59 --- /dev/null +++ b/spec/requests/patients_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Patients" do + describe "GET /patients" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get patients_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/roadcrimes_spec.rb b/spec/requests/roadcrimes_spec.rb new file mode 100644 index 0000000..d148ec3 --- /dev/null +++ b/spec/requests/roadcrimes_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Roadcrimes" do + describe "GET /roadcrimes" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get roadcrimes_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/smsmessages_spec.rb b/spec/requests/smsmessages_spec.rb new file mode 100644 index 0000000..61d6c1e --- /dev/null +++ b/spec/requests/smsmessages_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Smsmessages" do + describe "GET /smsmessages" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get smsmessages_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/tbcases_spec.rb b/spec/requests/tbcases_spec.rb new file mode 100644 index 0000000..eb74766 --- /dev/null +++ b/spec/requests/tbcases_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Tbcases" do + describe "GET /tbcases" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get tbcases_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/tbdotreports_spec.rb b/spec/requests/tbdotreports_spec.rb new file mode 100644 index 0000000..b0d22a3 --- /dev/null +++ b/spec/requests/tbdotreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Tbdotreports" do + describe "GET /tbdotreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get tbdotreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/tblocationreports_spec.rb b/spec/requests/tblocationreports_spec.rb new file mode 100644 index 0000000..283db2e --- /dev/null +++ b/spec/requests/tblocationreports_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Tblocationreports" do + describe "GET /tblocationreports" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get tblocationreports_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/villageworkers_spec.rb b/spec/requests/villageworkers_spec.rb new file mode 100644 index 0000000..a46790d --- /dev/null +++ b/spec/requests/villageworkers_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Villageworkers" do + describe "GET /villageworkers" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get villageworkers_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/cattlethefts_routing_spec.rb b/spec/routing/cattlethefts_routing_spec.rb new file mode 100644 index 0000000..aa4f9cc --- /dev/null +++ b/spec/routing/cattlethefts_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe CattletheftsController do + describe "routing" do + + it "routes to #index" do + get("/cattlethefts").should route_to("cattlethefts#index") + end + + it "routes to #new" do + get("/cattlethefts/new").should route_to("cattlethefts#new") + end + + it "routes to #show" do + get("/cattlethefts/1").should route_to("cattlethefts#show", :id => "1") + end + + it "routes to #edit" do + get("/cattlethefts/1/edit").should route_to("cattlethefts#edit", :id => "1") + end + + it "routes to #create" do + post("/cattlethefts").should route_to("cattlethefts#create") + end + + it "routes to #update" do + put("/cattlethefts/1").should route_to("cattlethefts#update", :id => "1") + end + + it "routes to #destroy" do + delete("/cattlethefts/1").should route_to("cattlethefts#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/community_health_workers_routing_spec.rb b/spec/routing/community_health_workers_routing_spec.rb new file mode 100644 index 0000000..7f0c7f7 --- /dev/null +++ b/spec/routing/community_health_workers_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe CommunityHealthWorkersController do + describe "routing" do + + it "routes to #index" do + get("/community_health_workers").should route_to("community_health_workers#index") + end + + it "routes to #new" do + get("/community_health_workers/new").should route_to("community_health_workers#new") + end + + it "routes to #show" do + get("/community_health_workers/1").should route_to("community_health_workers#show", :id => "1") + end + + it "routes to #edit" do + get("/community_health_workers/1/edit").should route_to("community_health_workers#edit", :id => "1") + end + + it "routes to #create" do + post("/community_health_workers").should route_to("community_health_workers#create") + end + + it "routes to #update" do + put("/community_health_workers/1").should route_to("community_health_workers#update", :id => "1") + end + + it "routes to #destroy" do + delete("/community_health_workers/1").should route_to("community_health_workers#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/conflicts_routing_spec.rb b/spec/routing/conflicts_routing_spec.rb new file mode 100644 index 0000000..f1548f6 --- /dev/null +++ b/spec/routing/conflicts_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ConflictsController do + describe "routing" do + + it "routes to #index" do + get("/conflicts").should route_to("conflicts#index") + end + + it "routes to #new" do + get("/conflicts/new").should route_to("conflicts#new") + end + + it "routes to #show" do + get("/conflicts/1").should route_to("conflicts#show", :id => "1") + end + + it "routes to #edit" do + get("/conflicts/1/edit").should route_to("conflicts#edit", :id => "1") + end + + it "routes to #create" do + post("/conflicts").should route_to("conflicts#create") + end + + it "routes to #update" do + put("/conflicts/1").should route_to("conflicts#update", :id => "1") + end + + it "routes to #destroy" do + delete("/conflicts/1").should route_to("conflicts#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/dotsmembers_routing_spec.rb b/spec/routing/dotsmembers_routing_spec.rb new file mode 100644 index 0000000..3a338de --- /dev/null +++ b/spec/routing/dotsmembers_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe DotsmembersController do + describe "routing" do + + it "routes to #index" do + get("/dotsmembers").should route_to("dotsmembers#index") + end + + it "routes to #new" do + get("/dotsmembers/new").should route_to("dotsmembers#new") + end + + it "routes to #show" do + get("/dotsmembers/1").should route_to("dotsmembers#show", :id => "1") + end + + it "routes to #edit" do + get("/dotsmembers/1/edit").should route_to("dotsmembers#edit", :id => "1") + end + + it "routes to #create" do + post("/dotsmembers").should route_to("dotsmembers#create") + end + + it "routes to #update" do + put("/dotsmembers/1").should route_to("dotsmembers#update", :id => "1") + end + + it "routes to #destroy" do + delete("/dotsmembers/1").should route_to("dotsmembers#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/firearms_routing_spec.rb b/spec/routing/firearms_routing_spec.rb new file mode 100644 index 0000000..6e8f37e --- /dev/null +++ b/spec/routing/firearms_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe FirearmsController do + describe "routing" do + + it "routes to #index" do + get("/firearms").should route_to("firearms#index") + end + + it "routes to #new" do + get("/firearms/new").should route_to("firearms#new") + end + + it "routes to #show" do + get("/firearms/1").should route_to("firearms#show", :id => "1") + end + + it "routes to #edit" do + get("/firearms/1/edit").should route_to("firearms#edit", :id => "1") + end + + it "routes to #create" do + post("/firearms").should route_to("firearms#create") + end + + it "routes to #update" do + put("/firearms/1").should route_to("firearms#update", :id => "1") + end + + it "routes to #destroy" do + delete("/firearms/1").should route_to("firearms#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/hivcases_routing_spec.rb b/spec/routing/hivcases_routing_spec.rb new file mode 100644 index 0000000..6e4078b --- /dev/null +++ b/spec/routing/hivcases_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe HivcasesController do + describe "routing" do + + it "routes to #index" do + get("/hivcases").should route_to("hivcases#index") + end + + it "routes to #new" do + get("/hivcases/new").should route_to("hivcases#new") + end + + it "routes to #show" do + get("/hivcases/1").should route_to("hivcases#show", :id => "1") + end + + it "routes to #edit" do + get("/hivcases/1/edit").should route_to("hivcases#edit", :id => "1") + end + + it "routes to #create" do + post("/hivcases").should route_to("hivcases#create") + end + + it "routes to #update" do + put("/hivcases/1").should route_to("hivcases#update", :id => "1") + end + + it "routes to #destroy" do + delete("/hivcases/1").should route_to("hivcases#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/hivcontraceptionreports_routing_spec.rb b/spec/routing/hivcontraceptionreports_routing_spec.rb new file mode 100644 index 0000000..ee7edcf --- /dev/null +++ b/spec/routing/hivcontraceptionreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe HivcontraceptionreportsController do + describe "routing" do + + it "routes to #index" do + get("/hivcontraceptionreports").should route_to("hivcontraceptionreports#index") + end + + it "routes to #new" do + get("/hivcontraceptionreports/new").should route_to("hivcontraceptionreports#new") + end + + it "routes to #show" do + get("/hivcontraceptionreports/1").should route_to("hivcontraceptionreports#show", :id => "1") + end + + it "routes to #edit" do + get("/hivcontraceptionreports/1/edit").should route_to("hivcontraceptionreports#edit", :id => "1") + end + + it "routes to #create" do + post("/hivcontraceptionreports").should route_to("hivcontraceptionreports#create") + end + + it "routes to #update" do + put("/hivcontraceptionreports/1").should route_to("hivcontraceptionreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/hivcontraceptionreports/1").should route_to("hivcontraceptionreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/hivdrugreports_routing_spec.rb b/spec/routing/hivdrugreports_routing_spec.rb new file mode 100644 index 0000000..e92e1fe --- /dev/null +++ b/spec/routing/hivdrugreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe HivdrugreportsController do + describe "routing" do + + it "routes to #index" do + get("/hivdrugreports").should route_to("hivdrugreports#index") + end + + it "routes to #new" do + get("/hivdrugreports/new").should route_to("hivdrugreports#new") + end + + it "routes to #show" do + get("/hivdrugreports/1").should route_to("hivdrugreports#show", :id => "1") + end + + it "routes to #edit" do + get("/hivdrugreports/1/edit").should route_to("hivdrugreports#edit", :id => "1") + end + + it "routes to #create" do + post("/hivdrugreports").should route_to("hivdrugreports#create") + end + + it "routes to #update" do + put("/hivdrugreports/1").should route_to("hivdrugreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/hivdrugreports/1").should route_to("hivdrugreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/hivgenderreports_routing_spec.rb b/spec/routing/hivgenderreports_routing_spec.rb new file mode 100644 index 0000000..8514389 --- /dev/null +++ b/spec/routing/hivgenderreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe HivgenderreportsController do + describe "routing" do + + it "routes to #index" do + get("/hivgenderreports").should route_to("hivgenderreports#index") + end + + it "routes to #new" do + get("/hivgenderreports/new").should route_to("hivgenderreports#new") + end + + it "routes to #show" do + get("/hivgenderreports/1").should route_to("hivgenderreports#show", :id => "1") + end + + it "routes to #edit" do + get("/hivgenderreports/1/edit").should route_to("hivgenderreports#edit", :id => "1") + end + + it "routes to #create" do + post("/hivgenderreports").should route_to("hivgenderreports#create") + end + + it "routes to #update" do + put("/hivgenderreports/1").should route_to("hivgenderreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/hivgenderreports/1").should route_to("hivgenderreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/hivlocationreports_routing_spec.rb b/spec/routing/hivlocationreports_routing_spec.rb new file mode 100644 index 0000000..abbcd29 --- /dev/null +++ b/spec/routing/hivlocationreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe HivlocationreportsController do + describe "routing" do + + it "routes to #index" do + get("/hivlocationreports").should route_to("hivlocationreports#index") + end + + it "routes to #new" do + get("/hivlocationreports/new").should route_to("hivlocationreports#new") + end + + it "routes to #show" do + get("/hivlocationreports/1").should route_to("hivlocationreports#show", :id => "1") + end + + it "routes to #edit" do + get("/hivlocationreports/1/edit").should route_to("hivlocationreports#edit", :id => "1") + end + + it "routes to #create" do + post("/hivlocationreports").should route_to("hivlocationreports#create") + end + + it "routes to #update" do + put("/hivlocationreports/1").should route_to("hivlocationreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/hivlocationreports/1").should route_to("hivlocationreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/locationreports_routing_spec.rb b/spec/routing/locationreports_routing_spec.rb new file mode 100644 index 0000000..1441578 --- /dev/null +++ b/spec/routing/locationreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe LocationreportsController do + describe "routing" do + + it "routes to #index" do + get("/locationreports").should route_to("locationreports#index") + end + + it "routes to #new" do + get("/locationreports/new").should route_to("locationreports#new") + end + + it "routes to #show" do + get("/locationreports/1").should route_to("locationreports#show", :id => "1") + end + + it "routes to #edit" do + get("/locationreports/1/edit").should route_to("locationreports#edit", :id => "1") + end + + it "routes to #create" do + post("/locationreports").should route_to("locationreports#create") + end + + it "routes to #update" do + put("/locationreports/1").should route_to("locationreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/locationreports/1").should route_to("locationreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/locations_routing_spec.rb b/spec/routing/locations_routing_spec.rb new file mode 100644 index 0000000..453d915 --- /dev/null +++ b/spec/routing/locations_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe LocationsController do + describe "routing" do + + it "routes to #index" do + get("/locations").should route_to("locations#index") + end + + it "routes to #new" do + get("/locations/new").should route_to("locations#new") + end + + it "routes to #show" do + get("/locations/1").should route_to("locations#show", :id => "1") + end + + it "routes to #edit" do + get("/locations/1/edit").should route_to("locations#edit", :id => "1") + end + + it "routes to #create" do + post("/locations").should route_to("locations#create") + end + + it "routes to #update" do + put("/locations/1").should route_to("locations#update", :id => "1") + end + + it "routes to #destroy" do + delete("/locations/1").should route_to("locations#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/malariacases_routing_spec.rb b/spec/routing/malariacases_routing_spec.rb new file mode 100644 index 0000000..cbe504e --- /dev/null +++ b/spec/routing/malariacases_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MalariacasesController do + describe "routing" do + + it "routes to #index" do + get("/malariacases").should route_to("malariacases#index") + end + + it "routes to #new" do + get("/malariacases/new").should route_to("malariacases#new") + end + + it "routes to #show" do + get("/malariacases/1").should route_to("malariacases#show", :id => "1") + end + + it "routes to #edit" do + get("/malariacases/1/edit").should route_to("malariacases#edit", :id => "1") + end + + it "routes to #create" do + post("/malariacases").should route_to("malariacases#create") + end + + it "routes to #update" do + put("/malariacases/1").should route_to("malariacases#update", :id => "1") + end + + it "routes to #destroy" do + delete("/malariacases/1").should route_to("malariacases#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/malariagenderreports_routing_spec.rb b/spec/routing/malariagenderreports_routing_spec.rb new file mode 100644 index 0000000..8b0c57d --- /dev/null +++ b/spec/routing/malariagenderreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MalariagenderreportsController do + describe "routing" do + + it "routes to #index" do + get("/malariagenderreports").should route_to("malariagenderreports#index") + end + + it "routes to #new" do + get("/malariagenderreports/new").should route_to("malariagenderreports#new") + end + + it "routes to #show" do + get("/malariagenderreports/1").should route_to("malariagenderreports#show", :id => "1") + end + + it "routes to #edit" do + get("/malariagenderreports/1/edit").should route_to("malariagenderreports#edit", :id => "1") + end + + it "routes to #create" do + post("/malariagenderreports").should route_to("malariagenderreports#create") + end + + it "routes to #update" do + put("/malariagenderreports/1").should route_to("malariagenderreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/malariagenderreports/1").should route_to("malariagenderreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/malarialocationreports_routing_spec.rb b/spec/routing/malarialocationreports_routing_spec.rb new file mode 100644 index 0000000..6042d75 --- /dev/null +++ b/spec/routing/malarialocationreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MalarialocationreportsController do + describe "routing" do + + it "routes to #index" do + get("/malarialocationreports").should route_to("malarialocationreports#index") + end + + it "routes to #new" do + get("/malarialocationreports/new").should route_to("malarialocationreports#new") + end + + it "routes to #show" do + get("/malarialocationreports/1").should route_to("malarialocationreports#show", :id => "1") + end + + it "routes to #edit" do + get("/malarialocationreports/1/edit").should route_to("malarialocationreports#edit", :id => "1") + end + + it "routes to #create" do + post("/malarialocationreports").should route_to("malarialocationreports#create") + end + + it "routes to #update" do + put("/malarialocationreports/1").should route_to("malarialocationreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/malarialocationreports/1").should route_to("malarialocationreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/malariapreventationreports_routing_spec.rb b/spec/routing/malariapreventationreports_routing_spec.rb new file mode 100644 index 0000000..7cec504 --- /dev/null +++ b/spec/routing/malariapreventationreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MalariapreventationreportsController do + describe "routing" do + + it "routes to #index" do + get("/malariapreventationreports").should route_to("malariapreventationreports#index") + end + + it "routes to #new" do + get("/malariapreventationreports/new").should route_to("malariapreventationreports#new") + end + + it "routes to #show" do + get("/malariapreventationreports/1").should route_to("malariapreventationreports#show", :id => "1") + end + + it "routes to #edit" do + get("/malariapreventationreports/1/edit").should route_to("malariapreventationreports#edit", :id => "1") + end + + it "routes to #create" do + post("/malariapreventationreports").should route_to("malariapreventationreports#create") + end + + it "routes to #update" do + put("/malariapreventationreports/1").should route_to("malariapreventationreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/malariapreventationreports/1").should route_to("malariapreventationreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/members_routing_spec.rb b/spec/routing/members_routing_spec.rb new file mode 100644 index 0000000..031356e --- /dev/null +++ b/spec/routing/members_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe MembersController do + describe "routing" do + + it "routes to #index" do + get("/members").should route_to("members#index") + end + + it "routes to #new" do + get("/members/new").should route_to("members#new") + end + + it "routes to #show" do + get("/members/1").should route_to("members#show", :id => "1") + end + + it "routes to #edit" do + get("/members/1/edit").should route_to("members#edit", :id => "1") + end + + it "routes to #create" do + post("/members").should route_to("members#create") + end + + it "routes to #update" do + put("/members/1").should route_to("members#update", :id => "1") + end + + it "routes to #destroy" do + delete("/members/1").should route_to("members#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/nightattacks_routing_spec.rb b/spec/routing/nightattacks_routing_spec.rb new file mode 100644 index 0000000..c7ce398 --- /dev/null +++ b/spec/routing/nightattacks_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe NightattacksController do + describe "routing" do + + it "routes to #index" do + get("/nightattacks").should route_to("nightattacks#index") + end + + it "routes to #new" do + get("/nightattacks/new").should route_to("nightattacks#new") + end + + it "routes to #show" do + get("/nightattacks/1").should route_to("nightattacks#show", :id => "1") + end + + it "routes to #edit" do + get("/nightattacks/1/edit").should route_to("nightattacks#edit", :id => "1") + end + + it "routes to #create" do + post("/nightattacks").should route_to("nightattacks#create") + end + + it "routes to #update" do + put("/nightattacks/1").should route_to("nightattacks#update", :id => "1") + end + + it "routes to #destroy" do + delete("/nightattacks/1").should route_to("nightattacks#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/patients_routing_spec.rb b/spec/routing/patients_routing_spec.rb new file mode 100644 index 0000000..2d7df0b --- /dev/null +++ b/spec/routing/patients_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe PatientsController do + describe "routing" do + + it "routes to #index" do + get("/patients").should route_to("patients#index") + end + + it "routes to #new" do + get("/patients/new").should route_to("patients#new") + end + + it "routes to #show" do + get("/patients/1").should route_to("patients#show", :id => "1") + end + + it "routes to #edit" do + get("/patients/1/edit").should route_to("patients#edit", :id => "1") + end + + it "routes to #create" do + post("/patients").should route_to("patients#create") + end + + it "routes to #update" do + put("/patients/1").should route_to("patients#update", :id => "1") + end + + it "routes to #destroy" do + delete("/patients/1").should route_to("patients#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/roadcrimes_routing_spec.rb b/spec/routing/roadcrimes_routing_spec.rb new file mode 100644 index 0000000..19cc205 --- /dev/null +++ b/spec/routing/roadcrimes_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe RoadcrimesController do + describe "routing" do + + it "routes to #index" do + get("/roadcrimes").should route_to("roadcrimes#index") + end + + it "routes to #new" do + get("/roadcrimes/new").should route_to("roadcrimes#new") + end + + it "routes to #show" do + get("/roadcrimes/1").should route_to("roadcrimes#show", :id => "1") + end + + it "routes to #edit" do + get("/roadcrimes/1/edit").should route_to("roadcrimes#edit", :id => "1") + end + + it "routes to #create" do + post("/roadcrimes").should route_to("roadcrimes#create") + end + + it "routes to #update" do + put("/roadcrimes/1").should route_to("roadcrimes#update", :id => "1") + end + + it "routes to #destroy" do + delete("/roadcrimes/1").should route_to("roadcrimes#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/smsmessages_routing_spec.rb b/spec/routing/smsmessages_routing_spec.rb new file mode 100644 index 0000000..911a289 --- /dev/null +++ b/spec/routing/smsmessages_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe SmsmessagesController do + describe "routing" do + + it "routes to #index" do + get("/smsmessages").should route_to("smsmessages#index") + end + + it "routes to #new" do + get("/smsmessages/new").should route_to("smsmessages#new") + end + + it "routes to #show" do + get("/smsmessages/1").should route_to("smsmessages#show", :id => "1") + end + + it "routes to #edit" do + get("/smsmessages/1/edit").should route_to("smsmessages#edit", :id => "1") + end + + it "routes to #create" do + post("/smsmessages").should route_to("smsmessages#create") + end + + it "routes to #update" do + put("/smsmessages/1").should route_to("smsmessages#update", :id => "1") + end + + it "routes to #destroy" do + delete("/smsmessages/1").should route_to("smsmessages#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/tbcases_routing_spec.rb b/spec/routing/tbcases_routing_spec.rb new file mode 100644 index 0000000..a158078 --- /dev/null +++ b/spec/routing/tbcases_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TbcasesController do + describe "routing" do + + it "routes to #index" do + get("/tbcases").should route_to("tbcases#index") + end + + it "routes to #new" do + get("/tbcases/new").should route_to("tbcases#new") + end + + it "routes to #show" do + get("/tbcases/1").should route_to("tbcases#show", :id => "1") + end + + it "routes to #edit" do + get("/tbcases/1/edit").should route_to("tbcases#edit", :id => "1") + end + + it "routes to #create" do + post("/tbcases").should route_to("tbcases#create") + end + + it "routes to #update" do + put("/tbcases/1").should route_to("tbcases#update", :id => "1") + end + + it "routes to #destroy" do + delete("/tbcases/1").should route_to("tbcases#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/tbdotreports_routing_spec.rb b/spec/routing/tbdotreports_routing_spec.rb new file mode 100644 index 0000000..76aeae6 --- /dev/null +++ b/spec/routing/tbdotreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TbdotreportsController do + describe "routing" do + + it "routes to #index" do + get("/tbdotreports").should route_to("tbdotreports#index") + end + + it "routes to #new" do + get("/tbdotreports/new").should route_to("tbdotreports#new") + end + + it "routes to #show" do + get("/tbdotreports/1").should route_to("tbdotreports#show", :id => "1") + end + + it "routes to #edit" do + get("/tbdotreports/1/edit").should route_to("tbdotreports#edit", :id => "1") + end + + it "routes to #create" do + post("/tbdotreports").should route_to("tbdotreports#create") + end + + it "routes to #update" do + put("/tbdotreports/1").should route_to("tbdotreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/tbdotreports/1").should route_to("tbdotreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/tblocationreports_routing_spec.rb b/spec/routing/tblocationreports_routing_spec.rb new file mode 100644 index 0000000..a8545c3 --- /dev/null +++ b/spec/routing/tblocationreports_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe TblocationreportsController do + describe "routing" do + + it "routes to #index" do + get("/tblocationreports").should route_to("tblocationreports#index") + end + + it "routes to #new" do + get("/tblocationreports/new").should route_to("tblocationreports#new") + end + + it "routes to #show" do + get("/tblocationreports/1").should route_to("tblocationreports#show", :id => "1") + end + + it "routes to #edit" do + get("/tblocationreports/1/edit").should route_to("tblocationreports#edit", :id => "1") + end + + it "routes to #create" do + post("/tblocationreports").should route_to("tblocationreports#create") + end + + it "routes to #update" do + put("/tblocationreports/1").should route_to("tblocationreports#update", :id => "1") + end + + it "routes to #destroy" do + delete("/tblocationreports/1").should route_to("tblocationreports#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/villageworkers_routing_spec.rb b/spec/routing/villageworkers_routing_spec.rb new file mode 100644 index 0000000..224df69 --- /dev/null +++ b/spec/routing/villageworkers_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe VillageworkersController do + describe "routing" do + + it "routes to #index" do + get("/villageworkers").should route_to("villageworkers#index") + end + + it "routes to #new" do + get("/villageworkers/new").should route_to("villageworkers#new") + end + + it "routes to #show" do + get("/villageworkers/1").should route_to("villageworkers#show", :id => "1") + end + + it "routes to #edit" do + get("/villageworkers/1/edit").should route_to("villageworkers#edit", :id => "1") + end + + it "routes to #create" do + post("/villageworkers").should route_to("villageworkers#create") + end + + it "routes to #update" do + put("/villageworkers/1").should route_to("villageworkers#update", :id => "1") + end + + it "routes to #destroy" do + delete("/villageworkers/1").should route_to("villageworkers#destroy", :id => "1") + end + + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..28426ab --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,44 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV["RAILS_ENV"] ||= 'test' +require File.expand_path("../../config/environment", __FILE__) +require 'rspec/rails' +require 'rspec/autorun' +#This is Capybara integration +require 'capybara/rails' +require 'capybara/rspec' +require 'models/textmessageparser/smsparser' +require 'models/patients/patientprocessor' + +# Requires supporting ruby files with custom matchers and macros, etc, +# in spec/support/ and its subdirectories. +Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} + +RSpec.configure do |config| + # ## Mock Framework + # + # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: + # + # config.mock_with :mocha + # config.mock_with :flexmock + # config.mock_with :rr + + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # If true, the base class of anonymous controllers will be inferred + # automatically. This will be the default behavior in future versions of + # rspec-rails. + config.infer_base_class_for_anonymous_controllers = false +end + +##module ::Rspec::Core +##class ExampleGroup +##include Capybara::DSL +##include Capybara::RSpecMatchers +##end +##end diff --git a/spec/views/cattlethefts/edit.html.erb_spec.rb b/spec/views/cattlethefts/edit.html.erb_spec.rb new file mode 100644 index 0000000..44b3534 --- /dev/null +++ b/spec/views/cattlethefts/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "cattlethefts/edit" do + before(:each) do + @cattletheft = assign(:cattletheft, stub_model(Cattletheft, + :numberstolen => 1, + :location => "MyString" + )) + end + + it "renders the edit cattletheft form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => cattlethefts_path(@cattletheft), :method => "post" do + assert_select "input#cattletheft_numberstolen", :name => "cattletheft[numberstolen]" + assert_select "input#cattletheft_location", :name => "cattletheft[location]" + end + end +end diff --git a/spec/views/cattlethefts/index.html.erb_spec.rb b/spec/views/cattlethefts/index.html.erb_spec.rb new file mode 100644 index 0000000..4c9ac77 --- /dev/null +++ b/spec/views/cattlethefts/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "cattlethefts/index" do + before(:each) do + assign(:cattlethefts, [ + stub_model(Cattletheft, + :numberstolen => 1, + :location => "Location" + ), + stub_model(Cattletheft, + :numberstolen => 1, + :location => "Location" + ) + ]) + end + + it "renders a list of cattlethefts" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => 1.to_s, :count => 2 + assert_select "tr>td", :text => "Location".to_s, :count => 2 + end +end diff --git a/spec/views/cattlethefts/new.html.erb_spec.rb b/spec/views/cattlethefts/new.html.erb_spec.rb new file mode 100644 index 0000000..9272dfd --- /dev/null +++ b/spec/views/cattlethefts/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "cattlethefts/new" do + before(:each) do + assign(:cattletheft, stub_model(Cattletheft, + :numberstolen => 1, + :location => "MyString" + ).as_new_record) + end + + it "renders new cattletheft form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => cattlethefts_path, :method => "post" do + assert_select "input#cattletheft_numberstolen", :name => "cattletheft[numberstolen]" + assert_select "input#cattletheft_location", :name => "cattletheft[location]" + end + end +end diff --git a/spec/views/cattlethefts/show.html.erb_spec.rb b/spec/views/cattlethefts/show.html.erb_spec.rb new file mode 100644 index 0000000..8589a6c --- /dev/null +++ b/spec/views/cattlethefts/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "cattlethefts/show" do + before(:each) do + @cattletheft = assign(:cattletheft, stub_model(Cattletheft, + :numberstolen => 1, + :location => "Location" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/1/) + rendered.should match(/Location/) + end +end diff --git a/spec/views/community_health_workers/edit.html.erb_spec.rb b/spec/views/community_health_workers/edit.html.erb_spec.rb new file mode 100644 index 0000000..f48cb7b --- /dev/null +++ b/spec/views/community_health_workers/edit.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "community_health_workers/edit" do + before(:each) do + @community_health_worker = assign(:community_health_worker, stub_model(CommunityHealthWorker, + :firstname => "MyString", + :lastname => "MyString", + :middlename => "MyString", + :phonenumber => "MyString", + :nationalid => "MyString", + :gender => "MyString", + :village => "" + )) + end + + it "renders the edit community_health_worker form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => community_health_workers_path(@community_health_worker), :method => "post" do + assert_select "input#community_health_worker_firstname", :name => "community_health_worker[firstname]" + assert_select "input#community_health_worker_lastname", :name => "community_health_worker[lastname]" + assert_select "input#community_health_worker_middlename", :name => "community_health_worker[middlename]" + assert_select "input#community_health_worker_phonenumber", :name => "community_health_worker[phonenumber]" + assert_select "input#community_health_worker_nationalid", :name => "community_health_worker[nationalid]" + assert_select "input#community_health_worker_gender", :name => "community_health_worker[gender]" + assert_select "input#community_health_worker_village", :name => "community_health_worker[village]" + end + end +end diff --git a/spec/views/community_health_workers/index.html.erb_spec.rb b/spec/views/community_health_workers/index.html.erb_spec.rb new file mode 100644 index 0000000..5a667ec --- /dev/null +++ b/spec/views/community_health_workers/index.html.erb_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe "community_health_workers/index" do + before(:each) do + assign(:community_health_workers, [ + stub_model(CommunityHealthWorker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :gender => "Gender", + :village => "" + ), + stub_model(CommunityHealthWorker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :gender => "Gender", + :village => "" + ) + ]) + end + + it "renders a list of community_health_workers" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Firstname".to_s, :count => 2 + assert_select "tr>td", :text => "Lastname".to_s, :count => 2 + assert_select "tr>td", :text => "Middlename".to_s, :count => 2 + assert_select "tr>td", :text => "Phonenumber".to_s, :count => 2 + assert_select "tr>td", :text => "Nationalid".to_s, :count => 2 + assert_select "tr>td", :text => "Gender".to_s, :count => 2 + assert_select "tr>td", :text => "".to_s, :count => 2 + end +end diff --git a/spec/views/community_health_workers/new.html.erb_spec.rb b/spec/views/community_health_workers/new.html.erb_spec.rb new file mode 100644 index 0000000..46756a3 --- /dev/null +++ b/spec/views/community_health_workers/new.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "community_health_workers/new" do + before(:each) do + assign(:community_health_worker, stub_model(CommunityHealthWorker, + :firstname => "MyString", + :lastname => "MyString", + :middlename => "MyString", + :phonenumber => "MyString", + :nationalid => "MyString", + :gender => "MyString", + :village => "" + ).as_new_record) + end + + it "renders new community_health_worker form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => community_health_workers_path, :method => "post" do + assert_select "input#community_health_worker_firstname", :name => "community_health_worker[firstname]" + assert_select "input#community_health_worker_lastname", :name => "community_health_worker[lastname]" + assert_select "input#community_health_worker_middlename", :name => "community_health_worker[middlename]" + assert_select "input#community_health_worker_phonenumber", :name => "community_health_worker[phonenumber]" + assert_select "input#community_health_worker_nationalid", :name => "community_health_worker[nationalid]" + assert_select "input#community_health_worker_gender", :name => "community_health_worker[gender]" + assert_select "input#community_health_worker_village", :name => "community_health_worker[village]" + end + end +end diff --git a/spec/views/community_health_workers/show.html.erb_spec.rb b/spec/views/community_health_workers/show.html.erb_spec.rb new file mode 100644 index 0000000..2219148 --- /dev/null +++ b/spec/views/community_health_workers/show.html.erb_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe "community_health_workers/show" do + before(:each) do + @community_health_worker = assign(:community_health_worker, stub_model(CommunityHealthWorker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :gender => "Gender", + :village => "" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Firstname/) + rendered.should match(/Lastname/) + rendered.should match(/Middlename/) + rendered.should match(/Phonenumber/) + rendered.should match(/Nationalid/) + rendered.should match(/Gender/) + rendered.should match(//) + end +end diff --git a/spec/views/communityworker/.new.html.erb_spec.rb.swp b/spec/views/communityworker/.new.html.erb_spec.rb.swp new file mode 100644 index 0000000..8144efe Binary files /dev/null and b/spec/views/communityworker/.new.html.erb_spec.rb.swp differ diff --git a/spec/views/communityworker/new.html.erb_spec.rb b/spec/views/communityworker/new.html.erb_spec.rb new file mode 100644 index 0000000..774fdef --- /dev/null +++ b/spec/views/communityworker/new.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "communityworker/new.html.erb" do + + +let(:communityworker) {mock_model("Communityworker",:firstname => "First Name").as_new_record} + +before do +assign(:communityworker,communityworker) +end + +it "renders the form to add a new community health worker" do + render + rendered.should have_selector("form", + :method => "post", + :action => communityworkers_path +) do |form| +form.should have_selector("input",:type=>"submit") +end +end +end + + diff --git a/spec/views/conflicts/edit.html.erb_spec.rb b/spec/views/conflicts/edit.html.erb_spec.rb new file mode 100644 index 0000000..21cdb6b --- /dev/null +++ b/spec/views/conflicts/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "conflicts/edit" do + before(:each) do + @conflict = assign(:conflict, stub_model(Conflict)) + end + + it "renders the edit conflict form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => conflicts_path(@conflict), :method => "post" do + end + end +end diff --git a/spec/views/conflicts/index.html.erb_spec.rb b/spec/views/conflicts/index.html.erb_spec.rb new file mode 100644 index 0000000..77f234b --- /dev/null +++ b/spec/views/conflicts/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "conflicts/index" do + before(:each) do + assign(:conflicts, [ + stub_model(Conflict), + stub_model(Conflict) + ]) + end + + it "renders a list of conflicts" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/conflicts/new.html.erb_spec.rb b/spec/views/conflicts/new.html.erb_spec.rb new file mode 100644 index 0000000..45142bb --- /dev/null +++ b/spec/views/conflicts/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "conflicts/new" do + before(:each) do + assign(:conflict, stub_model(Conflict).as_new_record) + end + + it "renders new conflict form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => conflicts_path, :method => "post" do + end + end +end diff --git a/spec/views/conflicts/show.html.erb_spec.rb b/spec/views/conflicts/show.html.erb_spec.rb new file mode 100644 index 0000000..cc5ebf9 --- /dev/null +++ b/spec/views/conflicts/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "conflicts/show" do + before(:each) do + @conflict = assign(:conflict, stub_model(Conflict)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/dotsmembers/edit.html.erb_spec.rb b/spec/views/dotsmembers/edit.html.erb_spec.rb new file mode 100644 index 0000000..2721574 --- /dev/null +++ b/spec/views/dotsmembers/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "dotsmembers/edit" do + before(:each) do + @dotsmember = assign(:dotsmember, stub_model(Dotsmember, + :patient_number => "MyString", + :patient_phone => "MyString", + :status => "MyString" + )) + end + + it "renders the edit dotsmember form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => dotsmembers_path(@dotsmember), :method => "post" do + assert_select "input#dotsmember_patient_number", :name => "dotsmember[patient_number]" + assert_select "input#dotsmember_patient_phone", :name => "dotsmember[patient_phone]" + assert_select "input#dotsmember_status", :name => "dotsmember[status]" + end + end +end diff --git a/spec/views/dotsmembers/index.html.erb_spec.rb b/spec/views/dotsmembers/index.html.erb_spec.rb new file mode 100644 index 0000000..3a70a5e --- /dev/null +++ b/spec/views/dotsmembers/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "dotsmembers/index" do + before(:each) do + assign(:dotsmembers, [ + stub_model(Dotsmember, + :patient_number => "Patient Number", + :patient_phone => "Patient Phone", + :status => "Status" + ), + stub_model(Dotsmember, + :patient_number => "Patient Number", + :patient_phone => "Patient Phone", + :status => "Status" + ) + ]) + end + + it "renders a list of dotsmembers" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Patient Number".to_s, :count => 2 + assert_select "tr>td", :text => "Patient Phone".to_s, :count => 2 + assert_select "tr>td", :text => "Status".to_s, :count => 2 + end +end diff --git a/spec/views/dotsmembers/new.html.erb_spec.rb b/spec/views/dotsmembers/new.html.erb_spec.rb new file mode 100644 index 0000000..b87b723 --- /dev/null +++ b/spec/views/dotsmembers/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "dotsmembers/new" do + before(:each) do + assign(:dotsmember, stub_model(Dotsmember, + :patient_number => "MyString", + :patient_phone => "MyString", + :status => "MyString" + ).as_new_record) + end + + it "renders new dotsmember form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => dotsmembers_path, :method => "post" do + assert_select "input#dotsmember_patient_number", :name => "dotsmember[patient_number]" + assert_select "input#dotsmember_patient_phone", :name => "dotsmember[patient_phone]" + assert_select "input#dotsmember_status", :name => "dotsmember[status]" + end + end +end diff --git a/spec/views/dotsmembers/show.html.erb_spec.rb b/spec/views/dotsmembers/show.html.erb_spec.rb new file mode 100644 index 0000000..af2630a --- /dev/null +++ b/spec/views/dotsmembers/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "dotsmembers/show" do + before(:each) do + @dotsmember = assign(:dotsmember, stub_model(Dotsmember, + :patient_number => "Patient Number", + :patient_phone => "Patient Phone", + :status => "Status" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Patient Number/) + rendered.should match(/Patient Phone/) + rendered.should match(/Status/) + end +end diff --git a/spec/views/firearms/edit.html.erb_spec.rb b/spec/views/firearms/edit.html.erb_spec.rb new file mode 100644 index 0000000..37bad06 --- /dev/null +++ b/spec/views/firearms/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "firearms/edit" do + before(:each) do + @firearm = assign(:firearm, stub_model(Firearm, + :location => "MyString" + )) + end + + it "renders the edit firearm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => firearms_path(@firearm), :method => "post" do + assert_select "input#firearm_location", :name => "firearm[location]" + end + end +end diff --git a/spec/views/firearms/index.html.erb_spec.rb b/spec/views/firearms/index.html.erb_spec.rb new file mode 100644 index 0000000..9ffc8b1 --- /dev/null +++ b/spec/views/firearms/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "firearms/index" do + before(:each) do + assign(:firearms, [ + stub_model(Firearm, + :location => "Location" + ), + stub_model(Firearm, + :location => "Location" + ) + ]) + end + + it "renders a list of firearms" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Location".to_s, :count => 2 + end +end diff --git a/spec/views/firearms/new.html.erb_spec.rb b/spec/views/firearms/new.html.erb_spec.rb new file mode 100644 index 0000000..ec06c2f --- /dev/null +++ b/spec/views/firearms/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "firearms/new" do + before(:each) do + assign(:firearm, stub_model(Firearm, + :location => "MyString" + ).as_new_record) + end + + it "renders new firearm form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => firearms_path, :method => "post" do + assert_select "input#firearm_location", :name => "firearm[location]" + end + end +end diff --git a/spec/views/firearms/show.html.erb_spec.rb b/spec/views/firearms/show.html.erb_spec.rb new file mode 100644 index 0000000..532d538 --- /dev/null +++ b/spec/views/firearms/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "firearms/show" do + before(:each) do + @firearm = assign(:firearm, stub_model(Firearm, + :location => "Location" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Location/) + end +end diff --git a/spec/views/hivcases/edit.html.erb_spec.rb b/spec/views/hivcases/edit.html.erb_spec.rb new file mode 100644 index 0000000..77d4ccf --- /dev/null +++ b/spec/views/hivcases/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "hivcases/edit" do + before(:each) do + @hivcase = assign(:hivcase, stub_model(Hivcase, + :patient_number => "MyString", + :availability_of_contraceptives => "MyString", + :availability_of_drugs => "MyString" + )) + end + + it "renders the edit hivcase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivcases_path(@hivcase), :method => "post" do + assert_select "input#hivcase_patient_number", :name => "hivcase[patient_number]" + assert_select "input#hivcase_availability_of_contraceptives", :name => "hivcase[availability_of_contraceptives]" + assert_select "input#hivcase_availability_of_drugs", :name => "hivcase[availability_of_drugs]" + end + end +end diff --git a/spec/views/hivcases/index.html.erb_spec.rb b/spec/views/hivcases/index.html.erb_spec.rb new file mode 100644 index 0000000..11473ac --- /dev/null +++ b/spec/views/hivcases/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "hivcases/index" do + before(:each) do + assign(:hivcases, [ + stub_model(Hivcase, + :patient_number => "Patient Number", + :availability_of_contraceptives => "Availability Of Contraceptives", + :availability_of_drugs => "Availability Of Drugs" + ), + stub_model(Hivcase, + :patient_number => "Patient Number", + :availability_of_contraceptives => "Availability Of Contraceptives", + :availability_of_drugs => "Availability Of Drugs" + ) + ]) + end + + it "renders a list of hivcases" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Patient Number".to_s, :count => 2 + assert_select "tr>td", :text => "Availability Of Contraceptives".to_s, :count => 2 + assert_select "tr>td", :text => "Availability Of Drugs".to_s, :count => 2 + end +end diff --git a/spec/views/hivcases/new.html.erb_spec.rb b/spec/views/hivcases/new.html.erb_spec.rb new file mode 100644 index 0000000..dbaaa71 --- /dev/null +++ b/spec/views/hivcases/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "hivcases/new" do + before(:each) do + assign(:hivcase, stub_model(Hivcase, + :patient_number => "MyString", + :availability_of_contraceptives => "MyString", + :availability_of_drugs => "MyString" + ).as_new_record) + end + + it "renders new hivcase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivcases_path, :method => "post" do + assert_select "input#hivcase_patient_number", :name => "hivcase[patient_number]" + assert_select "input#hivcase_availability_of_contraceptives", :name => "hivcase[availability_of_contraceptives]" + assert_select "input#hivcase_availability_of_drugs", :name => "hivcase[availability_of_drugs]" + end + end +end diff --git a/spec/views/hivcases/show.html.erb_spec.rb b/spec/views/hivcases/show.html.erb_spec.rb new file mode 100644 index 0000000..779a311 --- /dev/null +++ b/spec/views/hivcases/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "hivcases/show" do + before(:each) do + @hivcase = assign(:hivcase, stub_model(Hivcase, + :patient_number => "Patient Number", + :availability_of_contraceptives => "Availability Of Contraceptives", + :availability_of_drugs => "Availability Of Drugs" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Patient Number/) + rendered.should match(/Availability Of Contraceptives/) + rendered.should match(/Availability Of Drugs/) + end +end diff --git a/spec/views/hivcontraceptionreports/edit.html.erb_spec.rb b/spec/views/hivcontraceptionreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..fd8540f --- /dev/null +++ b/spec/views/hivcontraceptionreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivcontraceptionreports/edit" do + before(:each) do + @hivcontraceptionreport = assign(:hivcontraceptionreport, stub_model(Hivcontraceptionreport)) + end + + it "renders the edit hivcontraceptionreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivcontraceptionreports_path(@hivcontraceptionreport), :method => "post" do + end + end +end diff --git a/spec/views/hivcontraceptionreports/index.html.erb_spec.rb b/spec/views/hivcontraceptionreports/index.html.erb_spec.rb new file mode 100644 index 0000000..5453a64 --- /dev/null +++ b/spec/views/hivcontraceptionreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivcontraceptionreports/index" do + before(:each) do + assign(:hivcontraceptionreports, [ + stub_model(Hivcontraceptionreport), + stub_model(Hivcontraceptionreport) + ]) + end + + it "renders a list of hivcontraceptionreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivcontraceptionreports/new.html.erb_spec.rb b/spec/views/hivcontraceptionreports/new.html.erb_spec.rb new file mode 100644 index 0000000..83fd612 --- /dev/null +++ b/spec/views/hivcontraceptionreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivcontraceptionreports/new" do + before(:each) do + assign(:hivcontraceptionreport, stub_model(Hivcontraceptionreport).as_new_record) + end + + it "renders new hivcontraceptionreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivcontraceptionreports_path, :method => "post" do + end + end +end diff --git a/spec/views/hivcontraceptionreports/show.html.erb_spec.rb b/spec/views/hivcontraceptionreports/show.html.erb_spec.rb new file mode 100644 index 0000000..91daacd --- /dev/null +++ b/spec/views/hivcontraceptionreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "hivcontraceptionreports/show" do + before(:each) do + @hivcontraceptionreport = assign(:hivcontraceptionreport, stub_model(Hivcontraceptionreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivdrugreports/edit.html.erb_spec.rb b/spec/views/hivdrugreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..42894b1 --- /dev/null +++ b/spec/views/hivdrugreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivdrugreports/edit" do + before(:each) do + @hivdrugreport = assign(:hivdrugreport, stub_model(Hivdrugreport)) + end + + it "renders the edit hivdrugreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivdrugreports_path(@hivdrugreport), :method => "post" do + end + end +end diff --git a/spec/views/hivdrugreports/index.html.erb_spec.rb b/spec/views/hivdrugreports/index.html.erb_spec.rb new file mode 100644 index 0000000..0df2fd9 --- /dev/null +++ b/spec/views/hivdrugreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivdrugreports/index" do + before(:each) do + assign(:hivdrugreports, [ + stub_model(Hivdrugreport), + stub_model(Hivdrugreport) + ]) + end + + it "renders a list of hivdrugreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivdrugreports/new.html.erb_spec.rb b/spec/views/hivdrugreports/new.html.erb_spec.rb new file mode 100644 index 0000000..be81b17 --- /dev/null +++ b/spec/views/hivdrugreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivdrugreports/new" do + before(:each) do + assign(:hivdrugreport, stub_model(Hivdrugreport).as_new_record) + end + + it "renders new hivdrugreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivdrugreports_path, :method => "post" do + end + end +end diff --git a/spec/views/hivdrugreports/show.html.erb_spec.rb b/spec/views/hivdrugreports/show.html.erb_spec.rb new file mode 100644 index 0000000..ae9d981 --- /dev/null +++ b/spec/views/hivdrugreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "hivdrugreports/show" do + before(:each) do + @hivdrugreport = assign(:hivdrugreport, stub_model(Hivdrugreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivgenderreports/edit.html.erb_spec.rb b/spec/views/hivgenderreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..db3a166 --- /dev/null +++ b/spec/views/hivgenderreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivgenderreports/edit" do + before(:each) do + @hivgenderreport = assign(:hivgenderreport, stub_model(Hivgenderreport)) + end + + it "renders the edit hivgenderreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivgenderreports_path(@hivgenderreport), :method => "post" do + end + end +end diff --git a/spec/views/hivgenderreports/index.html.erb_spec.rb b/spec/views/hivgenderreports/index.html.erb_spec.rb new file mode 100644 index 0000000..9691aa8 --- /dev/null +++ b/spec/views/hivgenderreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivgenderreports/index" do + before(:each) do + assign(:hivgenderreports, [ + stub_model(Hivgenderreport), + stub_model(Hivgenderreport) + ]) + end + + it "renders a list of hivgenderreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivgenderreports/new.html.erb_spec.rb b/spec/views/hivgenderreports/new.html.erb_spec.rb new file mode 100644 index 0000000..c24921d --- /dev/null +++ b/spec/views/hivgenderreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivgenderreports/new" do + before(:each) do + assign(:hivgenderreport, stub_model(Hivgenderreport).as_new_record) + end + + it "renders new hivgenderreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivgenderreports_path, :method => "post" do + end + end +end diff --git a/spec/views/hivgenderreports/show.html.erb_spec.rb b/spec/views/hivgenderreports/show.html.erb_spec.rb new file mode 100644 index 0000000..0d976af --- /dev/null +++ b/spec/views/hivgenderreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "hivgenderreports/show" do + before(:each) do + @hivgenderreport = assign(:hivgenderreport, stub_model(Hivgenderreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivlocationreports/edit.html.erb_spec.rb b/spec/views/hivlocationreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..a8abaed --- /dev/null +++ b/spec/views/hivlocationreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivlocationreports/edit" do + before(:each) do + @hivlocationreport = assign(:hivlocationreport, stub_model(Hivlocationreport)) + end + + it "renders the edit hivlocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivlocationreports_path(@hivlocationreport), :method => "post" do + end + end +end diff --git a/spec/views/hivlocationreports/index.html.erb_spec.rb b/spec/views/hivlocationreports/index.html.erb_spec.rb new file mode 100644 index 0000000..00303c2 --- /dev/null +++ b/spec/views/hivlocationreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivlocationreports/index" do + before(:each) do + assign(:hivlocationreports, [ + stub_model(Hivlocationreport), + stub_model(Hivlocationreport) + ]) + end + + it "renders a list of hivlocationreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/hivlocationreports/new.html.erb_spec.rb b/spec/views/hivlocationreports/new.html.erb_spec.rb new file mode 100644 index 0000000..b262a1b --- /dev/null +++ b/spec/views/hivlocationreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "hivlocationreports/new" do + before(:each) do + assign(:hivlocationreport, stub_model(Hivlocationreport).as_new_record) + end + + it "renders new hivlocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => hivlocationreports_path, :method => "post" do + end + end +end diff --git a/spec/views/hivlocationreports/show.html.erb_spec.rb b/spec/views/hivlocationreports/show.html.erb_spec.rb new file mode 100644 index 0000000..e897ab5 --- /dev/null +++ b/spec/views/hivlocationreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "hivlocationreports/show" do + before(:each) do + @hivlocationreport = assign(:hivlocationreport, stub_model(Hivlocationreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/locationreports/edit.html.erb_spec.rb b/spec/views/locationreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..a649731 --- /dev/null +++ b/spec/views/locationreports/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "locationreports/edit" do + before(:each) do + @locationreport = assign(:locationreport, stub_model(Locationreport, + :index => "MyString" + )) + end + + it "renders the edit locationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => locationreports_path(@locationreport), :method => "post" do + assert_select "input#locationreport_index", :name => "locationreport[index]" + end + end +end diff --git a/spec/views/locationreports/index.html.erb_spec.rb b/spec/views/locationreports/index.html.erb_spec.rb new file mode 100644 index 0000000..59d1e17 --- /dev/null +++ b/spec/views/locationreports/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "locationreports/index" do + before(:each) do + assign(:locationreports, [ + stub_model(Locationreport, + :index => "Index" + ), + stub_model(Locationreport, + :index => "Index" + ) + ]) + end + + it "renders a list of locationreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Index".to_s, :count => 2 + end +end diff --git a/spec/views/locationreports/new.html.erb_spec.rb b/spec/views/locationreports/new.html.erb_spec.rb new file mode 100644 index 0000000..f54ca44 --- /dev/null +++ b/spec/views/locationreports/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "locationreports/new" do + before(:each) do + assign(:locationreport, stub_model(Locationreport, + :index => "MyString" + ).as_new_record) + end + + it "renders new locationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => locationreports_path, :method => "post" do + assert_select "input#locationreport_index", :name => "locationreport[index]" + end + end +end diff --git a/spec/views/locationreports/show.html.erb_spec.rb b/spec/views/locationreports/show.html.erb_spec.rb new file mode 100644 index 0000000..66fb27f --- /dev/null +++ b/spec/views/locationreports/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "locationreports/show" do + before(:each) do + @locationreport = assign(:locationreport, stub_model(Locationreport, + :index => "Index" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Index/) + end +end diff --git a/spec/views/locations/edit.html.erb_spec.rb b/spec/views/locations/edit.html.erb_spec.rb new file mode 100644 index 0000000..3253cf9 --- /dev/null +++ b/spec/views/locations/edit.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "locations/edit" do + before(:each) do + @location = assign(:location, stub_model(Location, + :name => "MyString", + :ward => "MyString", + :country => "MyString" + )) + end + + it "renders the edit location form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => locations_path(@location), :method => "post" do + assert_select "input#location_name", :name => "location[name]" + assert_select "input#location_ward", :name => "location[ward]" + assert_select "input#location_country", :name => "location[country]" + end + end +end diff --git a/spec/views/locations/index.html.erb_spec.rb b/spec/views/locations/index.html.erb_spec.rb new file mode 100644 index 0000000..16f9e91 --- /dev/null +++ b/spec/views/locations/index.html.erb_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe "locations/index" do + before(:each) do + assign(:locations, [ + stub_model(Location, + :name => "Name", + :ward => "Ward", + :country => "Country" + ), + stub_model(Location, + :name => "Name", + :ward => "Ward", + :country => "Country" + ) + ]) + end + + it "renders a list of locations" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Name".to_s, :count => 2 + assert_select "tr>td", :text => "Ward".to_s, :count => 2 + assert_select "tr>td", :text => "Country".to_s, :count => 2 + end +end diff --git a/spec/views/locations/new.html.erb_spec.rb b/spec/views/locations/new.html.erb_spec.rb new file mode 100644 index 0000000..272f9f1 --- /dev/null +++ b/spec/views/locations/new.html.erb_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe "locations/new" do + before(:each) do + assign(:location, stub_model(Location, + :name => "MyString", + :ward => "MyString", + :country => "MyString" + ).as_new_record) + end + + it "renders new location form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => locations_path, :method => "post" do + assert_select "input#location_name", :name => "location[name]" + assert_select "input#location_ward", :name => "location[ward]" + assert_select "input#location_country", :name => "location[country]" + end + end +end diff --git a/spec/views/locations/show.html.erb_spec.rb b/spec/views/locations/show.html.erb_spec.rb new file mode 100644 index 0000000..45be9f9 --- /dev/null +++ b/spec/views/locations/show.html.erb_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe "locations/show" do + before(:each) do + @location = assign(:location, stub_model(Location, + :name => "Name", + :ward => "Ward", + :country => "Country" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Name/) + rendered.should match(/Ward/) + rendered.should match(/Country/) + end +end diff --git a/spec/views/malariacases/edit.html.erb_spec.rb b/spec/views/malariacases/edit.html.erb_spec.rb new file mode 100644 index 0000000..bd1773c --- /dev/null +++ b/spec/views/malariacases/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "malariacases/edit" do + before(:each) do + @malariacase = assign(:malariacase, stub_model(Malariacase, + :patient_id => 1, + :communityworker_id => 1 + )) + end + + it "renders the edit malariacase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariacases_path(@malariacase), :method => "post" do + assert_select "input#malariacase_patient_id", :name => "malariacase[patient_id]" + assert_select "input#malariacase_communityworker_id", :name => "malariacase[communityworker_id]" + end + end +end diff --git a/spec/views/malariacases/index.html.erb_spec.rb b/spec/views/malariacases/index.html.erb_spec.rb new file mode 100644 index 0000000..d06a59f --- /dev/null +++ b/spec/views/malariacases/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "malariacases/index" do + before(:each) do + assign(:malariacases, [ + stub_model(Malariacase, + :patient_id => 1, + :communityworker_id => 2 + ), + stub_model(Malariacase, + :patient_id => 1, + :communityworker_id => 2 + ) + ]) + end + + it "renders a list of malariacases" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => 1.to_s, :count => 2 + assert_select "tr>td", :text => 2.to_s, :count => 2 + end +end diff --git a/spec/views/malariacases/new.html.erb_spec.rb b/spec/views/malariacases/new.html.erb_spec.rb new file mode 100644 index 0000000..79b4235 --- /dev/null +++ b/spec/views/malariacases/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "malariacases/new" do + before(:each) do + assign(:malariacase, stub_model(Malariacase, + :patient_id => 1, + :communityworker_id => 1 + ).as_new_record) + end + + it "renders new malariacase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariacases_path, :method => "post" do + assert_select "input#malariacase_patient_id", :name => "malariacase[patient_id]" + assert_select "input#malariacase_communityworker_id", :name => "malariacase[communityworker_id]" + end + end +end diff --git a/spec/views/malariacases/show.html.erb_spec.rb b/spec/views/malariacases/show.html.erb_spec.rb new file mode 100644 index 0000000..d7abeae --- /dev/null +++ b/spec/views/malariacases/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "malariacases/show" do + before(:each) do + @malariacase = assign(:malariacase, stub_model(Malariacase, + :patient_id => 1, + :communityworker_id => 2 + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/1/) + rendered.should match(/2/) + end +end diff --git a/spec/views/malariagenderreports/edit.html.erb_spec.rb b/spec/views/malariagenderreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..25b7362 --- /dev/null +++ b/spec/views/malariagenderreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariagenderreports/edit" do + before(:each) do + @malariagenderreport = assign(:malariagenderreport, stub_model(Malariagenderreport)) + end + + it "renders the edit malariagenderreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariagenderreports_path(@malariagenderreport), :method => "post" do + end + end +end diff --git a/spec/views/malariagenderreports/index.html.erb_spec.rb b/spec/views/malariagenderreports/index.html.erb_spec.rb new file mode 100644 index 0000000..ff24ba6 --- /dev/null +++ b/spec/views/malariagenderreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariagenderreports/index" do + before(:each) do + assign(:malariagenderreports, [ + stub_model(Malariagenderreport), + stub_model(Malariagenderreport) + ]) + end + + it "renders a list of malariagenderreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/malariagenderreports/new.html.erb_spec.rb b/spec/views/malariagenderreports/new.html.erb_spec.rb new file mode 100644 index 0000000..22dc913 --- /dev/null +++ b/spec/views/malariagenderreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariagenderreports/new" do + before(:each) do + assign(:malariagenderreport, stub_model(Malariagenderreport).as_new_record) + end + + it "renders new malariagenderreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariagenderreports_path, :method => "post" do + end + end +end diff --git a/spec/views/malariagenderreports/show.html.erb_spec.rb b/spec/views/malariagenderreports/show.html.erb_spec.rb new file mode 100644 index 0000000..f80edab --- /dev/null +++ b/spec/views/malariagenderreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "malariagenderreports/show" do + before(:each) do + @malariagenderreport = assign(:malariagenderreport, stub_model(Malariagenderreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/malarialocationreports/edit.html.erb_spec.rb b/spec/views/malarialocationreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..daef470 --- /dev/null +++ b/spec/views/malarialocationreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malarialocationreports/edit" do + before(:each) do + @malarialocationreport = assign(:malarialocationreport, stub_model(Malarialocationreport)) + end + + it "renders the edit malarialocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malarialocationreports_path(@malarialocationreport), :method => "post" do + end + end +end diff --git a/spec/views/malarialocationreports/index.html.erb_spec.rb b/spec/views/malarialocationreports/index.html.erb_spec.rb new file mode 100644 index 0000000..df12c7b --- /dev/null +++ b/spec/views/malarialocationreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malarialocationreports/index" do + before(:each) do + assign(:malarialocationreports, [ + stub_model(Malarialocationreport), + stub_model(Malarialocationreport) + ]) + end + + it "renders a list of malarialocationreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/malarialocationreports/new.html.erb_spec.rb b/spec/views/malarialocationreports/new.html.erb_spec.rb new file mode 100644 index 0000000..2a7afec --- /dev/null +++ b/spec/views/malarialocationreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malarialocationreports/new" do + before(:each) do + assign(:malarialocationreport, stub_model(Malarialocationreport).as_new_record) + end + + it "renders new malarialocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malarialocationreports_path, :method => "post" do + end + end +end diff --git a/spec/views/malarialocationreports/show.html.erb_spec.rb b/spec/views/malarialocationreports/show.html.erb_spec.rb new file mode 100644 index 0000000..9909c04 --- /dev/null +++ b/spec/views/malarialocationreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "malarialocationreports/show" do + before(:each) do + @malarialocationreport = assign(:malarialocationreport, stub_model(Malarialocationreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/malariapreventationreports/edit.html.erb_spec.rb b/spec/views/malariapreventationreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..638560f --- /dev/null +++ b/spec/views/malariapreventationreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariapreventationreports/edit" do + before(:each) do + @malariapreventationreport = assign(:malariapreventationreport, stub_model(Malariapreventationreport)) + end + + it "renders the edit malariapreventationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariapreventationreports_path(@malariapreventationreport), :method => "post" do + end + end +end diff --git a/spec/views/malariapreventationreports/index.html.erb_spec.rb b/spec/views/malariapreventationreports/index.html.erb_spec.rb new file mode 100644 index 0000000..f933de4 --- /dev/null +++ b/spec/views/malariapreventationreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariapreventationreports/index" do + before(:each) do + assign(:malariapreventationreports, [ + stub_model(Malariapreventationreport), + stub_model(Malariapreventationreport) + ]) + end + + it "renders a list of malariapreventationreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/malariapreventationreports/new.html.erb_spec.rb b/spec/views/malariapreventationreports/new.html.erb_spec.rb new file mode 100644 index 0000000..8af5de7 --- /dev/null +++ b/spec/views/malariapreventationreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "malariapreventationreports/new" do + before(:each) do + assign(:malariapreventationreport, stub_model(Malariapreventationreport).as_new_record) + end + + it "renders new malariapreventationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => malariapreventationreports_path, :method => "post" do + end + end +end diff --git a/spec/views/malariapreventationreports/show.html.erb_spec.rb b/spec/views/malariapreventationreports/show.html.erb_spec.rb new file mode 100644 index 0000000..e252f72 --- /dev/null +++ b/spec/views/malariapreventationreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "malariapreventationreports/show" do + before(:each) do + @malariapreventationreport = assign(:malariapreventationreport, stub_model(Malariapreventationreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/members/edit.html.erb_spec.rb b/spec/views/members/edit.html.erb_spec.rb new file mode 100644 index 0000000..5ce43a4 --- /dev/null +++ b/spec/views/members/edit.html.erb_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe "members/edit" do + before(:each) do + @member = assign(:member, stub_model(Member, + :firstname => "MyString", + :lastname => "MyString", + :age => "", + :location => "", + :nationalid => "MyString", + :gender => "MyString" + )) + end + + it "renders the edit member form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => members_path(@member), :method => "post" do + assert_select "input#member_firstname", :name => "member[firstname]" + assert_select "input#member_lastname", :name => "member[lastname]" + assert_select "input#member_age", :name => "member[age]" + assert_select "input#member_location", :name => "member[location]" + assert_select "input#member_nationalid", :name => "member[nationalid]" + assert_select "input#member_gender", :name => "member[gender]" + end + end +end diff --git a/spec/views/members/index.html.erb_spec.rb b/spec/views/members/index.html.erb_spec.rb new file mode 100644 index 0000000..f392ad0 --- /dev/null +++ b/spec/views/members/index.html.erb_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe "members/index" do + before(:each) do + assign(:members, [ + stub_model(Member, + :firstname => "Firstname", + :lastname => "Lastname", + :age => "", + :location => "", + :nationalid => "Nationalid", + :gender => "Gender" + ), + stub_model(Member, + :firstname => "Firstname", + :lastname => "Lastname", + :age => "", + :location => "", + :nationalid => "Nationalid", + :gender => "Gender" + ) + ]) + end + + it "renders a list of members" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Firstname".to_s, :count => 2 + assert_select "tr>td", :text => "Lastname".to_s, :count => 2 + assert_select "tr>td", :text => "".to_s, :count => 2 + assert_select "tr>td", :text => "".to_s, :count => 2 + assert_select "tr>td", :text => "Nationalid".to_s, :count => 2 + assert_select "tr>td", :text => "Gender".to_s, :count => 2 + end +end diff --git a/spec/views/members/new.html.erb_spec.rb b/spec/views/members/new.html.erb_spec.rb new file mode 100644 index 0000000..277cf0c --- /dev/null +++ b/spec/views/members/new.html.erb_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe "members/new" do + before(:each) do + assign(:member, stub_model(Member, + :firstname => "MyString", + :lastname => "MyString", + :age => "", + :location => "", + :nationalid => "MyString", + :gender => "MyString" + ).as_new_record) + end + + it "renders new member form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => members_path, :method => "post" do + assert_select "input#member_firstname", :name => "member[firstname]" + assert_select "input#member_lastname", :name => "member[lastname]" + assert_select "input#member_age", :name => "member[age]" + assert_select "input#member_location", :name => "member[location]" + assert_select "input#member_nationalid", :name => "member[nationalid]" + assert_select "input#member_gender", :name => "member[gender]" + end + end +end diff --git a/spec/views/members/show.html.erb_spec.rb b/spec/views/members/show.html.erb_spec.rb new file mode 100644 index 0000000..8abfd36 --- /dev/null +++ b/spec/views/members/show.html.erb_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe "members/show" do + before(:each) do + @member = assign(:member, stub_model(Member, + :firstname => "Firstname", + :lastname => "Lastname", + :age => "", + :location => "", + :nationalid => "Nationalid", + :gender => "Gender" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Firstname/) + rendered.should match(/Lastname/) + rendered.should match(//) + rendered.should match(//) + rendered.should match(/Nationalid/) + rendered.should match(/Gender/) + end +end diff --git a/spec/views/nightattacks/edit.html.erb_spec.rb b/spec/views/nightattacks/edit.html.erb_spec.rb new file mode 100644 index 0000000..654213a --- /dev/null +++ b/spec/views/nightattacks/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "nightattacks/edit" do + before(:each) do + @nightattack = assign(:nightattack, stub_model(Nightattack)) + end + + it "renders the edit nightattack form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => nightattacks_path(@nightattack), :method => "post" do + end + end +end diff --git a/spec/views/nightattacks/index.html.erb_spec.rb b/spec/views/nightattacks/index.html.erb_spec.rb new file mode 100644 index 0000000..8e52495 --- /dev/null +++ b/spec/views/nightattacks/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "nightattacks/index" do + before(:each) do + assign(:nightattacks, [ + stub_model(Nightattack), + stub_model(Nightattack) + ]) + end + + it "renders a list of nightattacks" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/nightattacks/new.html.erb_spec.rb b/spec/views/nightattacks/new.html.erb_spec.rb new file mode 100644 index 0000000..ddf931f --- /dev/null +++ b/spec/views/nightattacks/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "nightattacks/new" do + before(:each) do + assign(:nightattack, stub_model(Nightattack).as_new_record) + end + + it "renders new nightattack form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => nightattacks_path, :method => "post" do + end + end +end diff --git a/spec/views/nightattacks/show.html.erb_spec.rb b/spec/views/nightattacks/show.html.erb_spec.rb new file mode 100644 index 0000000..b4418ce --- /dev/null +++ b/spec/views/nightattacks/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "nightattacks/show" do + before(:each) do + @nightattack = assign(:nightattack, stub_model(Nightattack)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/patients/edit.html.erb_spec.rb b/spec/views/patients/edit.html.erb_spec.rb new file mode 100644 index 0000000..65bb610 --- /dev/null +++ b/spec/views/patients/edit.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "patients/edit" do + before(:each) do + @patient = assign(:patient, stub_model(Patient, + :firstname => "MyString", + :middlename => "MyString", + :lastname => "MyString", + :communityworker_id => 1 + )) + end + + it "renders the edit patient form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => patients_path(@patient), :method => "post" do + assert_select "input#patient_firstname", :name => "patient[firstname]" + assert_select "input#patient_middlename", :name => "patient[middlename]" + assert_select "input#patient_lastname", :name => "patient[lastname]" + assert_select "input#patient_communityworker_id", :name => "patient[communityworker_id]" + end + end +end diff --git a/spec/views/patients/index.html.erb_spec.rb b/spec/views/patients/index.html.erb_spec.rb new file mode 100644 index 0000000..59166c3 --- /dev/null +++ b/spec/views/patients/index.html.erb_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe "patients/index" do + before(:each) do + assign(:patients, [ + stub_model(Patient, + :firstname => "Firstname", + :middlename => "Middlename", + :lastname => "Lastname", + :communityworker_id => 1 + ), + stub_model(Patient, + :firstname => "Firstname", + :middlename => "Middlename", + :lastname => "Lastname", + :communityworker_id => 1 + ) + ]) + end + + it "renders a list of patients" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Firstname".to_s, :count => 2 + assert_select "tr>td", :text => "Middlename".to_s, :count => 2 + assert_select "tr>td", :text => "Lastname".to_s, :count => 2 + assert_select "tr>td", :text => 1.to_s, :count => 2 + end +end diff --git a/spec/views/patients/new.html.erb_spec.rb b/spec/views/patients/new.html.erb_spec.rb new file mode 100644 index 0000000..b525dd5 --- /dev/null +++ b/spec/views/patients/new.html.erb_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe "patients/new" do + before(:each) do + assign(:patient, stub_model(Patient, + :firstname => "MyString", + :middlename => "MyString", + :lastname => "MyString", + :communityworker_id => 1 + ).as_new_record) + end + + it "renders new patient form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => patients_path, :method => "post" do + assert_select "input#patient_firstname", :name => "patient[firstname]" + assert_select "input#patient_middlename", :name => "patient[middlename]" + assert_select "input#patient_lastname", :name => "patient[lastname]" + assert_select "input#patient_communityworker_id", :name => "patient[communityworker_id]" + end + end +end diff --git a/spec/views/patients/show.html.erb_spec.rb b/spec/views/patients/show.html.erb_spec.rb new file mode 100644 index 0000000..4d2e752 --- /dev/null +++ b/spec/views/patients/show.html.erb_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +describe "patients/show" do + before(:each) do + @patient = assign(:patient, stub_model(Patient, + :firstname => "Firstname", + :middlename => "Middlename", + :lastname => "Lastname", + :communityworker_id => 1 + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Firstname/) + rendered.should match(/Middlename/) + rendered.should match(/Lastname/) + rendered.should match(/1/) + end +end diff --git a/spec/views/roadcrimes/edit.html.erb_spec.rb b/spec/views/roadcrimes/edit.html.erb_spec.rb new file mode 100644 index 0000000..014992d --- /dev/null +++ b/spec/views/roadcrimes/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "roadcrimes/edit" do + before(:each) do + @roadcrime = assign(:roadcrime, stub_model(Roadcrime, + :nationalid => "MyString", + :location => "MyString" + )) + end + + it "renders the edit roadcrime form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => roadcrimes_path(@roadcrime), :method => "post" do + assert_select "input#roadcrime_nationalid", :name => "roadcrime[nationalid]" + assert_select "input#roadcrime_location", :name => "roadcrime[location]" + end + end +end diff --git a/spec/views/roadcrimes/index.html.erb_spec.rb b/spec/views/roadcrimes/index.html.erb_spec.rb new file mode 100644 index 0000000..f48855e --- /dev/null +++ b/spec/views/roadcrimes/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "roadcrimes/index" do + before(:each) do + assign(:roadcrimes, [ + stub_model(Roadcrime, + :nationalid => "Nationalid", + :location => "Location" + ), + stub_model(Roadcrime, + :nationalid => "Nationalid", + :location => "Location" + ) + ]) + end + + it "renders a list of roadcrimes" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Nationalid".to_s, :count => 2 + assert_select "tr>td", :text => "Location".to_s, :count => 2 + end +end diff --git a/spec/views/roadcrimes/new.html.erb_spec.rb b/spec/views/roadcrimes/new.html.erb_spec.rb new file mode 100644 index 0000000..cc5756b --- /dev/null +++ b/spec/views/roadcrimes/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "roadcrimes/new" do + before(:each) do + assign(:roadcrime, stub_model(Roadcrime, + :nationalid => "MyString", + :location => "MyString" + ).as_new_record) + end + + it "renders new roadcrime form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => roadcrimes_path, :method => "post" do + assert_select "input#roadcrime_nationalid", :name => "roadcrime[nationalid]" + assert_select "input#roadcrime_location", :name => "roadcrime[location]" + end + end +end diff --git a/spec/views/roadcrimes/show.html.erb_spec.rb b/spec/views/roadcrimes/show.html.erb_spec.rb new file mode 100644 index 0000000..4cf561c --- /dev/null +++ b/spec/views/roadcrimes/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "roadcrimes/show" do + before(:each) do + @roadcrime = assign(:roadcrime, stub_model(Roadcrime, + :nationalid => "Nationalid", + :location => "Location" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Nationalid/) + rendered.should match(/Location/) + end +end diff --git a/spec/views/smsmessages/edit.html.erb_spec.rb b/spec/views/smsmessages/edit.html.erb_spec.rb new file mode 100644 index 0000000..d4a61d2 --- /dev/null +++ b/spec/views/smsmessages/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "smsmessages/edit" do + before(:each) do + @smsmessage = assign(:smsmessage, stub_model(Smsmessage, + :phone => "", + :message => "MyText" + )) + end + + it "renders the edit smsmessage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => smsmessages_path(@smsmessage), :method => "post" do + assert_select "input#smsmessage_phone", :name => "smsmessage[phone]" + assert_select "textarea#smsmessage_message", :name => "smsmessage[message]" + end + end +end diff --git a/spec/views/smsmessages/index.html.erb_spec.rb b/spec/views/smsmessages/index.html.erb_spec.rb new file mode 100644 index 0000000..d553aac --- /dev/null +++ b/spec/views/smsmessages/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "smsmessages/index" do + before(:each) do + assign(:smsmessages, [ + stub_model(Smsmessage, + :phone => "", + :message => "MyText" + ), + stub_model(Smsmessage, + :phone => "", + :message => "MyText" + ) + ]) + end + + it "renders a list of smsmessages" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/smsmessages/new.html.erb_spec.rb b/spec/views/smsmessages/new.html.erb_spec.rb new file mode 100644 index 0000000..d98c222 --- /dev/null +++ b/spec/views/smsmessages/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "smsmessages/new" do + before(:each) do + assign(:smsmessage, stub_model(Smsmessage, + :phone => "", + :message => "MyText" + ).as_new_record) + end + + it "renders new smsmessage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => smsmessages_path, :method => "post" do + assert_select "input#smsmessage_phone", :name => "smsmessage[phone]" + assert_select "textarea#smsmessage_message", :name => "smsmessage[message]" + end + end +end diff --git a/spec/views/smsmessages/show.html.erb_spec.rb b/spec/views/smsmessages/show.html.erb_spec.rb new file mode 100644 index 0000000..9b098c9 --- /dev/null +++ b/spec/views/smsmessages/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "smsmessages/show" do + before(:each) do + @smsmessage = assign(:smsmessage, stub_model(Smsmessage, + :phone => "", + :message => "MyText" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(//) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/tbcases/edit.html.erb_spec.rb b/spec/views/tbcases/edit.html.erb_spec.rb new file mode 100644 index 0000000..8ab8a69 --- /dev/null +++ b/spec/views/tbcases/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "tbcases/edit" do + before(:each) do + @tbcase = assign(:tbcase, stub_model(Tbcase, + :patient_number => "MyString", + :availability_of_drugs => "MyString" + )) + end + + it "renders the edit tbcase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tbcases_path(@tbcase), :method => "post" do + assert_select "input#tbcase_patient_number", :name => "tbcase[patient_number]" + assert_select "input#tbcase_availability_of_drugs", :name => "tbcase[availability_of_drugs]" + end + end +end diff --git a/spec/views/tbcases/index.html.erb_spec.rb b/spec/views/tbcases/index.html.erb_spec.rb new file mode 100644 index 0000000..9a9759f --- /dev/null +++ b/spec/views/tbcases/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "tbcases/index" do + before(:each) do + assign(:tbcases, [ + stub_model(Tbcase, + :patient_number => "Patient Number", + :availability_of_drugs => "Availability Of Drugs" + ), + stub_model(Tbcase, + :patient_number => "Patient Number", + :availability_of_drugs => "Availability Of Drugs" + ) + ]) + end + + it "renders a list of tbcases" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Patient Number".to_s, :count => 2 + assert_select "tr>td", :text => "Availability Of Drugs".to_s, :count => 2 + end +end diff --git a/spec/views/tbcases/new.html.erb_spec.rb b/spec/views/tbcases/new.html.erb_spec.rb new file mode 100644 index 0000000..163a6fe --- /dev/null +++ b/spec/views/tbcases/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "tbcases/new" do + before(:each) do + assign(:tbcase, stub_model(Tbcase, + :patient_number => "MyString", + :availability_of_drugs => "MyString" + ).as_new_record) + end + + it "renders new tbcase form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tbcases_path, :method => "post" do + assert_select "input#tbcase_patient_number", :name => "tbcase[patient_number]" + assert_select "input#tbcase_availability_of_drugs", :name => "tbcase[availability_of_drugs]" + end + end +end diff --git a/spec/views/tbcases/show.html.erb_spec.rb b/spec/views/tbcases/show.html.erb_spec.rb new file mode 100644 index 0000000..dc553d5 --- /dev/null +++ b/spec/views/tbcases/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "tbcases/show" do + before(:each) do + @tbcase = assign(:tbcase, stub_model(Tbcase, + :patient_number => "Patient Number", + :availability_of_drugs => "Availability Of Drugs" + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Patient Number/) + rendered.should match(/Availability Of Drugs/) + end +end diff --git a/spec/views/tbdotreports/edit.html.erb_spec.rb b/spec/views/tbdotreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..3dc44cb --- /dev/null +++ b/spec/views/tbdotreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tbdotreports/edit" do + before(:each) do + @tbdotreport = assign(:tbdotreport, stub_model(Tbdotreport)) + end + + it "renders the edit tbdotreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tbdotreports_path(@tbdotreport), :method => "post" do + end + end +end diff --git a/spec/views/tbdotreports/index.html.erb_spec.rb b/spec/views/tbdotreports/index.html.erb_spec.rb new file mode 100644 index 0000000..35776aa --- /dev/null +++ b/spec/views/tbdotreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tbdotreports/index" do + before(:each) do + assign(:tbdotreports, [ + stub_model(Tbdotreport), + stub_model(Tbdotreport) + ]) + end + + it "renders a list of tbdotreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/tbdotreports/new.html.erb_spec.rb b/spec/views/tbdotreports/new.html.erb_spec.rb new file mode 100644 index 0000000..b393be3 --- /dev/null +++ b/spec/views/tbdotreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tbdotreports/new" do + before(:each) do + assign(:tbdotreport, stub_model(Tbdotreport).as_new_record) + end + + it "renders new tbdotreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tbdotreports_path, :method => "post" do + end + end +end diff --git a/spec/views/tbdotreports/show.html.erb_spec.rb b/spec/views/tbdotreports/show.html.erb_spec.rb new file mode 100644 index 0000000..5c3bf50 --- /dev/null +++ b/spec/views/tbdotreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "tbdotreports/show" do + before(:each) do + @tbdotreport = assign(:tbdotreport, stub_model(Tbdotreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/tblocationreports/edit.html.erb_spec.rb b/spec/views/tblocationreports/edit.html.erb_spec.rb new file mode 100644 index 0000000..10894a3 --- /dev/null +++ b/spec/views/tblocationreports/edit.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tblocationreports/edit" do + before(:each) do + @tblocationreport = assign(:tblocationreport, stub_model(Tblocationreport)) + end + + it "renders the edit tblocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tblocationreports_path(@tblocationreport), :method => "post" do + end + end +end diff --git a/spec/views/tblocationreports/index.html.erb_spec.rb b/spec/views/tblocationreports/index.html.erb_spec.rb new file mode 100644 index 0000000..3b482d7 --- /dev/null +++ b/spec/views/tblocationreports/index.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tblocationreports/index" do + before(:each) do + assign(:tblocationreports, [ + stub_model(Tblocationreport), + stub_model(Tblocationreport) + ]) + end + + it "renders a list of tblocationreports" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/tblocationreports/new.html.erb_spec.rb b/spec/views/tblocationreports/new.html.erb_spec.rb new file mode 100644 index 0000000..ae8469b --- /dev/null +++ b/spec/views/tblocationreports/new.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "tblocationreports/new" do + before(:each) do + assign(:tblocationreport, stub_model(Tblocationreport).as_new_record) + end + + it "renders new tblocationreport form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => tblocationreports_path, :method => "post" do + end + end +end diff --git a/spec/views/tblocationreports/show.html.erb_spec.rb b/spec/views/tblocationreports/show.html.erb_spec.rb new file mode 100644 index 0000000..5bd7f0a --- /dev/null +++ b/spec/views/tblocationreports/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "tblocationreports/show" do + before(:each) do + @tblocationreport = assign(:tblocationreport, stub_model(Tblocationreport)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/villageworkers/edit.html.erb_spec.rb b/spec/views/villageworkers/edit.html.erb_spec.rb new file mode 100644 index 0000000..b565b9f --- /dev/null +++ b/spec/views/villageworkers/edit.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "villageworkers/edit" do + before(:each) do + @villageworker = assign(:villageworker, stub_model(Villageworker, + :firstname => "MyString", + :lastname => "MyString", + :middlename => "MyString", + :phonenumber => "MyString", + :nationalid => "MyString", + :male => "MyString", + :village => 1 + )) + end + + it "renders the edit villageworker form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => villageworkers_path(@villageworker), :method => "post" do + assert_select "input#villageworker_firstname", :name => "villageworker[firstname]" + assert_select "input#villageworker_lastname", :name => "villageworker[lastname]" + assert_select "input#villageworker_middlename", :name => "villageworker[middlename]" + assert_select "input#villageworker_phonenumber", :name => "villageworker[phonenumber]" + assert_select "input#villageworker_nationalid", :name => "villageworker[nationalid]" + assert_select "input#villageworker_male", :name => "villageworker[male]" + assert_select "input#villageworker_village", :name => "villageworker[village]" + end + end +end diff --git a/spec/views/villageworkers/index.html.erb_spec.rb b/spec/views/villageworkers/index.html.erb_spec.rb new file mode 100644 index 0000000..1f36a6b --- /dev/null +++ b/spec/views/villageworkers/index.html.erb_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +describe "villageworkers/index" do + before(:each) do + assign(:villageworkers, [ + stub_model(Villageworker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :male => "Male", + :village => 1 + ), + stub_model(Villageworker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :male => "Male", + :village => 1 + ) + ]) + end + + it "renders a list of villageworkers" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Firstname".to_s, :count => 2 + assert_select "tr>td", :text => "Lastname".to_s, :count => 2 + assert_select "tr>td", :text => "Middlename".to_s, :count => 2 + assert_select "tr>td", :text => "Phonenumber".to_s, :count => 2 + assert_select "tr>td", :text => "Nationalid".to_s, :count => 2 + assert_select "tr>td", :text => "Male".to_s, :count => 2 + assert_select "tr>td", :text => 1.to_s, :count => 2 + end +end diff --git a/spec/views/villageworkers/new.html.erb_spec.rb b/spec/views/villageworkers/new.html.erb_spec.rb new file mode 100644 index 0000000..5ce3082 --- /dev/null +++ b/spec/views/villageworkers/new.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "villageworkers/new" do + before(:each) do + assign(:villageworker, stub_model(Villageworker, + :firstname => "MyString", + :lastname => "MyString", + :middlename => "MyString", + :phonenumber => "MyString", + :nationalid => "MyString", + :male => "MyString", + :village => 1 + ).as_new_record) + end + + it "renders new villageworker form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form", :action => villageworkers_path, :method => "post" do + assert_select "input#villageworker_firstname", :name => "villageworker[firstname]" + assert_select "input#villageworker_lastname", :name => "villageworker[lastname]" + assert_select "input#villageworker_middlename", :name => "villageworker[middlename]" + assert_select "input#villageworker_phonenumber", :name => "villageworker[phonenumber]" + assert_select "input#villageworker_nationalid", :name => "villageworker[nationalid]" + assert_select "input#villageworker_male", :name => "villageworker[male]" + assert_select "input#villageworker_village", :name => "villageworker[village]" + end + end +end diff --git a/spec/views/villageworkers/show.html.erb_spec.rb b/spec/views/villageworkers/show.html.erb_spec.rb new file mode 100644 index 0000000..a54476e --- /dev/null +++ b/spec/views/villageworkers/show.html.erb_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe "villageworkers/show" do + before(:each) do + @villageworker = assign(:villageworker, stub_model(Villageworker, + :firstname => "Firstname", + :lastname => "Lastname", + :middlename => "Middlename", + :phonenumber => "Phonenumber", + :nationalid => "Nationalid", + :male => "Male", + :village => 1 + )) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + rendered.should match(/Firstname/) + rendered.should match(/Lastname/) + rendered.should match(/Middlename/) + rendered.should match(/Phonenumber/) + rendered.should match(/Nationalid/) + rendered.should match(/Male/) + rendered.should match(/1/) + end +end diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/sms.yml b/test/fixtures/sms.yml new file mode 100644 index 0000000..00417cc --- /dev/null +++ b/test/fixtures/sms.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + phone: MyString + text: MyString + +two: + phone: MyString + text: MyString diff --git a/test/fixtures/text_messages.yml b/test/fixtures/text_messages.yml new file mode 100644 index 0000000..e4a88e2 --- /dev/null +++ b/test/fixtures/text_messages.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + phone: MyString + text: MyText + +two: + phone: MyString + text: MyText diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..87a41cf --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + hashed_password: MyString + salt: MyString + +two: + name: MyString + hashed_password: MyString + salt: MyString diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb new file mode 100644 index 0000000..8d448e9 --- /dev/null +++ b/test/functional/admin_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class AdminControllerTest < ActionController::TestCase + test "should get index" do + get :index + assert_response :success + end + +end diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb new file mode 100644 index 0000000..7e1dbde --- /dev/null +++ b/test/functional/sessions_controller_test.rb @@ -0,0 +1,19 @@ +require 'test_helper' + +class SessionsControllerTest < ActionController::TestCase + test "should get new" do + get :new + assert_response :success + end + + test "should get create" do + get :create + assert_response :success + end + + test "should get destroy" do + get :destroy + assert_response :success + end + +end diff --git a/test/functional/sms_controller_test.rb b/test/functional/sms_controller_test.rb new file mode 100644 index 0000000..a0b3aa5 --- /dev/null +++ b/test/functional/sms_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class SmsControllerTest < ActionController::TestCase + setup do + @sm = sms(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:sms) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create sm" do + assert_difference('Sm.count') do + post :create, sm: @sm.attributes + end + + assert_redirected_to sm_path(assigns(:sm)) + end + + test "should show sm" do + get :show, id: @sm + assert_response :success + end + + test "should get edit" do + get :edit, id: @sm + assert_response :success + end + + test "should update sm" do + put :update, id: @sm, sm: @sm.attributes + assert_redirected_to sm_path(assigns(:sm)) + end + + test "should destroy sm" do + assert_difference('Sm.count', -1) do + delete :destroy, id: @sm + end + + assert_redirected_to sms_path + end +end diff --git a/test/functional/textmessage_controller_test.rb b/test/functional/textmessage_controller_test.rb new file mode 100644 index 0000000..d82f456 --- /dev/null +++ b/test/functional/textmessage_controller_test.rb @@ -0,0 +1,9 @@ +require 'test_helper' + +class TextmessageControllerTest < ActionController::TestCase + test "should get new" do + get :new + assert_response :success + end + +end diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb new file mode 100644 index 0000000..9a5355e --- /dev/null +++ b/test/functional/users_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class UsersControllerTest < ActionController::TestCase + setup do + @user = users(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:users) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create user" do + assert_difference('User.count') do + post :create, user: @user.attributes + end + + assert_redirected_to user_path(assigns(:user)) + end + + test "should show user" do + get :show, id: @user + assert_response :success + end + + test "should get edit" do + get :edit, id: @user + assert_response :success + end + + test "should update user" do + put :update, id: @user, user: @user.attributes + assert_redirected_to user_path(assigns(:user)) + end + + test "should destroy user" do + assert_difference('User.count', -1) do + delete :destroy, id: @user + end + + assert_redirected_to users_path + end +end diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb new file mode 100644 index 0000000..3fea27b --- /dev/null +++ b/test/performance/browsing_test.rb @@ -0,0 +1,12 @@ +require 'test_helper' +require 'rails/performance_test_help' + +class BrowsingTest < ActionDispatch::PerformanceTest + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } + + def test_homepage + get '/' + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..8bf1192 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,13 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' + +class ActiveSupport::TestCase + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/unit/helpers/admin_helper_test.rb b/test/unit/helpers/admin_helper_test.rb new file mode 100644 index 0000000..23d9f40 --- /dev/null +++ b/test/unit/helpers/admin_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class AdminHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/sessions_helper_test.rb b/test/unit/helpers/sessions_helper_test.rb new file mode 100644 index 0000000..7d44e09 --- /dev/null +++ b/test/unit/helpers/sessions_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SessionsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/sms_helper_test.rb b/test/unit/helpers/sms_helper_test.rb new file mode 100644 index 0000000..a899cd3 --- /dev/null +++ b/test/unit/helpers/sms_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class SmsHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/textmessage_helper_test.rb b/test/unit/helpers/textmessage_helper_test.rb new file mode 100644 index 0000000..ae97ab9 --- /dev/null +++ b/test/unit/helpers/textmessage_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class TextmessageHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/users_helper_test.rb b/test/unit/helpers/users_helper_test.rb new file mode 100644 index 0000000..96af37a --- /dev/null +++ b/test/unit/helpers/users_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class UsersHelperTest < ActionView::TestCase +end diff --git a/test/unit/sm_test.rb b/test/unit/sm_test.rb new file mode 100644 index 0000000..769241b --- /dev/null +++ b/test/unit/sm_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class SmTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/text_message_test.rb b/test/unit/text_message_test.rb new file mode 100644 index 0000000..89cc76b --- /dev/null +++ b/test/unit/text_message_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class TextMessageTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb new file mode 100644 index 0000000..82f61e0 --- /dev/null +++ b/test/unit/user_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class UserTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/vendor/assets/javascripts/.gitkeep b/vendor/assets/javascripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/gruff-0.3.6/History.txt b/vendor/gruff-0.3.6/History.txt new file mode 100644 index 0000000..566dfb4 --- /dev/null +++ b/vendor/gruff-0.3.6/History.txt @@ -0,0 +1,117 @@ +== 0.3.6 + +* Fixed manifest to list dot graph [theirishpenguin] +* Fixed color cycling error [Gunnar Wolf] +* Handle case where a line graph data set only has one value [Ron Colwill] + +== 0.3.5 + +* Added dot graph from Erik Andrejko + +== 0.3.4 + +* Reverted DEBUG=true. Will add a check in the release process so this doesn't happen again. +* Future releases will end in an odd number for development (topfunky-gruff on GitHub) or even for production releases. + +== 0.3.3 + +* Legend line wrapping [Mat Schaffer] +* Stacked area graph fixes [James Coglan] + +== 0.3.2 + +* Include init.rb for use as a Rails plugin. + +== 0.3.1 + +* Fixed missing bullet graph bug (experimental, will be in a future release). + +== 0.3.0 + +* Fixed bug where pie graphs weren't drawing their label correctly. + +== 0.2.9 + +* Patch to make SideBar accurate instead of stacked [Marik] +* Will be extracting net, pie, stacked, and side-stacked to separate gem + in next release. + +== 0.2.8 + +* New accumulator bar graph (experimental) +* Better mini graphs +* Bug fixes + +== 0.2.7 + +* Regenerated Manifest.txt +* Added scene sample to package +* Added mini side_bar (EXPERIMENTAL) +* Added @zero_degree option to Gruff::Pie so first slice can start somewhere other than 3 o'clock +* Increased size of numbers in Gruff::Mini::Pie +* Added legend_box_size accessor + +== 0.2.6 + +* Fixed missing side_bar.rb in Manifest.txt + +== 0.2.5 + +* New mini graph types (Experimental) +* Marker lines can be different color than text labels +* Theme definition cleanup + +== 0.2.4 + +* Added option to hide line numbers +* Fixed code that was causing warnings + +== 0.2.3 + +* Cleaned up measurements so the graph expands to fill the available space +* Added x-axis and y-axis label options + +== 0.1.2 + +* minimum_value and maximum_value can be set after data() to manually scale the graph +* Fixed infinite loop bug when values are all equal +* Added experimental net and spider graphs +* Added non-linear scene graph for a simple interface to complex layered graphs +* Initial refactoring of tests +* A host of other bug fixes + +== 0.0.8 + +* NEW Sidestacked Bar Graphs. [Alun Eyre] +* baseline_value larger than data will now show correctly. [Mike Perham] +* hide_dots and hide_lines are now options for line graphs. + +== 0.0.6 + +* Fixed hang when no data is passed. + +== 0.0.4 + +* Added bar graphs +* Added area graphs +* Added pie graphs +* Added render_image_background for using images as background on a theme +* Fixed small size legend centering issue +* Added initial line marker rounding to significant digits (Christian Winkler) +* Line graphs line width is scaled with number of points being drawn (Christian Winkler) + +== 0.0.3 + +* Added option to draw line graphs without the lines (points only), thanks to Eric Hodel +* Removed font-minimum check so graphs look better at 300px width + +== 0.0.2 + +* Fixed to_blob (thanks to Carlos Villela) +* Added bar graphs (initial functionality...will be enhanced) +* Removed rendered test output from gem + +== 0.0.1 + +* Initial release. +* Line graphs only. Other graph styles coming soon. diff --git a/vendor/gruff-0.3.6/MIT-LICENSE b/vendor/gruff-0.3.6/MIT-LICENSE new file mode 100644 index 0000000..2fec786 --- /dev/null +++ b/vendor/gruff-0.3.6/MIT-LICENSE @@ -0,0 +1,21 @@ +Copyright (c) 2005-2008 Topfunky Corporation boss@topfunky.com + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/vendor/gruff-0.3.6/Manifest.txt b/vendor/gruff-0.3.6/Manifest.txt new file mode 100644 index 0000000..eba71ae --- /dev/null +++ b/vendor/gruff-0.3.6/Manifest.txt @@ -0,0 +1,81 @@ +History.txt +MIT-LICENSE +Manifest.txt +README.txt +Rakefile +assets/bubble.png +assets/city_scene/background/0000.png +assets/city_scene/background/0600.png +assets/city_scene/background/2000.png +assets/city_scene/clouds/cloudy.png +assets/city_scene/clouds/partly_cloudy.png +assets/city_scene/clouds/stormy.png +assets/city_scene/grass/default.png +assets/city_scene/haze/true.png +assets/city_scene/number_sample/1.png +assets/city_scene/number_sample/2.png +assets/city_scene/number_sample/default.png +assets/city_scene/sky/0000.png +assets/city_scene/sky/0200.png +assets/city_scene/sky/0400.png +assets/city_scene/sky/0600.png +assets/city_scene/sky/0800.png +assets/city_scene/sky/1000.png +assets/city_scene/sky/1200.png +assets/city_scene/sky/1400.png +assets/city_scene/sky/1500.png +assets/city_scene/sky/1700.png +assets/city_scene/sky/2000.png +assets/pc306715.jpg +assets/plastik/blue.png +assets/plastik/green.png +assets/plastik/red.png +init.rb +lib/gruff.rb +lib/gruff/accumulator_bar.rb +lib/gruff/area.rb +lib/gruff/bar.rb +lib/gruff/bar_conversion.rb +lib/gruff/base.rb +lib/gruff/bullet.rb +lib/gruff/deprecated.rb +lib/gruff/dot.rb +lib/gruff/line.rb +lib/gruff/mini/bar.rb +lib/gruff/mini/legend.rb +lib/gruff/mini/pie.rb +lib/gruff/mini/side_bar.rb +lib/gruff/net.rb +lib/gruff/photo_bar.rb +lib/gruff/pie.rb +lib/gruff/scene.rb +lib/gruff/side_bar.rb +lib/gruff/side_stacked_bar.rb +lib/gruff/spider.rb +lib/gruff/stacked_area.rb +lib/gruff/stacked_bar.rb +lib/gruff/stacked_mixin.rb +rails_generators/gruff/gruff_generator.rb +rails_generators/gruff/templates/controller.rb +rails_generators/gruff/templates/functional_test.rb +test/gruff_test_case.rb +test/test_accumulator_bar.rb +test/test_area.rb +test/test_bar.rb +test/test_base.rb +test/test_bullet.rb +test/test_dot.rb +test/test_legend.rb +test/test_line.rb +test/test_mini_bar.rb +test/test_mini_pie.rb +test/test_mini_side_bar.rb +test/test_net.rb +test/test_photo.rb +test/test_pie.rb +test/test_scene.rb +test/test_side_bar.rb +test/test_sidestacked_bar.rb +test/test_spider.rb +test/test_stacked_area.rb +test/test_stacked_bar.rb diff --git a/vendor/gruff-0.3.6/README.txt b/vendor/gruff-0.3.6/README.txt new file mode 100644 index 0000000..d973eb2 --- /dev/null +++ b/vendor/gruff-0.3.6/README.txt @@ -0,0 +1,40 @@ +== Gruff Graphs + +A library for making beautiful graphs. + +== Samples + +http://nubyonrails.com/pages/gruff + +== Documentation + +http://gruff.rubyforge.org + +See the test suite in test/line_test.rb for examples. + +== Rails Plugin + +Gruff is easy to use with Rails. + + gem install gruff + cd vendor/plugins && gem unpack gruff + +== WARNING + +This is beta-quality software. It works well according to my tests, but the API may change and other features will be added. + +== Source + +The source for this project is now kept at GitHub: + +http://github.com/topfunky/gruff/tree/master + +== CONTRIBUTE + +Patches appreciated, especially if they are in Git format (with metadata so your name shows up in the commit logs). + +Use these instructions: + +http://gweezlebur.com/2008/2/1/so-you-want-to-contribute-to-merb-core-part-1 + +http://gweezlebur.com/2008/2/9/contributing-to-merb-part-2 diff --git a/vendor/gruff-0.3.6/Rakefile b/vendor/gruff-0.3.6/Rakefile new file mode 100644 index 0000000..a49e680 --- /dev/null +++ b/vendor/gruff-0.3.6/Rakefile @@ -0,0 +1,55 @@ +require 'rubygems' +require 'hoe' +$:.unshift(File.dirname(__FILE__) + "/lib") +require 'gruff' + +Hoe.new('Gruff', Gruff::VERSION) do |p| + p.name = "gruff" + p.author = "Geoffrey Grosenbach" + p.description = "Beautiful graphs for one or multiple datasets. Can be used on websites or in documents." + p.email = 'boss@topfunky.com' + p.summary = "Beautiful graphs for one or multiple datasets." + p.url = "http://nubyonrails.com/pages/gruff" + p.clean_globs = ['test/output/*.png'] + p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") + p.remote_rdoc_dir = '' # Release to root +end + +desc "Simple require on packaged files to make sure they are all there" +task :verify => :package do + # An error message will be displayed if files are missing + if system %(ruby -e "require 'pkg/gruff-#{Gruff::VERSION}/lib/gruff'") + puts "\nThe library files are present" + end + raise "\n*** Gruff::Base::DEBUG must be set to false for releases ***\n\n" if Gruff::Base::DEBUG +end + +task :release => :verify + +namespace :test do + + desc "Run mini tests" + task :mini => :clean do + Dir['test/test_mini*'].each do |file| + system "ruby #{file}" + end + + end + +end + +## +# Catch unmatched tasks and run them as a unit test. +# +# Makes it possible to do +# +# rake pie +# +# To run the +test/test_pie+ and +test/test_mini_pie+ files. + +rule '' do |t| + # Rake::Task["clean"].invoke + Dir["test/test_*#{t.name}*.rb"].each do |filename| + system "ruby #{filename}" + end +end diff --git a/vendor/gruff-0.3.6/assets/bubble.png b/vendor/gruff-0.3.6/assets/bubble.png new file mode 100644 index 0000000..f1a44e6 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/bubble.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/background/0000.png b/vendor/gruff-0.3.6/assets/city_scene/background/0000.png new file mode 100644 index 0000000..fe1d790 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/background/0000.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/background/0600.png b/vendor/gruff-0.3.6/assets/city_scene/background/0600.png new file mode 100644 index 0000000..a345866 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/background/0600.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/background/2000.png b/vendor/gruff-0.3.6/assets/city_scene/background/2000.png new file mode 100644 index 0000000..fe1d790 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/background/2000.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/clouds/cloudy.png b/vendor/gruff-0.3.6/assets/city_scene/clouds/cloudy.png new file mode 100644 index 0000000..94dbbc2 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/clouds/cloudy.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/clouds/partly_cloudy.png b/vendor/gruff-0.3.6/assets/city_scene/clouds/partly_cloudy.png new file mode 100644 index 0000000..d073e8e Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/clouds/partly_cloudy.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/clouds/stormy.png b/vendor/gruff-0.3.6/assets/city_scene/clouds/stormy.png new file mode 100644 index 0000000..b542ba1 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/clouds/stormy.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/grass/default.png b/vendor/gruff-0.3.6/assets/city_scene/grass/default.png new file mode 100644 index 0000000..7002fa3 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/grass/default.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/haze/true.png b/vendor/gruff-0.3.6/assets/city_scene/haze/true.png new file mode 100644 index 0000000..27122bd Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/haze/true.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/number_sample/1.png b/vendor/gruff-0.3.6/assets/city_scene/number_sample/1.png new file mode 100644 index 0000000..1786fa5 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/number_sample/1.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/number_sample/2.png b/vendor/gruff-0.3.6/assets/city_scene/number_sample/2.png new file mode 100644 index 0000000..be500fc Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/number_sample/2.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/number_sample/default.png b/vendor/gruff-0.3.6/assets/city_scene/number_sample/default.png new file mode 100644 index 0000000..7442b46 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/number_sample/default.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/0000.png b/vendor/gruff-0.3.6/assets/city_scene/sky/0000.png new file mode 100644 index 0000000..1786fa5 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/0000.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/0200.png b/vendor/gruff-0.3.6/assets/city_scene/sky/0200.png new file mode 100644 index 0000000..be500fc Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/0200.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/0400.png b/vendor/gruff-0.3.6/assets/city_scene/sky/0400.png new file mode 100644 index 0000000..7442b46 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/0400.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/0600.png b/vendor/gruff-0.3.6/assets/city_scene/sky/0600.png new file mode 100644 index 0000000..a50ea7a Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/0600.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/0800.png b/vendor/gruff-0.3.6/assets/city_scene/sky/0800.png new file mode 100644 index 0000000..cfd0039 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/0800.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/1000.png b/vendor/gruff-0.3.6/assets/city_scene/sky/1000.png new file mode 100644 index 0000000..842535f Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/1000.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/1200.png b/vendor/gruff-0.3.6/assets/city_scene/sky/1200.png new file mode 100644 index 0000000..2834156 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/1200.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/1400.png b/vendor/gruff-0.3.6/assets/city_scene/sky/1400.png new file mode 100644 index 0000000..795c05a Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/1400.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/1500.png b/vendor/gruff-0.3.6/assets/city_scene/sky/1500.png new file mode 100644 index 0000000..1cd0c14 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/1500.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/1700.png b/vendor/gruff-0.3.6/assets/city_scene/sky/1700.png new file mode 100644 index 0000000..ddb9178 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/1700.png differ diff --git a/vendor/gruff-0.3.6/assets/city_scene/sky/2000.png b/vendor/gruff-0.3.6/assets/city_scene/sky/2000.png new file mode 100644 index 0000000..767bde7 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/city_scene/sky/2000.png differ diff --git a/vendor/gruff-0.3.6/assets/pc306715.jpg b/vendor/gruff-0.3.6/assets/pc306715.jpg new file mode 100644 index 0000000..6cbe85a Binary files /dev/null and b/vendor/gruff-0.3.6/assets/pc306715.jpg differ diff --git a/vendor/gruff-0.3.6/assets/plastik/blue.png b/vendor/gruff-0.3.6/assets/plastik/blue.png new file mode 100644 index 0000000..8e7e4c9 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/plastik/blue.png differ diff --git a/vendor/gruff-0.3.6/assets/plastik/green.png b/vendor/gruff-0.3.6/assets/plastik/green.png new file mode 100644 index 0000000..5fb1444 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/plastik/green.png differ diff --git a/vendor/gruff-0.3.6/assets/plastik/red.png b/vendor/gruff-0.3.6/assets/plastik/red.png new file mode 100644 index 0000000..82ca767 Binary files /dev/null and b/vendor/gruff-0.3.6/assets/plastik/red.png differ diff --git a/vendor/gruff-0.3.6/init.rb b/vendor/gruff-0.3.6/init.rb new file mode 100644 index 0000000..6b78f4a --- /dev/null +++ b/vendor/gruff-0.3.6/init.rb @@ -0,0 +1,2 @@ +# For Rails +require 'gruff' diff --git a/vendor/gruff-0.3.6/lib/gruff.rb b/vendor/gruff-0.3.6/lib/gruff.rb new file mode 100644 index 0000000..a809963 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff.rb @@ -0,0 +1,28 @@ +# Extra full path added to fix loading errors on some installations. + +%w( + base + area + bar + line + dot + pie + spider + net + stacked_area + stacked_bar + side_stacked_bar + side_bar + accumulator_bar + + scene + + mini/legend + mini/bar + mini/pie + mini/side_bar +).each do |filename| + require File.dirname(__FILE__) + "/gruff/#{filename}" +end + +# TODO bullet diff --git a/vendor/gruff-0.3.6/lib/gruff/accumulator_bar.rb b/vendor/gruff-0.3.6/lib/gruff/accumulator_bar.rb new file mode 100644 index 0000000..310e193 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/accumulator_bar.rb @@ -0,0 +1,27 @@ +require File.dirname(__FILE__) + '/base' + +## +# A special bar graph that shows a single dataset as a set of +# stacked bars. The bottom bar shows the running total and +# the top bar shows the new value being added to the array. + +class Gruff::AccumulatorBar < Gruff::StackedBar + + def draw + raise(Gruff::IncorrectNumberOfDatasetsException) unless @data.length == 1 + + accumulator_array = [] + index = 0 + + increment_array = @data.first[DATA_VALUES_INDEX].inject([]) {|memo, value| + memo << ((index > 0) ? (value + memo.max) : value) + accumulator_array << memo[index] - value + index += 1 + memo + } + data "Accumulator", accumulator_array + + super + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/area.rb b/vendor/gruff-0.3.6/lib/gruff/area.rb new file mode 100644 index 0000000..5ad0829 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/area.rb @@ -0,0 +1,58 @@ + +require File.dirname(__FILE__) + '/base' + +class Gruff::Area < Gruff::Base + + def draw + super + + return unless @has_data + + @x_increment = @graph_width / (@column_count - 1).to_f + @d = @d.stroke 'transparent' + + @norm_data.each do |data_row| + poly_points = Array.new + prev_x = prev_y = 0.0 + @d = @d.fill data_row[DATA_COLOR_INDEX] + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index| + # Use incremented x and scaled y + new_x = @graph_left + (@x_increment * index) + new_y = @graph_top + (@graph_height - data_point * @graph_height) + + if prev_x > 0 and prev_y > 0 then + poly_points << new_x + poly_points << new_y + + #@d = @d.polyline(prev_x, prev_y, new_x, new_y) + else + poly_points << @graph_left + poly_points << @graph_bottom - 1 + poly_points << new_x + poly_points << new_y + + #@d = @d.polyline(@graph_left, @graph_bottom, new_x, new_y) + end + + draw_label(new_x, index) + + prev_x = new_x + prev_y = new_y + end + + # Add closing points, draw polygon + poly_points << @graph_right + poly_points << @graph_bottom - 1 + poly_points << @graph_left + poly_points << @graph_bottom - 1 + + @d = @d.polyline(*poly_points) + + end + + @d.draw(@base_image) + end + + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/bar.rb b/vendor/gruff-0.3.6/lib/gruff/bar.rb new file mode 100644 index 0000000..844ac18 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/bar.rb @@ -0,0 +1,87 @@ +require File.dirname(__FILE__) + '/base' +require File.dirname(__FILE__) + '/bar_conversion' + +class Gruff::Bar < Gruff::Base + + # Spacing factor applied between bars + attr_accessor :bar_spacing + + def draw + # Labels will be centered over the left of the bar if + # there are more labels than columns. This is basically the same + # as where it would be for a line graph. + @center_labels_over_point = (@labels.keys.length > @column_count ? true : false) + + super + return unless @has_data + + draw_bars + end + +protected + + def draw_bars + # Setup spacing. + # + # Columns sit side-by-side. + @bar_spacing ||= 0.9 # space between the bars + @bar_width = @graph_width / (@column_count * @data.length).to_f + padding = (@bar_width * (1 - @bar_spacing)) / 2 + + @d = @d.stroke_opacity 0.0 + + # Setup the BarConversion Object + conversion = Gruff::BarConversion.new() + conversion.graph_height = @graph_height + conversion.graph_top = @graph_top + + # Set up the right mode [1,2,3] see BarConversion for further explanation + if @minimum_value >= 0 then + # all bars go from zero to positiv + conversion.mode = 1 + else + # all bars go from 0 to negativ + if @maximum_value <= 0 then + conversion.mode = 2 + else + # bars either go from zero to negativ or to positiv + conversion.mode = 3 + conversion.spread = @spread + conversion.minimum_value = @minimum_value + conversion.zero = -@minimum_value/@spread + end + end + + # iterate over all normalised data + @norm_data.each_with_index do |data_row, row_index| + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + # Use incremented x and scaled y + # x + left_x = @graph_left + (@bar_width * (row_index + point_index + ((@data.length - 1) * point_index))) + padding + right_x = left_x + @bar_width * @bar_spacing + # y + conv = [] + conversion.getLeftYRightYscaled( data_point, conv ) + + # create new bar + @d = @d.fill data_row[DATA_COLOR_INDEX] + @d = @d.rectangle(left_x, conv[0], right_x, conv[1]) + + # Calculate center based on bar_width and current row + label_center = @graph_left + + (@data.length * @bar_width * point_index) + + (@data.length * @bar_width / 2.0) + # Subtract half a bar width to center left if requested + draw_label(label_center - (@center_labels_over_point ? @bar_width / 2.0 : 0.0), point_index) + end + + end + + # Draw the last label if requested + draw_label(@graph_right, @column_count) if @center_labels_over_point + + @d.draw(@base_image) + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/bar_conversion.rb b/vendor/gruff-0.3.6/lib/gruff/bar_conversion.rb new file mode 100644 index 0000000..880daca --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/bar_conversion.rb @@ -0,0 +1,46 @@ +## +# Original Author: David Stokar +# +# This class perfoms the y coordinats conversion for the bar class. +# +# There are three cases: +# +# 1. Bars all go from zero in positive direction +# 2. Bars all go from zero to negative direction +# 3. Bars either go from zero to positive or from zero to negative +# +class Gruff::BarConversion + attr_writer :mode + attr_writer :zero + attr_writer :graph_top + attr_writer :graph_height + attr_writer :minimum_value + attr_writer :spread + + def getLeftYRightYscaled( data_point, result ) + case @mode + when 1 then # Case one + # minimum value >= 0 ( only positiv values ) + result[0] = @graph_top + @graph_height*(1 - data_point) + 1 + result[1] = @graph_top + @graph_height - 1 + when 2 then # Case two + # only negativ values + result[0] = @graph_top + 1 + result[1] = @graph_top + @graph_height*(1 - data_point) - 1 + when 3 then # Case three + # positiv and negativ values + val = data_point-@minimum_value/@spread + if ( data_point >= @zero ) then + result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1 + result[1] = @graph_top + @graph_height*(1 - @zero) - 1 + else + result[0] = @graph_top + @graph_height*(1 - (val-@zero)) + 1 + result[1] = @graph_top + @graph_height*(1 - @zero) - 1 + end + else + result[0] = 0.0 + result[1] = 0.0 + end + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/base.rb b/vendor/gruff-0.3.6/lib/gruff/base.rb new file mode 100644 index 0000000..f655cc5 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/base.rb @@ -0,0 +1,1123 @@ +require 'rubygems' +require 'RMagick' + +require File.dirname(__FILE__) + '/deprecated' + +## +# = Gruff. Graphs. +# +# Author:: Geoffrey Grosenbach boss@topfunky.com +# +# Originally Created:: October 23, 2005 +# +# Extra thanks to Tim Hunter for writing RMagick, and also contributions by +# Jarkko Laine, Mike Perham, Andreas Schwarz, Alun Eyre, Guillaume Theoret, +# David Stokar, Paul Rogers, Dave Woodward, Frank Oxener, Kevin Clark, Cies +# Breijs, Richard Cowin, and a cast of thousands. +# +# See Gruff::Base#theme= for setting themes. + +module Gruff + + # This is the version of Gruff you are using. + VERSION = '0.3.6' + + class Base + + include Magick + include Deprecated + + # Draw extra lines showing where the margins and text centers are + DEBUG = false + + # Used for navigating the array of data to plot + DATA_LABEL_INDEX = 0 + DATA_VALUES_INDEX = 1 + DATA_COLOR_INDEX = 2 + + # Space around text elements. Mostly used for vertical spacing + LEGEND_MARGIN = TITLE_MARGIN = 20.0 + LABEL_MARGIN = 10.0 + DEFAULT_MARGIN = 20.0 + + DEFAULT_TARGET_WIDTH = 800 + + THOUSAND_SEPARATOR = ',' + + # Blank space above the graph + attr_accessor :top_margin + + # Blank space below the graph + attr_accessor :bottom_margin + + # Blank space to the right of the graph + attr_accessor :right_margin + + # Blank space to the left of the graph + attr_accessor :left_margin + + # Blank space below the title + attr_accessor :title_margin + + # Blank space below the legend + attr_accessor :legend_margin + + # A hash of names for the individual columns, where the key is the array + # index for the column this label represents. + # + # Not all columns need to be named. + # + # Example: 0 => 2005, 3 => 2006, 5 => 2007, 7 => 2008 + attr_accessor :labels + + # Used internally for spacing. + # + # By default, labels are centered over the point they represent. + attr_accessor :center_labels_over_point + + # Used internally for horizontal graph types. + attr_accessor :has_left_labels + + # A label for the bottom of the graph + attr_accessor :x_axis_label + + # A label for the left side of the graph + attr_accessor :y_axis_label + + # attr_accessor :x_axis_increment + + # Manually set increment of the horizontal marking lines + attr_accessor :y_axis_increment + + # Get or set the list of colors that will be used to draw the bars or lines. + attr_accessor :colors + + # The large title of the graph displayed at the top + attr_accessor :title + + # Font used for titles, labels, etc. Works best if you provide the full + # path to the TTF font file. RMagick must be built with the Freetype + # libraries for this to work properly. + # + # Tries to find Bitstream Vera (Vera.ttf) in the location specified by + # ENV['MAGICK_FONT_PATH']. Uses default RMagick font otherwise. + # + # The font= method below fulfills the role of the writer, so we only need + # a reader here. + attr_reader :font + + attr_accessor :font_color + + # Prevent drawing of line markers + attr_accessor :hide_line_markers + + # Prevent drawing of the legend + attr_accessor :hide_legend + + # Prevent drawing of the title + attr_accessor :hide_title + + # Prevent drawing of line numbers + attr_accessor :hide_line_numbers + + # Message shown when there is no data. Fits up to 20 characters. Defaults + # to "No Data." + attr_accessor :no_data_message + + # The font size of the large title at the top of the graph + attr_accessor :title_font_size + + # Optionally set the size of the font. Based on an 800x600px graph. + # Default is 20. + # + # Will be scaled down if graph is smaller than 800px wide. + attr_accessor :legend_font_size + + # The font size of the labels around the graph + attr_accessor :marker_font_size + + # The color of the auxiliary lines + attr_accessor :marker_color + + # The number of horizontal lines shown for reference + attr_accessor :marker_count + + # You can manually set a minimum value instead of having the values + # guessed for you. + # + # Set it after you have given all your data to the graph object. + attr_accessor :minimum_value + + # You can manually set a maximum value, such as a percentage-based graph + # that always goes to 100. + # + # If you use this, you must set it after you have given all your data to + # the graph object. + attr_accessor :maximum_value + + # Set to false if you don't want the data to be sorted with largest avg + # values at the back. + attr_accessor :sort + + # Experimental + attr_accessor :additional_line_values + + # Experimental + attr_accessor :stacked + + # Optionally set the size of the colored box by each item in the legend. + # Default is 20.0 + # + # Will be scaled down if graph is smaller than 800px wide. + attr_accessor :legend_box_size + + # If one numerical argument is given, the graph is drawn at 4/3 ratio + # according to the given width (800 results in 800x600, 400 gives 400x300, + # etc.). + # + # Or, send a geometry string for other ratios ('800x400', '400x225'). + # + # Looks for Bitstream Vera as the default font. Expects an environment var + # of MAGICK_FONT_PATH to be set. (Uses RMagick's default font otherwise.) + def initialize(target_width=DEFAULT_TARGET_WIDTH) + if not Numeric === target_width + geometric_width, geometric_height = target_width.split('x') + @columns = geometric_width.to_f + @rows = geometric_height.to_f + else + @columns = target_width.to_f + @rows = target_width.to_f * 0.75 + end + + initialize_ivars + + reset_themes + theme_keynote + end + + # Set instance variables for this object. + # + # Subclasses can override this, call super, then set values separately. + # + # This makes it possible to set defaults in a subclass but still allow + # developers to change this values in their program. + def initialize_ivars + # Internal for calculations + @raw_columns = 800.0 + @raw_rows = 800.0 * (@rows/@columns) + @column_count = 0 + @marker_count = nil + @maximum_value = @minimum_value = nil + @has_data = false + @data = Array.new + @labels = Hash.new + @labels_seen = Hash.new + @sort = true + @title = nil + + @scale = @columns / @raw_columns + + vera_font_path = File.expand_path('Vera.ttf', ENV['MAGICK_FONT_PATH']) + @font = File.exists?(vera_font_path) ? vera_font_path : nil + + @marker_font_size = 21.0 + @legend_font_size = 20.0 + @title_font_size = 36.0 + + @top_margin = @bottom_margin = @left_margin = @right_margin = DEFAULT_MARGIN + @legend_margin = LEGEND_MARGIN + @title_margin = TITLE_MARGIN + + @legend_box_size = 20.0 + + @no_data_message = "No Data" + + @hide_line_markers = @hide_legend = @hide_title = @hide_line_numbers = false + @center_labels_over_point = true + @has_left_labels = false + + @additional_line_values = [] + @additional_line_colors = [] + @theme_options = {} + + @x_axis_label = @y_axis_label = nil + @y_axis_increment = nil + @stacked = nil + @norm_data = nil + end + + # Sets the top, bottom, left and right margins to +margin+. + def margins=(margin) + @top_margin = @left_margin = @right_margin = @bottom_margin = margin + end + + # Sets the font for graph text to the font at +font_path+. + def font=(font_path) + @font = font_path + @d.font = @font + end + + # Add a color to the list of available colors for lines. + # + # Example: + # add_color('#c0e9d3') + def add_color(colorname) + @colors << colorname + end + + # Replace the entire color list with a new array of colors. Also + # aliased as the colors= setter method. + # + # If you specify fewer colors than the number of datasets you intend + # to draw, 'increment_color' will cycle through the array, reusing + # colors as needed. + # + # Note that (as with the 'theme' method), you should set up your color + # list before you send your data (via the 'data' method). Calls to the + # 'data' method made prior to this call will use whatever color scheme + # was in place at the time data was called. + # + # Example: + # replace_colors ['#cc99cc', '#d9e043', '#34d8a2'] + def replace_colors(color_list=[]) + @colors = color_list + @color_index = 0 + end + + # You can set a theme manually. Assign a hash to this method before you + # send your data. + # + # graph.theme = { + # :colors => %w(orange purple green white red), + # :marker_color => 'blue', + # :background_colors => %w(black grey) + # } + # + # :background_image => 'squirrel.png' is also possible. + # + # (Or hopefully something better looking than that.) + # + def theme=(options) + reset_themes() + + defaults = { + :colors => ['black', 'white'], + :additional_line_colors => [], + :marker_color => 'white', + :font_color => 'black', + :background_colors => nil, + :background_image => nil + } + @theme_options = defaults.merge options + + @colors = @theme_options[:colors] + @marker_color = @theme_options[:marker_color] + @font_color = @theme_options[:font_color] || @marker_color + @additional_line_colors = @theme_options[:additional_line_colors] + + render_background + end + + # A color scheme similar to the popular presentation software. + def theme_keynote + # Colors + @blue = '#6886B4' + @yellow = '#FDD84E' + @green = '#72AE6E' + @red = '#D1695E' + @purple = '#8A6EAF' + @orange = '#EFAA43' + @white = 'white' + @colors = [@yellow, @blue, @green, @red, @purple, @orange, @white] + + self.theme = { + :colors => @colors, + :marker_color => 'white', + :font_color => 'white', + :background_colors => ['black', '#4a465a'] + } + end + + # A color scheme plucked from the colors on the popular usability blog. + def theme_37signals + # Colors + @green = '#339933' + @purple = '#cc99cc' + @blue = '#336699' + @yellow = '#FFF804' + @red = '#ff0000' + @orange = '#cf5910' + @black = 'black' + @colors = [@yellow, @blue, @green, @red, @purple, @orange, @black] + + self.theme = { + :colors => @colors, + :marker_color => 'black', + :font_color => 'black', + :background_colors => ['#d1edf5', 'white'] + } + end + + # A color scheme from the colors used on the 2005 Rails keynote + # presentation at RubyConf. + def theme_rails_keynote + # Colors + @green = '#00ff00' + @grey = '#333333' + @orange = '#ff5d00' + @red = '#f61100' + @white = 'white' + @light_grey = '#999999' + @black = 'black' + @colors = [@green, @grey, @orange, @red, @white, @light_grey, @black] + + self.theme = { + :colors => @colors, + :marker_color => 'white', + :font_color => 'white', + :background_colors => ['#0083a3', '#0083a3'] + } + end + + # A color scheme similar to that used on the popular podcast site. + def theme_odeo + # Colors + @grey = '#202020' + @white = 'white' + @dark_pink = '#a21764' + @green = '#8ab438' + @light_grey = '#999999' + @dark_blue = '#3a5b87' + @black = 'black' + @colors = [@grey, @white, @dark_blue, @dark_pink, @green, @light_grey, @black] + + self.theme = { + :colors => @colors, + :marker_color => 'white', + :font_color => 'white', + :background_colors => ['#ff47a4', '#ff1f81'] + } + end + + # A pastel theme + def theme_pastel + # Colors + @colors = [ + '#a9dada', # blue + '#aedaa9', # green + '#daaea9', # peach + '#dadaa9', # yellow + '#a9a9da', # dk purple + '#daaeda', # purple + '#dadada' # grey + ] + + self.theme = { + :colors => @colors, + :marker_color => '#aea9a9', # Grey + :font_color => 'black', + :background_colors => 'white' + } + end + + # A greyscale theme + def theme_greyscale + # Colors + @colors = [ + '#282828', # + '#383838', # + '#686868', # + '#989898', # + '#c8c8c8', # + '#e8e8e8', # + ] + + self.theme = { + :colors => @colors, + :marker_color => '#aea9a9', # Grey + :font_color => 'black', + :background_colors => 'white' + } + end + + # Parameters are an array where the first element is the name of the dataset + # and the value is an array of values to plot. + # + # Can be called multiple times with different datasets for a multi-valued + # graph. + # + # If the color argument is nil, the next color from the default theme will + # be used. + # + # NOTE: If you want to use a preset theme, you must set it before calling + # data(). + # + # Example: + # data("Bart S.", [95, 45, 78, 89, 88, 76], '#ffcc00') + def data(name, data_points=[], color=nil) + data_points = Array(data_points) # make sure it's an array + @data << [name, data_points, (color || increment_color)] + # Set column count if this is larger than previous counts + @column_count = (data_points.length > @column_count) ? data_points.length : @column_count + + # Pre-normalize + data_points.each_with_index do |data_point, index| + next if data_point.nil? + + # Setup max/min so spread starts at the low end of the data points + if @maximum_value.nil? && @minimum_value.nil? + @maximum_value = @minimum_value = data_point + end + + # TODO Doesn't work with stacked bar graphs + # Original: @maximum_value = larger_than_max?(data_point, index) ? max(data_point, index) : @maximum_value + @maximum_value = larger_than_max?(data_point) ? data_point : @maximum_value + @has_data = true if @maximum_value >= 0 + + @minimum_value = less_than_min?(data_point) ? data_point : @minimum_value + @has_data = true if @minimum_value < 0 + end + end + + # Writes the graph to a file. Defaults to 'graph.png' + # + # Example: + # write('graphs/my_pretty_graph.png') + def write(filename="graph.png") + draw() + @base_image.write(filename) + end + + # Return the graph as a rendered binary blob. + def to_blob(fileformat='PNG') + draw() + return @base_image.to_blob do + self.format = fileformat + end + end + + + + protected + + # Overridden by subclasses to do the actual plotting of the graph. + # + # Subclasses should start by calling super() for this method. + def draw + make_stacked if @stacked + setup_drawing + + debug { + # Outer margin + @d.rectangle( @left_margin, @top_margin, + @raw_columns - @right_margin, @raw_rows - @bottom_margin) + # Graph area box + @d.rectangle( @graph_left, @graph_top, @graph_right, @graph_bottom) + } + end + + # Calculates size of drawable area and draws the decorations. + # + # * line markers + # * legend + # * title + def setup_drawing + # Maybe should be done in one of the following functions for more granularity. + unless @has_data + draw_no_data() + return + end + + normalize() + setup_graph_measurements() + sort_norm_data() if @sort # Sort norm_data with avg largest values set first (for display) + + draw_legend() + draw_line_markers() + draw_axis_labels() + draw_title + end + + # Make copy of data with values scaled between 0-100 + def normalize(force=false) + if @norm_data.nil? || force + @norm_data = [] + return unless @has_data + + calculate_spread + + @data.each do |data_row| + norm_data_points = [] + data_row[DATA_VALUES_INDEX].each do |data_point| + if data_point.nil? + norm_data_points << nil + else + norm_data_points << ((data_point.to_f - @minimum_value.to_f ) / @spread) + end + end + @norm_data << [data_row[DATA_LABEL_INDEX], norm_data_points, data_row[DATA_COLOR_INDEX]] + end + end + end + + def calculate_spread # :nodoc: + @spread = @maximum_value.to_f - @minimum_value.to_f + @spread = @spread > 0 ? @spread : 1 + end + + ## + # Calculates size of drawable area, general font dimensions, etc. + + def setup_graph_measurements + @marker_caps_height = @hide_line_markers ? 0 : + calculate_caps_height(@marker_font_size) + @title_caps_height = @hide_title ? 0 : + calculate_caps_height(@title_font_size) + @legend_caps_height = @hide_legend ? 0 : + calculate_caps_height(@legend_font_size) + + if @hide_line_markers + (@graph_left, + @graph_right_margin, + @graph_bottom_margin) = [@left_margin, @right_margin, @bottom_margin] + else + longest_left_label_width = 0 + if @has_left_labels + longest_left_label_width = calculate_width(@marker_font_size, + labels.values.inject('') { |value, memo| (value.to_s.length > memo.to_s.length) ? value : memo }) * 1.25 + else + longest_left_label_width = calculate_width(@marker_font_size, + label(@maximum_value.to_f)) + end + + # Shift graph if left line numbers are hidden + line_number_width = @hide_line_numbers && !@has_left_labels ? + 0.0 : + (longest_left_label_width + LABEL_MARGIN * 2) + + @graph_left = @left_margin + + line_number_width + + (@y_axis_label.nil? ? 0.0 : @marker_caps_height + LABEL_MARGIN * 2) + + # Make space for half the width of the rightmost column label. + # Might be greater than the number of columns if between-style bar markers are used. + last_label = @labels.keys.sort.last.to_i + extra_room_for_long_label = (last_label >= (@column_count-1) && @center_labels_over_point) ? + calculate_width(@marker_font_size, @labels[last_label]) / 2.0 : + 0 + @graph_right_margin = @right_margin + extra_room_for_long_label + + @graph_bottom_margin = @bottom_margin + + @marker_caps_height + LABEL_MARGIN + end + + @graph_right = @raw_columns - @graph_right_margin + @graph_width = @raw_columns - @graph_left - @graph_right_margin + + # When @hide title, leave a title_margin space for aesthetics. + # Same with @hide_legend + @graph_top = @top_margin + + (@hide_title ? title_margin : @title_caps_height + title_margin ) + + (@hide_legend ? legend_margin : @legend_caps_height + legend_margin) + + x_axis_label_height = @x_axis_label.nil? ? 0.0 : + @marker_caps_height + LABEL_MARGIN + @graph_bottom = @raw_rows - @graph_bottom_margin - x_axis_label_height + @graph_height = @graph_bottom - @graph_top + end + + # Draw the optional labels for the x axis and y axis. + def draw_axis_labels + unless @x_axis_label.nil? + # X Axis + # Centered vertically and horizontally by setting the + # height to 1.0 and the width to the width of the graph. + x_axis_label_y_coordinate = @graph_bottom + LABEL_MARGIN * 2 + @marker_caps_height + + # TODO Center between graph area + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = NorthGravity + @d = @d.annotate_scaled( @base_image, + @raw_columns, 1.0, + 0.0, x_axis_label_y_coordinate, + @x_axis_label, @scale) + debug { @d.line 0.0, x_axis_label_y_coordinate, @raw_columns, x_axis_label_y_coordinate } + end + + unless @y_axis_label.nil? + # Y Axis, rotated vertically + @d.rotation = 90.0 + @d.gravity = CenterGravity + @d = @d.annotate_scaled( @base_image, + 1.0, @raw_rows, + @left_margin + @marker_caps_height / 2.0, 0.0, + @y_axis_label, @scale) + @d.rotation = -90.0 + end + end + + # Draws horizontal background lines and labels + def draw_line_markers + return if @hide_line_markers + + @d = @d.stroke_antialias false + + if @y_axis_increment.nil? + # Try to use a number of horizontal lines that will come out even. + # + # TODO Do the same for larger numbers...100, 75, 50, 25 + if @marker_count.nil? + (3..7).each do |lines| + if @spread % lines == 0.0 + @marker_count = lines + break + end + end + @marker_count ||= 4 + end + @increment = (@spread > 0) ? significant(@spread / @marker_count) : 1 + else + # TODO Make this work for negative values + @maximum_value = [@maximum_value.ceil, @y_axis_increment].max + @minimum_value = @minimum_value.floor + calculate_spread + normalize(true) + + @marker_count = (@spread / @y_axis_increment).to_i + @increment = @y_axis_increment + end + @increment_scaled = @graph_height.to_f / (@spread / @increment) + + # Draw horizontal line markers and annotate with numbers + (0..@marker_count).each do |index| + y = @graph_top + @graph_height - index.to_f * @increment_scaled + + @d = @d.fill(@marker_color) + @d = @d.line(@graph_left, y, @graph_right, y) + + marker_label = index * @increment + @minimum_value.to_f + + unless @hide_line_numbers + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = EastGravity + + # Vertically center with 1.0 for the height + @d = @d.annotate_scaled( @base_image, + @graph_left - LABEL_MARGIN, 1.0, + 0.0, y, + label(marker_label), @scale) + end + end + + # # Submitted by a contibutor...the utility escapes me + # i = 0 + # @additional_line_values.each do |value| + # @increment_scaled = @graph_height.to_f / (@maximum_value.to_f / value) + # + # y = @graph_top + @graph_height - @increment_scaled + # + # @d = @d.stroke(@additional_line_colors[i]) + # @d = @d.line(@graph_left, y, @graph_right, y) + # + # + # @d.fill = @additional_line_colors[i] + # @d.font = @font if @font + # @d.stroke('transparent') + # @d.pointsize = scale_fontsize(@marker_font_size) + # @d.gravity = EastGravity + # @d = @d.annotate_scaled( @base_image, + # 100, 20, + # -10, y - (@marker_font_size/2.0), + # "", @scale) + # i += 1 + # end + + @d = @d.stroke_antialias true + end + + ## + # Return the sum of values in an array. + # + # Duplicated to not conflict with active_support in Rails. + + def sum(arr) + arr.inject(0) { |i, m| m + i } + end + + ## + # Return a calculation of center + + def center(size) + (@raw_columns - size) / 2 + end + + ## + # Draws a legend with the names of the datasets matched + # to the colors used to draw them. + + def draw_legend + return if @hide_legend + + @legend_labels = @data.collect {|item| item[DATA_LABEL_INDEX] } + + legend_square_width = @legend_box_size # small square with color of this item + + # May fix legend drawing problem at small sizes + @d.font = @font if @font + @d.pointsize = @legend_font_size + + label_widths = [[]] # Used to calculate line wrap + @legend_labels.each do |label| + metrics = @d.get_type_metrics(@base_image, label.to_s) + label_width = metrics.width + legend_square_width * 2.7 + label_widths.last.push label_width + + if sum(label_widths.last) > (@raw_columns * 0.9) + label_widths.push [label_widths.last.pop] + end + end + + current_x_offset = center(sum(label_widths.first)) + current_y_offset = @hide_title ? + @top_margin + title_margin : + @top_margin + title_margin + @title_caps_height + + @legend_labels.each_with_index do |legend_label, index| + + # Draw label + @d.fill = @font_color + @d.font = @font if @font + @d.pointsize = scale_fontsize(@legend_font_size) + @d.stroke('transparent') + @d.font_weight = NormalWeight + @d.gravity = WestGravity + @d = @d.annotate_scaled( @base_image, + @raw_columns, 1.0, + current_x_offset + (legend_square_width * 1.7), current_y_offset, + legend_label.to_s, @scale) + + # Now draw box with color of this dataset + @d = @d.stroke('transparent') + @d = @d.fill @data[index][DATA_COLOR_INDEX] + @d = @d.rectangle(current_x_offset, + current_y_offset - legend_square_width / 2.0, + current_x_offset + legend_square_width, + current_y_offset + legend_square_width / 2.0) + + @d.pointsize = @legend_font_size + metrics = @d.get_type_metrics(@base_image, legend_label.to_s) + current_string_offset = metrics.width + (legend_square_width * 2.7) + + # Handle wrapping + label_widths.first.shift + if label_widths.first.empty? + debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset } + + label_widths.shift + current_x_offset = center(sum(label_widths.first)) unless label_widths.empty? + line_height = [@legend_caps_height, legend_square_width].max + legend_margin + if label_widths.length > 0 + # Wrap to next line and shrink available graph dimensions + current_y_offset += line_height + @graph_top += line_height + @graph_height = @graph_bottom - @graph_top + end + else + current_x_offset += current_string_offset + end + end + @color_index = 0 + end + + # Draws a title on the graph. + def draw_title + return if (@hide_title || @title.nil?) + + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.pointsize = scale_fontsize(@title_font_size) + @d.font_weight = BoldWeight + @d.gravity = NorthGravity + @d = @d.annotate_scaled( @base_image, + @raw_columns, 1.0, + 0, @top_margin, + @title, @scale) + end + + # Draws column labels below graph, centered over x_offset + #-- + # TODO Allow WestGravity as an option + def draw_label(x_offset, index) + return if @hide_line_markers + + if !@labels[index].nil? && @labels_seen[index].nil? + y_offset = @graph_bottom + LABEL_MARGIN + + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.font_weight = NormalWeight + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = NorthGravity + @d = @d.annotate_scaled(@base_image, + 1.0, 1.0, + x_offset, y_offset, + @labels[index], @scale) + @labels_seen[index] = 1 + debug { @d.line 0.0, y_offset, @raw_columns, y_offset } + end + end + + # Shows an error message because you have no data. + def draw_no_data + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.font_weight = NormalWeight + @d.pointsize = scale_fontsize(80) + @d.gravity = CenterGravity + @d = @d.annotate_scaled( @base_image, + @raw_columns, @raw_rows/2.0, + 0, 10, + @no_data_message, @scale) + end + + # Finds the best background to render based on the provided theme options. + # + # Creates a @base_image to draw on. + def render_background + case @theme_options[:background_colors] + when Array + @base_image = render_gradiated_background(*@theme_options[:background_colors]) + when String + @base_image = render_solid_background(@theme_options[:background_colors]) + else + @base_image = render_image_background(*@theme_options[:background_image]) + end + end + + # Make a new image at the current size with a solid +color+. + def render_solid_background(color) + Image.new(@columns, @rows) { + self.background_color = color + } + end + + # Use with a theme definition method to draw a gradiated background. + def render_gradiated_background(top_color, bottom_color) + Image.new(@columns, @rows, + GradientFill.new(0, 0, 100, 0, top_color, bottom_color)) + end + + # Use with a theme to use an image (800x600 original) background. + def render_image_background(image_path) + image = Image.read(image_path) + if @scale != 1.0 + image[0].resize!(@scale) # TODO Resize with new scale (crop if necessary for wide graph) + end + image[0] + end + + # Use with a theme to make a transparent background + def render_transparent_background + Image.new(@columns, @rows) do + self.background_color = 'transparent' + end + end + + # Resets everything to defaults (except data). + def reset_themes + @color_index = 0 + @labels_seen = {} + @theme_options = {} + + @d = Draw.new + # Scale down from 800x600 used to calculate drawing. + @d = @d.scale(@scale, @scale) + end + + def scale(value) # :nodoc: + value * @scale + end + + # Return a comparable fontsize for the current graph. + def scale_fontsize(value) + new_fontsize = value * @scale + # return new_fontsize < 10.0 ? 10.0 : new_fontsize + return new_fontsize + end + + def clip_value_if_greater_than(value, max_value) # :nodoc: + (value > max_value) ? max_value : value + end + + # Overridden by subclasses such as stacked bar. + def larger_than_max?(data_point, index=0) # :nodoc: + data_point > @maximum_value + end + + def less_than_min?(data_point, index=0) # :nodoc: + data_point < @minimum_value + end + + # Overridden by subclasses that need it. + def max(data_point, index) # :nodoc: + data_point + end + + # Overridden by subclasses that need it. + def min(data_point, index) # :nodoc: + data_point + end + + def significant(inc) # :nodoc: + return 1.0 if inc == 0 # Keep from going into infinite loop + factor = 1.0 + while (inc < 10) + inc *= 10 + factor /= 10 + end + + while (inc > 100) + inc /= 10 + factor *= 10 + end + + res = inc.floor * factor + if (res.to_i.to_f == res) + res.to_i + else + res + end + end + + # Sort with largest overall summed value at front of array so it shows up + # correctly in the drawn graph. + def sort_norm_data + @norm_data.sort! { |a,b| sums(b[DATA_VALUES_INDEX]) <=> sums(a[DATA_VALUES_INDEX]) } + end + + def sums(data_set) # :nodoc: + total_sum = 0 + data_set.collect {|num| total_sum += num.to_f } + total_sum + end + + # Used by StackedBar and child classes. + # + # May need to be moved to the StackedBar class. + def get_maximum_by_stack + # Get sum of each stack + max_hash = {} + @data.each do |data_set| + data_set[DATA_VALUES_INDEX].each_with_index do |data_point, i| + max_hash[i] = 0.0 unless max_hash[i] + max_hash[i] += data_point.to_f + end + end + + # @maximum_value = 0 + max_hash.keys.each do |key| + @maximum_value = max_hash[key] if max_hash[key] > @maximum_value + end + @minimum_value = 0 + end + + def make_stacked # :nodoc: + stacked_values = Array.new(@column_count, 0) + @data.each do |value_set| + value_set[DATA_VALUES_INDEX].each_with_index do |value, index| + stacked_values[index] += value + end + value_set[DATA_VALUES_INDEX] = stacked_values.dup + end + end + + private + + # Takes a block and draws it if DEBUG is true. + # + # Example: + # debug { @d.rectangle x1, y1, x2, y2 } + def debug + if DEBUG + @d = @d.fill 'transparent' + @d = @d.stroke 'turquoise' + @d = yield + end + end + + # Returns the next color in your color list. + def increment_color + @color_index = (@color_index + 1) % @colors.length + return @colors[@color_index - 1] + end + + # Return a formatted string representing a number value that should be + # printed as a label. + def label(value) + label = if (@spread.to_f % @marker_count.to_f == 0) || !@y_axis_increment.nil? + value.to_i.to_s + elsif @spread > 10.0 + sprintf("%0i", value) + elsif @spread >= 3.0 + sprintf("%0.2f", value) + else + value.to_s + end + + parts = label.split('.') + parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1#{THOUSAND_SEPARATOR}") + parts.join('.') + end + + # Returns the height of the capital letter 'X' for the current font and + # size. + # + # Not scaled since it deals with dimensions that the regular scaling will + # handle. + def calculate_caps_height(font_size) + @d.pointsize = font_size + @d.get_type_metrics(@base_image, 'X').height + end + + # Returns the width of a string at this pointsize. + # + # Not scaled since it deals with dimensions that the regular + # scaling will handle. + def calculate_width(font_size, text) + @d.pointsize = font_size + @d.get_type_metrics(@base_image, text.to_s).width + end + + end # Gruff::Base + + class IncorrectNumberOfDatasetsException < StandardError; end + +end # Gruff + +module Magick + + class Draw + + # Additional method to scale annotation text since Draw.scale doesn't. + def annotate_scaled(img, width, height, x, y, text, scale) + scaled_width = (width * scale) >= 1 ? (width * scale) : 1 + scaled_height = (height * scale) >= 1 ? (height * scale) : 1 + + self.annotate( img, + scaled_width, scaled_height, + x * scale, y * scale, + text) + end + + end + +end # Magick diff --git a/vendor/gruff-0.3.6/lib/gruff/bullet.rb b/vendor/gruff-0.3.6/lib/gruff/bullet.rb new file mode 100644 index 0000000..21fe1f3 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/bullet.rb @@ -0,0 +1,109 @@ +require File.dirname(__FILE__) + '/base' + +class Gruff::Bullet < Gruff::Base + + def initialize(target_width="400x40") + if not Numeric === target_width + geometric_width, geometric_height = target_width.split('x') + @columns = geometric_width.to_f + @rows = geometric_height.to_f + else + @columns = target_width.to_f + @rows = target_width.to_f / 5.0 + end + + initialize_ivars + + reset_themes + theme_greyscale + @title_font_size = 20 + end + + def data(value, maximum_value, options={}) + @value = value.to_f + @maximum_value = maximum_value.to_f + @options = options + @options.map { |k, v| @options[k] = v.to_f if v === Numeric } + end + + # def setup_drawing + # # Maybe should be done in one of the following functions for more granularity. + # unless @has_data + # draw_no_data() + # return + # end + # + # normalize() + # setup_graph_measurements() + # sort_norm_data() if @sort # Sort norm_data with avg largest values set first (for display) + # + # draw_legend() + # draw_line_markers() + # draw_axis_labels() + # draw_title + # end + + def draw + # TODO Left label + # TODO Bottom labels and markers + # @graph_bottom + # Calculations are off 800x??? + + @colors.reverse! + + draw_title + + @margin = 30.0 + @thickness = @raw_rows / 6.0 + @right_margin = @margin + @graph_left = @title_width * 1.3 rescue @margin # HACK Need to calculate real width + @graph_width = @raw_columns - @graph_left - @right_margin + @graph_height = @thickness * 3.0 + + # Background + @d = @d.fill @colors[0] + @d = @d.rectangle(@graph_left, 0, @graph_left + @graph_width, @graph_height) + + [:high, :low].each_with_index do |indicator, index| + next unless @options.has_key?(indicator) + @d = @d.fill @colors[index + 1] + indicator_width_x = @graph_left + @graph_width * (@options[indicator] / @maximum_value) + @d = @d.rectangle(@graph_left, 0, indicator_width_x, @graph_height) + end + + if @options.has_key?(:target) + @d = @d.fill @font_color + target_x = @graph_left + @graph_width * (@options[:target] / @maximum_value) + half_thickness = @thickness / 2.0 + @d = @d.rectangle(target_x, half_thickness, target_x + half_thickness, @thickness * 2 + half_thickness) + end + + # Value + @d = @d.fill @font_color + @d = @d.rectangle(@graph_left, @thickness, @graph_left + @graph_width * (@value / @maximum_value), @thickness * 2) + + @d.draw(@base_image) + end + + def draw_title + return unless @title + + @font_height = calculate_caps_height(scale_fontsize(@title_font_size)) + @title_width = calculate_width(@title_font_size, @title) + + @d.fill = @font_color + @d.font = @font if @font + @d.stroke('transparent') + @d.font_weight = NormalWeight + @d.pointsize = scale_fontsize(@title_font_size) + @d.gravity = NorthWestGravity + @d = @d.annotate_scaled(*[ + @base_image, + 1.0, 1.0, + @font_height/2, @font_height/2, + @title, + @scale + ]) + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/deprecated.rb b/vendor/gruff-0.3.6/lib/gruff/deprecated.rb new file mode 100644 index 0000000..be254b5 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/deprecated.rb @@ -0,0 +1,39 @@ + +## +# A mixin for methods that need to be deleted or have been +# replaced by cleaner code. + +module Gruff + module Deprecated + + def scale_measurements + setup_graph_measurements + end + + def total_height + @rows + 10 + end + + def graph_top + @graph_top * @scale + end + + def graph_height + @graph_height * @scale + end + + def graph_left + @graph_left * @scale + end + + def graph_width + @graph_width * @scale + end + + # TODO Should be calculate_graph_height + # def setup_graph_height + # @graph_height = @graph_bottom - @graph_top + # end + + end +end diff --git a/vendor/gruff-0.3.6/lib/gruff/dot.rb b/vendor/gruff-0.3.6/lib/gruff/dot.rb new file mode 100644 index 0000000..0fa5cc2 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/dot.rb @@ -0,0 +1,113 @@ +require File.dirname(__FILE__) + '/base' + +## +# Graph with dots and labels along a vertical access +# see: 'Creating More Effective Graphs' by Robbins + +class Gruff::Dot < Gruff::Base + + def draw + @has_left_labels = true + super + + return unless @has_data + + # Setup spacing. + # + spacing_factor = 1.0 + + @items_width = @graph_height / @column_count.to_f + @item_width = @items_width * spacing_factor / @norm_data.size + @d = @d.stroke_opacity 0.0 + height = Array.new(@column_count, 0) + length = Array.new(@column_count, @graph_left) + padding = (@items_width * (1 - spacing_factor)) / 2 + + @norm_data.each_with_index do |data_row, row_index| + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + + x_pos = @graph_left + (data_point * @graph_width) - (@item_width.to_f/6.0).round + y_pos = @graph_top + (@items_width * point_index) + padding + (@item_width.to_f/2.0).round + + if row_index == 0 + @d = @d.stroke(@marker_color) + @d = @d.stroke_width 1.0 + @d = @d.opacity 0.1 + @d = @d.line(@graph_left, y_pos, @graph_left + @graph_width, y_pos) + end + + @d = @d.fill data_row[DATA_COLOR_INDEX] + @d = @d.stroke('transparent') + @d = @d.circle(x_pos, y_pos, x_pos + (@item_width.to_f/3.0).round, y_pos) + + # Calculate center based on item_width and current row + label_center = @graph_top + (@items_width * point_index + @items_width / 2) + padding + draw_label(label_center, point_index) + end + + end + + @d.draw(@base_image) + end + +protected + + # Instead of base class version, draws vertical background lines and label + def draw_line_markers + + return if @hide_line_markers + + @d = @d.stroke_antialias false + + # Draw horizontal line markers and annotate with numbers + @d = @d.stroke(@marker_color) + @d = @d.stroke_width 1 + number_of_lines = 5 + + # TODO Round maximum marker value to a round number like 100, 0.1, 0.5, etc. + increment = significant(@maximum_value.to_f / number_of_lines) + (0..number_of_lines).each do |index| + + line_diff = (@graph_right - @graph_left) / number_of_lines + x = @graph_right - (line_diff * index) - 1 + @d = @d.line(x, @graph_bottom, x, @graph_bottom + 0.5 * LABEL_MARGIN) + diff = index - number_of_lines + marker_label = diff.abs * increment + + unless @hide_line_numbers + @d.fill = @font_color + @d.font = @font if @font + @d.stroke = 'transparent' + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = CenterGravity + # TODO Center text over line + @d = @d.annotate_scaled( @base_image, + 0, 0, # Width of box to draw text in + x, @graph_bottom + (LABEL_MARGIN * 2.0), # Coordinates of text + marker_label.to_s, @scale) + end # unless + @d = @d.stroke_antialias true + end + end + + ## + # Draw on the Y axis instead of the X + + def draw_label(y_offset, index) + if !@labels[index].nil? && @labels_seen[index].nil? + @d.fill = @font_color + @d.font = @font if @font + @d.stroke = 'transparent' + @d.font_weight = NormalWeight + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = EastGravity + @d = @d.annotate_scaled(@base_image, + 1, 1, + -@graph_left + LABEL_MARGIN * 2.0, y_offset, + @labels[index], @scale) + @labels_seen[index] = 1 + end + end + +end + diff --git a/vendor/gruff-0.3.6/lib/gruff/line.rb b/vendor/gruff-0.3.6/lib/gruff/line.rb new file mode 100644 index 0000000..b2db5cc --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/line.rb @@ -0,0 +1,135 @@ + +require File.dirname(__FILE__) + '/base' + +## +# Here's how to make a Line graph: +# +# g = Gruff::Line.new +# g.title = "A Line Graph" +# g.data 'Fries', [20, 23, 19, 8] +# g.data 'Hamburgers', [50, 19, 99, 29] +# g.write("test/output/line.png") +# +# There are also other options described below, such as #baseline_value, #baseline_color, #hide_dots, and #hide_lines. + +class Gruff::Line < Gruff::Base + + # Draw a dashed line at the given value + attr_accessor :baseline_value + + # Color of the baseline + attr_accessor :baseline_color + + # Dimensions of lines and dots; calculated based on dataset size if left unspecified + attr_accessor :line_width + attr_accessor :dot_radius + + # Hide parts of the graph to fit more datapoints, or for a different appearance. + attr_accessor :hide_dots, :hide_lines + + # Call with target pixel width of graph (800, 400, 300), and/or 'false' to omit lines (points only). + # + # g = Gruff::Line.new(400) # 400px wide with lines + # + # g = Gruff::Line.new(400, false) # 400px wide, no lines (for backwards compatibility) + # + # g = Gruff::Line.new(false) # Defaults to 800px wide, no lines (for backwards compatibility) + # + # The preferred way is to call hide_dots or hide_lines instead. + def initialize(*args) + raise ArgumentError, "Wrong number of arguments" if args.length > 2 + if args.empty? or ((not Numeric === args.first) && (not String === args.first)) then + super() + else + super args.shift + end + + @hide_dots = @hide_lines = false + @baseline_color = 'red' + @baseline_value = nil + end + + def draw + super + + return unless @has_data + + # Check to see if more than one datapoint was given. NaN can result otherwise. + @x_increment = (@column_count > 1) ? (@graph_width / (@column_count - 1).to_f) : @graph_width + + if (defined?(@norm_baseline)) then + level = @graph_top + (@graph_height - @norm_baseline * @graph_height) + @d = @d.push + @d.stroke_color @baseline_color + @d.fill_opacity 0.0 + @d.stroke_dasharray(10, 20) + @d.stroke_width 5 + @d.line(@graph_left, level, @graph_left + @graph_width, level) + @d = @d.pop + end + + @norm_data.each do |data_row| + prev_x = prev_y = nil + + @one_point = contains_one_point_only?(data_row) + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index| + new_x = @graph_left + (@x_increment * index) + next if data_point.nil? + + draw_label(new_x, index) + + new_y = @graph_top + (@graph_height - data_point * @graph_height) + + # Reset each time to avoid thin-line errors + @d = @d.stroke data_row[DATA_COLOR_INDEX] + @d = @d.fill data_row[DATA_COLOR_INDEX] + @d = @d.stroke_opacity 1.0 + @d = @d.stroke_width line_width || + clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 4), 5.0) + + + circle_radius = dot_radius || + clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 2.5), 5.0) + + if !@hide_lines and !prev_x.nil? and !prev_y.nil? then + @d = @d.line(prev_x, prev_y, new_x, new_y) + elsif @one_point + # Show a circle if there's just one_point + @d = @d.circle(new_x, new_y, new_x - circle_radius, new_y) + end + @d = @d.circle(new_x, new_y, new_x - circle_radius, new_y) unless @hide_dots + + prev_x = new_x + prev_y = new_y + end + + end + + @d.draw(@base_image) + end + + def normalize + @maximum_value = [@maximum_value.to_f, @baseline_value.to_f].max + super + @norm_baseline = (@baseline_value.to_f / @maximum_value.to_f) if @baseline_value + end + + def contains_one_point_only?(data_row) + # Spin through data to determine if there is just one_value present. + one_point = false + data_row[DATA_VALUES_INDEX].each do |data_point| + if !data_point.nil? + if one_point + # more than one point, bail + return false + else + # there is at least one data point + return true + end + end + end + return one_point + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/mini/bar.rb b/vendor/gruff-0.3.6/lib/gruff/mini/bar.rb new file mode 100644 index 0000000..5ee4124 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/mini/bar.rb @@ -0,0 +1,37 @@ +## +# +# Makes a small bar graph suitable for display at 200px or even smaller. +# +module Gruff + module Mini + + class Bar < Gruff::Bar + + include Gruff::Mini::Legend + + def initialize_ivars + super + + @hide_legend = true + @hide_title = true + @hide_line_numbers = true + + @marker_font_size = 50.0 + @minimum_value = 0.0 + @maximum_value = 0.0 + @legend_font_size = 60.0 + end + + def draw + expand_canvas_for_vertical_legend + + super + + draw_vertical_legend + @d.draw(@base_image) + end + + end + + end +end diff --git a/vendor/gruff-0.3.6/lib/gruff/mini/legend.rb b/vendor/gruff-0.3.6/lib/gruff/mini/legend.rb new file mode 100644 index 0000000..b869cb1 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/mini/legend.rb @@ -0,0 +1,82 @@ +module Gruff + module Mini + module Legend + + attr_accessor :hide_mini_legend + + ## + # The canvas needs to be bigger so we can put the legend beneath it. + + def expand_canvas_for_vertical_legend + return if @hide_mini_legend + + @original_rows = @raw_rows + @rows += @data.length * calculate_caps_height(scale_fontsize(@legend_font_size)) * 1.7 + render_background + end + + ## + # Draw the legend beneath the existing graph. + + def draw_vertical_legend + return if @hide_mini_legend + + @legend_labels = @data.collect {|item| item[Gruff::Base::DATA_LABEL_INDEX] } + + legend_square_width = 40.0 # small square with color of this item + legend_square_margin = 10.0 + @legend_left_margin = 100.0 + legend_top_margin = 40.0 + + # May fix legend drawing problem at small sizes + @d.font = @font if @font + @d.pointsize = @legend_font_size + + current_x_offset = @legend_left_margin + current_y_offset = @original_rows + legend_top_margin + + debug { @d.line 0.0, current_y_offset, @raw_columns, current_y_offset } + + @legend_labels.each_with_index do |legend_label, index| + + # Draw label + @d.fill = @font_color + @d.font = @font if @font + @d.pointsize = scale_fontsize(@legend_font_size) + @d.stroke = 'transparent' + @d.font_weight = Magick::NormalWeight + @d.gravity = Magick::WestGravity + @d = @d.annotate_scaled( @base_image, + @raw_columns, 1.0, + current_x_offset + (legend_square_width * 1.7), current_y_offset, + truncate_legend_label(legend_label), @scale) + + # Now draw box with color of this dataset + @d = @d.stroke 'transparent' + @d = @d.fill @data[index][Gruff::Base::DATA_COLOR_INDEX] + @d = @d.rectangle(current_x_offset, + current_y_offset - legend_square_width / 2.0, + current_x_offset + legend_square_width, + current_y_offset + legend_square_width / 2.0) + + current_y_offset += calculate_caps_height(@legend_font_size) * 1.7 + end + @color_index = 0 + end + + ## + # Shorten long labels so they will fit on the canvas. + # + # Department of Hu... + + def truncate_legend_label(label) + truncated_label = label.to_s + while calculate_width(scale_fontsize(@legend_font_size), truncated_label) > (@columns - @legend_left_margin - @right_margin) && (truncated_label.length > 1) + truncated_label = truncated_label[0..truncated_label.length-2] + end + truncated_label + (truncated_label.length < label.to_s.length ? "..." : '') + end + + end + end +end diff --git a/vendor/gruff-0.3.6/lib/gruff/mini/pie.rb b/vendor/gruff-0.3.6/lib/gruff/mini/pie.rb new file mode 100644 index 0000000..7822ba5 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/mini/pie.rb @@ -0,0 +1,36 @@ +## +# +# Makes a small pie graph suitable for display at 200px or even smaller. +# +module Gruff + module Mini + + class Pie < Gruff::Pie + + include Gruff::Mini::Legend + + def initialize_ivars + super + + @hide_legend = true + @hide_title = true + @hide_line_numbers = true + + @marker_font_size = 60.0 + @legend_font_size = 60.0 + end + + def draw + expand_canvas_for_vertical_legend + + super + + draw_vertical_legend + + @d.draw(@base_image) + end # def draw + + end # class Pie + + end +end diff --git a/vendor/gruff-0.3.6/lib/gruff/mini/side_bar.rb b/vendor/gruff-0.3.6/lib/gruff/mini/side_bar.rb new file mode 100644 index 0000000..46be4f4 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/mini/side_bar.rb @@ -0,0 +1,35 @@ +## +# +# Makes a small pie graph suitable for display at 200px or even smaller. +# +module Gruff + module Mini + + class SideBar < Gruff::SideBar + + include Gruff::Mini::Legend + + def initialize_ivars + super + @hide_legend = true + @hide_title = true + @hide_line_numbers = true + + @marker_font_size = 50.0 + @legend_font_size = 50.0 + end + + def draw + expand_canvas_for_vertical_legend + + super + + draw_vertical_legend + + @d.draw(@base_image) + end + + end + + end +end diff --git a/vendor/gruff-0.3.6/lib/gruff/net.rb b/vendor/gruff-0.3.6/lib/gruff/net.rb new file mode 100644 index 0000000..67c7e95 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/net.rb @@ -0,0 +1,140 @@ + +require File.dirname(__FILE__) + '/base' + +# Experimental!!! See also the Spider graph. +class Gruff::Net < Gruff::Base + + # Hide parts of the graph to fit more datapoints, or for a different appearance. + attr_accessor :hide_dots + + # Dimensions of lines and dots; calculated based on dataset size if left unspecified + attr_accessor :line_width + attr_accessor :dot_radius + + def initialize(*args) + super + + @hide_dots = false + @hide_line_numbers = true + end + + def draw + + super + + return unless @has_data + + @radius = @graph_height / 2.0 + @center_x = @graph_left + (@graph_width / 2.0) + @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit + + @x_increment = @graph_width / (@column_count - 1).to_f + circle_radius = dot_radius || + clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 2.5), 5.0) + + @d = @d.stroke_opacity 1.0 + @d = @d.stroke_width line_width || + clip_value_if_greater_than(@columns / (@norm_data.first[DATA_VALUES_INDEX].size * 4), 5.0) + + if (defined?(@norm_baseline)) then + level = @graph_top + (@graph_height - @norm_baseline * @graph_height) + @d = @d.push + @d.stroke_color @baseline_color + @d.fill_opacity 0.0 + @d.stroke_dasharray(10, 20) + @d.stroke_width 5 + @d.line(@graph_left, level, @graph_left + @graph_width, level) + @d = @d.pop + end + + @norm_data.each do |data_row| + prev_x = prev_y = nil + @d = @d.stroke data_row[DATA_COLOR_INDEX] + @d = @d.fill data_row[DATA_COLOR_INDEX] + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index| + next if data_point.nil? + + rad_pos = index * Math::PI * 2 / @column_count + point_distance = data_point * @radius + start_x = @center_x + Math::sin(rad_pos) * point_distance + start_y = @center_y - Math::cos(rad_pos) * point_distance + + next_index = index + 1 < data_row[DATA_VALUES_INDEX].length ? index + 1 : 0 + + next_rad_pos = next_index * Math::PI * 2 / @column_count + next_point_distance = data_row[DATA_VALUES_INDEX][next_index] * @radius + end_x = @center_x + Math::sin(next_rad_pos) * next_point_distance + end_y = @center_y - Math::cos(next_rad_pos) * next_point_distance + + @d = @d.line(start_x, start_y, end_x, end_y) + + @d = @d.circle(start_x, start_y, start_x - circle_radius, start_y) unless @hide_dots + end + + end + + @d.draw(@base_image) + end + + + # the lines connecting in the center, with the first line vertical + def draw_line_markers + return if @hide_line_markers + + + # have to do this here (AGAIN)... see draw() in this class + # because this funtion is called before the @radius, @center_x and @center_y are set + @radius = @graph_height / 2.0 + @center_x = @graph_left + (@graph_width / 2.0) + @center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit + + + # Draw horizontal line markers and annotate with numbers + @d = @d.stroke(@marker_color) + @d = @d.stroke_width 1 + + + (0..@column_count-1).each do |index| + rad_pos = index * Math::PI * 2 / @column_count + + @d = @d.line(@center_x, @center_y, @center_x + Math::sin(rad_pos) * @radius, @center_y - Math::cos(rad_pos) * @radius) + + + marker_label = labels[index] ? labels[index].to_s : '000' + + draw_label(@center_x, @center_y, rad_pos * 360 / (2 * Math::PI), @radius, marker_label) + end + end + +private + + def draw_label(center_x, center_y, angle, radius, amount) + r_offset = 1.1 + x_offset = center_x # + 15 # The label points need to be tweaked slightly + y_offset = center_y # + 0 # This one doesn't though + x = x_offset + (radius * r_offset * Math.sin(angle.deg2rad)) + y = y_offset - (radius * r_offset * Math.cos(angle.deg2rad)) + + # Draw label + @d.fill = @marker_color + @d.font = @font if @font + @d.pointsize = scale_fontsize(20) + @d.stroke = 'transparent' + @d.font_weight = BoldWeight + @d.gravity = CenterGravity + @d.annotate_scaled(@base_image, 0, 0, x, y, amount, @scale) + end + +end + +# # This method is already in Float +# class Float +# # Used for degree => radian conversions +# def deg2rad +# self * (Math::PI/180.0) +# end +# end + + + diff --git a/vendor/gruff-0.3.6/lib/gruff/photo_bar.rb b/vendor/gruff-0.3.6/lib/gruff/photo_bar.rb new file mode 100644 index 0000000..d10191e --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/photo_bar.rb @@ -0,0 +1,100 @@ +require File.dirname(__FILE__) + '/base' + +# EXPERIMENTAL! +# +# Doesn't work yet. +# +class Gruff::PhotoBar < Gruff::Base + +# TODO +# +# define base and cap in yml +# allow for image directory to be located elsewhere +# more exact measurements for bar heights (go all the way to the bottom of the graph) +# option to tile images instead of use a single image +# drop base label a few px lower so photo bar graphs can have a base dropping over the lower marker line +# + + # The name of a pre-packaged photo-based theme. + attr_reader :theme + +# def initialize(target_width=800) +# super +# init_photo_bar_graphics() +# end + + def draw + super + return unless @has_data + + return # TODO Remove for further development + + init_photo_bar_graphics() + + #Draw#define_clip_path() + #Draw#clip_path(pathname) + #Draw#composite....with bar graph image OverCompositeOp + # + # See also + # + # Draw.pattern # define an image to tile as the filling of a draw object + # + + # Setup spacing. + # + # Columns sit side-by-side. + spacing_factor = 0.9 + @bar_width = @norm_data[0][DATA_COLOR_INDEX].columns + + @norm_data.each_with_index do |data_row, row_index| + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + data_point = 0 if data_point.nil? + # Use incremented x and scaled y + left_x = @graph_left + (@bar_width * (row_index + point_index + ((@data.length - 1) * point_index))) + left_y = @graph_top + (@graph_height - data_point * @graph_height) + 1 + right_x = left_x + @bar_width * spacing_factor + right_y = @graph_top + @graph_height - 1 + + bar_image_width = data_row[DATA_COLOR_INDEX].columns + bar_image_height = right_y.to_f - left_y.to_f + + # Crop to scale for data + bar_image = data_row[DATA_COLOR_INDEX].crop(0, 0, bar_image_width, bar_image_height) + + @d.gravity = NorthWestGravity + @d = @d.composite(left_x, left_y, bar_image_width, bar_image_height, bar_image) + + # Calculate center based on bar_width and current row + label_center = @graph_left + (@data.length * @bar_width * point_index) + (@data.length * @bar_width / 2.0) + draw_label(label_center, point_index) + end + + end + + @d.draw(@base_image) + end + + + # Return the chosen theme or the default + def theme + @theme || 'plastik' + end + +protected + + # Sets up colors with a list of images that will be used. + # Images should be 340px tall + def init_photo_bar_graphics + color_list = Array.new + theme_dir = File.dirname(__FILE__) + '/../../assets/' + theme + + Dir.open(theme_dir).each do |file| + next unless /\.png$/.match(file) + color_list << Image.read("#{theme_dir}/#{file}").first + end + @colors = color_list + end + +end + diff --git a/vendor/gruff-0.3.6/lib/gruff/pie.rb b/vendor/gruff-0.3.6/lib/gruff/pie.rb new file mode 100644 index 0000000..c3f6ca1 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/pie.rb @@ -0,0 +1,124 @@ +require File.dirname(__FILE__) + '/base' + +## +# Here's how to make a Pie graph: +# +# g = Gruff::Pie.new +# g.title = "Visual Pie Graph Test" +# g.data 'Fries', 20 +# g.data 'Hamburgers', 50 +# g.write("test/output/pie_keynote.png") +# +# To control where the pie chart starts creating slices, use #zero_degree. + +class Gruff::Pie < Gruff::Base + + TEXT_OFFSET_PERCENTAGE = 0.15 + + # Can be used to make the pie start cutting slices at the top (-90.0) + # or at another angle. Default is 0.0, which starts at 3 o'clock. + attr_accessor :zero_degree + + def initialize_ivars + super + @zero_degree = 0.0 + end + + def draw + @hide_line_markers = true + + super + + return unless @has_data + + diameter = @graph_height + radius = ([@graph_width, @graph_height].min / 2.0) * 0.8 + top_x = @graph_left + (@graph_width - diameter) / 2.0 + center_x = @graph_left + (@graph_width / 2.0) + center_y = @graph_top + (@graph_height / 2.0) - 10 # Move graph up a bit + total_sum = sums_for_pie() + prev_degrees = @zero_degree + + # Use full data since we can easily calculate percentages + data = (@sort ? @data.sort{ |a, b| a[DATA_VALUES_INDEX].first <=> b[DATA_VALUES_INDEX].first } : @data) + data.each do |data_row| + if data_row[DATA_VALUES_INDEX].first > 0 + @d = @d.stroke data_row[DATA_COLOR_INDEX] + @d = @d.fill 'transparent' + @d.stroke_width(radius) # stroke width should be equal to radius. we'll draw centered on (radius / 2) + + current_degrees = (data_row[DATA_VALUES_INDEX].first / total_sum) * 360.0 + + # ellipse will draw the the stroke centered on the first two parameters offset by the second two. + # therefore, in order to draw a circle of the proper diameter we must center the stroke at + # half the radius for both x and y + @d = @d.ellipse(center_x, center_y, + radius / 2.0, radius / 2.0, + prev_degrees, prev_degrees + current_degrees + 0.5) # <= +0.5 'fudge factor' gets rid of the ugly gaps + + half_angle = prev_degrees + ((prev_degrees + current_degrees) - prev_degrees) / 2 + + # Following line is commented to allow display of the percentiles + # bug appeared between r90 and r92 + # unless @hide_line_markers then + # End the string with %% to escape the single %. + # RMagick must use sprintf with the string and % has special significance. + label_string = ((data_row[DATA_VALUES_INDEX].first / total_sum) * + 100.0).round.to_s + '%%' + @d = draw_label(center_x,center_y, half_angle, + radius + (radius * TEXT_OFFSET_PERCENTAGE), + label_string) + # end + + prev_degrees += current_degrees + end + end + + # TODO debug a circle where the text is drawn... + + @d.draw(@base_image) + end + +private + + ## + # Labels are drawn around a slightly wider ellipse to give room for + # labels on the left and right. + def draw_label(center_x, center_y, angle, radius, amount) + # TODO Don't use so many hard-coded numbers + r_offset = 20.0 # The distance out from the center of the pie to get point + x_offset = center_x # + 15.0 # The label points need to be tweaked slightly + y_offset = center_y # This one doesn't though + radius_offset = (radius + r_offset) + ellipse_factor = radius_offset * 0.15 + x = x_offset + ((radius_offset + ellipse_factor) * Math.cos(angle.deg2rad)) + y = y_offset + (radius_offset * Math.sin(angle.deg2rad)) + + # Draw label + @d.fill = @font_color + @d.font = @font if @font + @d.pointsize = scale_fontsize(@marker_font_size) + @d.stroke = 'transparent' + @d.font_weight = BoldWeight + @d.gravity = CenterGravity + @d.annotate_scaled( @base_image, + 0, 0, + x, y, + amount, @scale) + end + + def sums_for_pie + total_sum = 0.0 + @data.collect {|data_row| total_sum += data_row[DATA_VALUES_INDEX].first } + total_sum + end + +end + +class Float + # Used for degree => radian conversions + def deg2rad + self * (Math::PI/180.0) + end +end + diff --git a/vendor/gruff-0.3.6/lib/gruff/scene.rb b/vendor/gruff-0.3.6/lib/gruff/scene.rb new file mode 100644 index 0000000..47943db --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/scene.rb @@ -0,0 +1,209 @@ + +require "observer" +require File.dirname(__FILE__) + '/base' + +## +# A scene is a non-linear graph that assembles layers together to tell a story. +# Layers are folders with appropriately named files (see below). You can group +# layers and control them together or just set their values individually. +# +# Examples: +# +# * A city scene that changes with the time of day and the weather conditions. +# * A traffic map that shows red lines on streets that are crowded and green on free-flowing ones. +# +# Usage: +# +# g = Gruff::Scene.new("500x100", "path/to/city_scene_directory") +# +# # Define order of layers, back to front +# g.layers = %w(background haze sky clouds) +# +# # Define groups that will be controlled by the same input +# g.weather_group = %w(clouds) +# g.time_group = %w(background sky) +# +# # Set values for the layers or groups +# g.weather = "cloudy" +# g.time = Time.now +# g.haze = true +# +# # Write the final graph to disk +# g.write "hazy_daytime_city_scene.png" +# +# +# There are several rules that will magically select a layer when possible. +# +# * Numbered files will be selected according to the closest value that is less than the input value. +# * 'true.png' and 'false.png' will be used as booleans. +# * Other named files will be used if the input matches the filename (without the filetype extension). +# * If there is a file named 'default.png', it will be used unless other input values are set for the corresponding layer. + +class Gruff::Scene < Gruff::Base + + # An array listing the foldernames that will be rendered, from back to front. + # + # g.layers = %w(sky clouds buildings street people) + # + attr_reader :layers + + def initialize(target_width, base_dir) + @base_dir = base_dir + @groups = {} + @layers = [] + super target_width + end + + def draw + # Join all the custom paths and filter out the empty ones + image_paths = @layers.map { |layer| layer.path }.select { |path| !path.empty? } + images = Magick::ImageList.new(*image_paths) + @base_image = images.flatten_images + end + + def layers=(ordered_list) + ordered_list.each do |layer_name| + @layers << Gruff::Layer.new(@base_dir, layer_name) + end + end + + # Group layers to input values + # + # g.weather_group = ["sky", "sea", "clouds"] + # + # Set input values + # + # g.weather = "cloudy" + # + def method_missing(method_name, *args) + case method_name.to_s + when /^(\w+)_group=$/ + add_group $1, *args + return + when /^(\w+)=$/ + set_input $1, args.first + return + end + super + end + +private + + def add_group(input_name, layer_names) + @groups[input_name] = Gruff::Group.new(input_name, @layers.select { |layer| layer_names.include?(layer.name) }) + end + + def set_input(input_name, input_value) + if not @groups[input_name].nil? + @groups[input_name].send_updates(input_value) + else + if chosen_layer = @layers.detect { |layer| layer.name == input_name } + chosen_layer.update input_value + end + end + end + +end + + +class Gruff::Group + + include Observable + attr_reader :name + + def initialize(folder_name, layers) + @name = folder_name + layers.each do |layer| + layer.observe self + end + end + + def send_updates(value) + changed + notify_observers value + end + +end + + +class Gruff::Layer + + attr_reader :name + + def initialize(base_dir, folder_name) + @base_dir = base_dir.to_s + @name = folder_name.to_s + @filenames = Dir.open(File.join(base_dir, folder_name)).entries.select { |file| file =~ /^[^.]+\.png$/ } + @selected_filename = select_default + end + + # Register this layer so it receives updates from the group + def observe(obj) + obj.add_observer self + end + + # Choose the appropriate filename for this layer, based on the input + def update(value) + @selected_filename = case value.to_s + when /^(true|false)$/ + select_boolean value + when /^(\w|\s)+$/ + select_string value + when /^-?(\d+\.)?\d+$/ + select_numeric value + when /(\d\d):(\d\d):\d\d/ + select_time "#{$1}#{$2}" + else + select_default + end + # Finally, try to use 'default' if we're still blank + @selected_filename ||= select_default + end + + # Returns the full path to the selected image, or a blank string + def path + unless @selected_filename.nil? || @selected_filename.empty? + return File.join(@base_dir, @name, @selected_filename) + end + '' + end + +private + + # Match "true.png" or "false.png" + def select_boolean(value) + file_exists_or_blank value.to_s + end + + # Match -5 to _5.png + def select_numeric(value) + file_exists_or_blank value.to_s.gsub('-', '_') + end + + def select_time(value) + times = @filenames.map { |filename| filename.gsub('.png', '') } + times.each_with_index do |time, index| + if (time > value) && (index > 0) + return "#{times[index - 1]}.png" + end + end + return "#{times.last}.png" + end + + # Match "partly cloudy" to "partly_cloudy.png" + def select_string(value) + file_exists_or_blank value.to_s.gsub(' ', '_') + end + + def select_default + @filenames.include?("default.png") ? "default.png" : '' + end + + # Returns the string "#{filename}.png", if it exists. + # + # Failing that, it returns default.png, or '' if that doesn't exist. + def file_exists_or_blank(filename) + @filenames.include?("#{filename}.png") ? "#{filename}.png" : select_default + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/side_bar.rb b/vendor/gruff-0.3.6/lib/gruff/side_bar.rb new file mode 100644 index 0000000..282c2c9 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/side_bar.rb @@ -0,0 +1,115 @@ +require File.dirname(__FILE__) + '/base' + +## +# Graph with individual horizontal bars instead of vertical bars. + +class Gruff::SideBar < Gruff::Base + + def draw + @has_left_labels = true + super + + return unless @has_data + + # Setup spacing. + # + @bar_spacing ||= 0.9 + + @bars_width = @graph_height / @column_count.to_f + @bar_width = @bars_width * @bar_spacing / @norm_data.size + @d = @d.stroke_opacity 0.0 + height = Array.new(@column_count, 0) + length = Array.new(@column_count, @graph_left) + padding = (@bars_width * (1 - @bar_spacing)) / 2 + + @norm_data.each_with_index do |data_row, row_index| + @d = @d.fill data_row[DATA_COLOR_INDEX] + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + + # Using the original calcs from the stacked bar chart + # to get the difference between + # part of the bart chart we wish to stack. + temp1 = @graph_left + (@graph_width - data_point * @graph_width - height[point_index]) + temp2 = @graph_left + @graph_width - height[point_index] + difference = temp2 - temp1 + + left_x = length[point_index] - 1 + left_y = @graph_top + (@bars_width * point_index) + (@bar_width * row_index) + padding + right_x = left_x + difference + right_y = left_y + @bar_width + + height[point_index] += (data_point * @graph_width) + + @d = @d.rectangle(left_x, left_y, right_x, right_y) + + # Calculate center based on bar_width and current row + label_center = @graph_top + (@bars_width * point_index + @bars_width / 2) + draw_label(label_center, point_index) + end + + end + + @d.draw(@base_image) + end + +protected + + # Instead of base class version, draws vertical background lines and label + def draw_line_markers + + return if @hide_line_markers + + @d = @d.stroke_antialias false + + # Draw horizontal line markers and annotate with numbers + @d = @d.stroke(@marker_color) + @d = @d.stroke_width 1 + number_of_lines = 5 + + # TODO Round maximum marker value to a round number like 100, 0.1, 0.5, etc. + increment = significant(@maximum_value.to_f / number_of_lines) + (0..number_of_lines).each do |index| + + line_diff = (@graph_right - @graph_left) / number_of_lines + x = @graph_right - (line_diff * index) - 1 + @d = @d.line(x, @graph_bottom, x, @graph_top) + diff = index - number_of_lines + marker_label = diff.abs * increment + + unless @hide_line_numbers + @d.fill = @font_color + @d.font = @font if @font + @d.stroke = 'transparent' + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = CenterGravity + # TODO Center text over line + @d = @d.annotate_scaled( @base_image, + 0, 0, # Width of box to draw text in + x, @graph_bottom + (LABEL_MARGIN * 2.0), # Coordinates of text + marker_label.to_s, @scale) + end # unless + @d = @d.stroke_antialias true + end + end + + ## + # Draw on the Y axis instead of the X + + def draw_label(y_offset, index) + if !@labels[index].nil? && @labels_seen[index].nil? + @d.fill = @font_color + @d.font = @font if @font + @d.stroke = 'transparent' + @d.font_weight = NormalWeight + @d.pointsize = scale_fontsize(@marker_font_size) + @d.gravity = EastGravity + @d = @d.annotate_scaled(@base_image, + 1, 1, + -@graph_left + LABEL_MARGIN * 2.0, y_offset, + @labels[index], @scale) + @labels_seen[index] = 1 + end + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/side_stacked_bar.rb b/vendor/gruff-0.3.6/lib/gruff/side_stacked_bar.rb new file mode 100644 index 0000000..7806bd5 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/side_stacked_bar.rb @@ -0,0 +1,74 @@ +require File.dirname(__FILE__) + '/base' +require File.dirname(__FILE__) + '/side_bar' +require File.dirname(__FILE__) + '/stacked_mixin' + +## +# New gruff graph type added to enable sideways stacking bar charts +# (basically looks like a x/y flip of a standard stacking bar chart) +# +# alun.eyre@googlemail.com + +class Gruff::SideStackedBar < Gruff::SideBar + include StackedMixin + + def draw + @has_left_labels = true + get_maximum_by_stack + super + + return unless @has_data + + # Setup spacing. + # + # Columns sit stacked. + @bar_spacing ||= 0.9 + + @bar_width = @graph_height / @column_count.to_f + @d = @d.stroke_opacity 0.0 + height = Array.new(@column_count, 0) + length = Array.new(@column_count, @graph_left) + padding = (@bar_width * (1 - @bar_spacing)) / 2 + + @norm_data.each_with_index do |data_row, row_index| + @d = @d.fill data_row[DATA_COLOR_INDEX] + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + + ## using the original calcs from the stacked bar chart to get the difference between + ## part of the bart chart we wish to stack. + temp1 = @graph_left + (@graph_width - + data_point * @graph_width - + height[point_index]) + 1 + temp2 = @graph_left + @graph_width - height[point_index] - 1 + difference = temp2 - temp1 + + left_x = length[point_index] #+ 1 + left_y = @graph_top + (@bar_width * point_index) + padding + right_x = left_x + difference + right_y = left_y + @bar_width * @bar_spacing + length[point_index] += difference + height[point_index] += (data_point * @graph_width - 2) + + @d = @d.rectangle(left_x, left_y, right_x, right_y) + + # Calculate center based on bar_width and current row + label_center = @graph_top + (@bar_width * point_index) + (@bar_width * @bar_spacing / 2.0) + draw_label(label_center, point_index) + end + + end + + @d.draw(@base_image) + end + + protected + + def larger_than_max?(data_point, index=0) + max(data_point, index) > @maximum_value + end + + def max(data_point, index) + @data.inject(0) {|sum, item| sum + item[DATA_VALUES_INDEX][index]} + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/spider.rb b/vendor/gruff-0.3.6/lib/gruff/spider.rb new file mode 100644 index 0000000..bdba940 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/spider.rb @@ -0,0 +1,130 @@ + +require File.dirname(__FILE__) + '/base' + +# Experimental!!! See also the Net graph. +# +# Submitted by Kevin Clark http://glu.ttono.us/ +class Gruff::Spider < Gruff::Base + + # Hide all text + attr_reader :hide_text + attr_accessor :hide_axes + attr_reader :transparent_background + + def transparent_background=(value) + @transparent_background = value + @base_image = render_transparent_background if value + end + + def hide_text=(value) + @hide_title = @hide_text = value + end + + def initialize(max_value, target_width = 800) + super(target_width) + @max_value = max_value + @hide_legend = true; + end + + def draw + @hide_line_markers = true + + super + + return unless @has_data + + # Setup basic positioning + diameter = @graph_height + radius = @graph_height / 2.0 + top_x = @graph_left + (@graph_width - diameter) / 2.0 + center_x = @graph_left + (@graph_width / 2.0) + center_y = @graph_top + (@graph_height / 2.0) - 25 # Move graph up a bit + + @unit_length = radius / @max_value + + + total_sum = sums_for_spider + prev_degrees = 0.0 + additive_angle = (2 * Math::PI)/ @data.size + + current_angle = 0.0 + + # Draw axes + draw_axes(center_x, center_y, radius, additive_angle) unless hide_axes + + # Draw polygon + draw_polygon(center_x, center_y, additive_angle) + + + @d.draw(@base_image) + end + +private + + def normalize_points(value) + value * @unit_length + end + + def draw_label(center_x, center_y, angle, radius, amount) + r_offset = 50 # The distance out from the center of the pie to get point + x_offset = center_x # The label points need to be tweaked slightly + y_offset = center_y + 0 # This one doesn't though + x = x_offset + ((radius + r_offset) * Math.cos(angle)) + y = y_offset + ((radius + r_offset) * Math.sin(angle)) + + # Draw label + @d.fill = @marker_color + @d.font = @font if @font + @d.pointsize = scale_fontsize(legend_font_size) + @d.stroke = 'transparent' + @d.font_weight = BoldWeight + @d.gravity = CenterGravity + @d.annotate_scaled( @base_image, + 0, 0, + x, y, + amount, @scale) + end + + def draw_axes(center_x, center_y, radius, additive_angle, line_color = nil) + return if hide_axes + + current_angle = 0.0 + + @data.each do |data_row| + @d.stroke(line_color || data_row[DATA_COLOR_INDEX]) + @d.stroke_width 5.0 + + x_offset = radius * Math.cos(current_angle) + y_offset = radius * Math.sin(current_angle) + + @d.line(center_x, center_y, + center_x + x_offset, + center_y + y_offset) + + draw_label(center_x, center_y, current_angle, radius, data_row[DATA_LABEL_INDEX].to_s) unless hide_text + + current_angle += additive_angle + end + end + + def draw_polygon(center_x, center_y, additive_angle, color = nil) + points = [] + current_angle = 0.0 + @data.each do |data_row| + points << center_x + normalize_points(data_row[DATA_VALUES_INDEX].first) * Math.cos(current_angle) + points << center_y + normalize_points(data_row[DATA_VALUES_INDEX].first) * Math.sin(current_angle) + current_angle += additive_angle + end + + @d.stroke_width 1.0 + @d.stroke(color || @marker_color) + @d.fill(color || @marker_color) + @d.fill_opacity 0.4 + @d.polygon(*points) + end + + def sums_for_spider + @data.inject(0.0) {|sum, data_row| sum += data_row[DATA_VALUES_INDEX].first} + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/stacked_area.rb b/vendor/gruff-0.3.6/lib/gruff/stacked_area.rb new file mode 100644 index 0000000..e54c4c4 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/stacked_area.rb @@ -0,0 +1,67 @@ + +require File.dirname(__FILE__) + '/base' +require File.dirname(__FILE__) + '/stacked_mixin' + +class Gruff::StackedArea < Gruff::Base + include StackedMixin + attr_accessor :last_series_goes_on_bottom + + def draw + get_maximum_by_stack + super + + return unless @has_data + + @x_increment = @graph_width / (@column_count - 1).to_f + @d = @d.stroke 'transparent' + + height = Array.new(@column_count, 0) + + data_points = nil + iterator = last_series_goes_on_bottom ? :reverse_each : :each + @norm_data.send(iterator) do |data_row| + prev_data_points = data_points + data_points = Array.new + + @d = @d.fill data_row[DATA_COLOR_INDEX] + + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index| + # Use incremented x and scaled y + new_x = @graph_left + (@x_increment * index) + new_y = @graph_top + (@graph_height - data_point * @graph_height - height[index]) + + height[index] += (data_point * @graph_height) + + data_points << new_x + data_points << new_y + + draw_label(new_x, index) + + end + + if prev_data_points + poly_points = data_points.dup + (prev_data_points.length/2 - 1).downto(0) do |i| + poly_points << prev_data_points[2*i] + poly_points << prev_data_points[2*i+1] + end + poly_points << data_points[0] + poly_points << data_points[1] + else + poly_points = data_points.dup + poly_points << @graph_right + poly_points << @graph_bottom - 1 + poly_points << @graph_left + poly_points << @graph_bottom - 1 + poly_points << data_points[0] + poly_points << data_points[1] + end + @d = @d.polyline(*poly_points) + + end + + @d.draw(@base_image) + end + + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/stacked_bar.rb b/vendor/gruff-0.3.6/lib/gruff/stacked_bar.rb new file mode 100644 index 0000000..53102c1 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/stacked_bar.rb @@ -0,0 +1,54 @@ + +require File.dirname(__FILE__) + '/base' +require File.dirname(__FILE__) + '/stacked_mixin' + +class Gruff::StackedBar < Gruff::Base + include StackedMixin + + # Draws a bar graph, but multiple sets are stacked on top of each other. + def draw + get_maximum_by_stack + super + return unless @has_data + + # Setup spacing. + # + # Columns sit stacked. + @bar_spacing ||= 0.9 + @bar_width = @graph_width / @column_count.to_f + padding = (@bar_width * (1 - @bar_spacing)) / 2 + + @d = @d.stroke_opacity 0.0 + + height = Array.new(@column_count, 0) + + @norm_data.each_with_index do |data_row, row_index| + data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index| + @d = @d.fill data_row[DATA_COLOR_INDEX] + + # Calculate center based on bar_width and current row + label_center = @graph_left + (@bar_width * point_index) + (@bar_width * @bar_spacing / 2.0) + draw_label(label_center, point_index) + + next if (data_point == 0) + # Use incremented x and scaled y + left_x = @graph_left + (@bar_width * point_index) + padding + left_y = @graph_top + (@graph_height - + data_point * @graph_height - + height[point_index]) + 1 + right_x = left_x + @bar_width * @bar_spacing + right_y = @graph_top + @graph_height - height[point_index] - 1 + + # update the total height of the current stacked bar + height[point_index] += (data_point * @graph_height ) + + @d = @d.rectangle(left_x, left_y, right_x, right_y) + + end + + end + + @d.draw(@base_image) + end + +end diff --git a/vendor/gruff-0.3.6/lib/gruff/stacked_mixin.rb b/vendor/gruff-0.3.6/lib/gruff/stacked_mixin.rb new file mode 100644 index 0000000..845fe28 --- /dev/null +++ b/vendor/gruff-0.3.6/lib/gruff/stacked_mixin.rb @@ -0,0 +1,23 @@ + +module Gruff::Base::StackedMixin + # Used by StackedBar and child classes. + # + # tsal: moved from Base 03 FEB 2007 + DATA_VALUES_INDEX = Gruff::Base::DATA_VALUES_INDEX + def get_maximum_by_stack + # Get sum of each stack + max_hash = {} + @data.each do |data_set| + data_set[DATA_VALUES_INDEX].each_with_index do |data_point, i| + max_hash[i] = 0.0 unless max_hash[i] + max_hash[i] += data_point.to_f + end + end + + # @maximum_value = 0 + max_hash.keys.each do |key| + @maximum_value = max_hash[key] if max_hash[key] > @maximum_value + end + @minimum_value = 0 + end +end diff --git a/vendor/gruff-0.3.6/rails_generators/gruff/gruff_generator.rb b/vendor/gruff-0.3.6/rails_generators/gruff/gruff_generator.rb new file mode 100644 index 0000000..337f58e --- /dev/null +++ b/vendor/gruff-0.3.6/rails_generators/gruff/gruff_generator.rb @@ -0,0 +1,63 @@ +class GruffGenerator < Rails::Generator::NamedBase + + attr_reader :controller_name, + :controller_class_path, + :controller_file_path, + :controller_class_nesting, + :controller_class_nesting_depth, + :controller_class_name, + :controller_singular_name, + :controller_plural_name, + :parent_folder_for_require + alias_method :controller_file_name, :controller_singular_name + alias_method :controller_table_name, :controller_plural_name + + def initialize(runtime_args, runtime_options = {}) + super + + # Take controller name from the next argument. + @controller_name = runtime_args.shift + + base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name) + @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name) + + if @controller_class_nesting.empty? + @controller_class_name = @controller_class_name_without_nesting + else + @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}" + end + end + + def manifest + record do |m| + # Check for class naming collisions. + m.class_collisions controller_class_path, "#{controller_class_name}Controller", + "#{controller_class_name}ControllerTest" + + # Controller, helper, views, and test directories. + m.directory File.join('app/controllers', controller_class_path) + m.directory File.join('test/functional', controller_class_path) + + m.template 'controller.rb', + File.join('app/controllers', + controller_class_path, + "#{controller_file_name}_controller.rb") + + # For some reason this doesn't take effect if done in initialize() + @parent_folder_for_require = @controller_class_path.join('/').gsub(%r%app/controllers/?%, '') + @parent_folder_for_require += @parent_folder_for_require.blank? ? '' : '/' + + m.template 'functional_test.rb', + File.join('test/functional', + controller_class_path, + "#{controller_file_name}_controller_test.rb") + + end + end + + protected + # Override with your own usage banner. + def banner + "Usage: #{$0} gruff ControllerName" + end +end diff --git a/vendor/gruff-0.3.6/rails_generators/gruff/templates/controller.rb b/vendor/gruff-0.3.6/rails_generators/gruff/templates/controller.rb new file mode 100644 index 0000000..b8f90dd --- /dev/null +++ b/vendor/gruff-0.3.6/rails_generators/gruff/templates/controller.rb @@ -0,0 +1,32 @@ +class <%= controller_class_name %>Controller < ApplicationController + + # To make caching easier, add a line like this to config/routes.rb: + # map.graph "graph/:action/:id/image.png", :controller => "graph" + # + # Then reference it with the named route: + # image_tag graph_url(:action => 'show', :id => 42) + + def show + g = Gruff::Line.new + # Uncomment to use your own theme or font + # See http://colourlovers.com or http://www.firewheeldesign.com/widgets/ for color ideas +# g.theme = { +# :colors => ['#663366', '#cccc99', '#cc6633', '#cc9966', '#99cc99'], +# :marker_color => 'white', +# :background_colors => ['black', '#333333'] +# } +# g.font = File.expand_path('artwork/fonts/VeraBd.ttf', RAILS_ROOT) + + g.title = "Gruff-o-Rama" + + g.data("Apples", [1, 2, 3, 4, 4, 3]) + g.data("Oranges", [4, 8, 7, 9, 8, 9]) + g.data("Watermelon", [2, 3, 1, 5, 6, 8]) + g.data("Peaches", [9, 9, 10, 8, 7, 9]) + + g.labels = {0 => '2004', 2 => '2005', 4 => '2006'} + + send_data(g.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png") + end + +end diff --git a/vendor/gruff-0.3.6/rails_generators/gruff/templates/functional_test.rb b/vendor/gruff-0.3.6/rails_generators/gruff/templates/functional_test.rb new file mode 100644 index 0000000..c1f0818 --- /dev/null +++ b/vendor/gruff-0.3.6/rails_generators/gruff/templates/functional_test.rb @@ -0,0 +1,24 @@ +require File.dirname(__FILE__) + '<%= '/..' * controller_class_name.split("::").length %>/test_helper' +require '<%= parent_folder_for_require %><%= controller_file_name %>_controller' + +# Re-raise errors caught by the controller. +class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end + +class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase + + #fixtures :data + + def setup + @controller = <%= controller_class_name %>Controller.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # TODO Replace this with your actual tests + def test_show + get :show + assert_response :success + assert_equal 'image/png', @response.headers['Content-Type'] + end + +end diff --git a/vendor/gruff-0.3.6/test/gruff_test_case.rb b/vendor/gruff-0.3.6/test/gruff_test_case.rb new file mode 100644 index 0000000..074a8d5 --- /dev/null +++ b/vendor/gruff-0.3.6/test/gruff_test_case.rb @@ -0,0 +1,123 @@ +$:.unshift(File.dirname(__FILE__) + "/../lib/") +# require 'rubygems' + +require 'test/unit' +require 'gruff' +require 'fileutils' +# require 'test_timer' + +TEST_OUTPUT_DIR = File.dirname(__FILE__) + "/output" +FileUtils.mkdir_p(TEST_OUTPUT_DIR) + +class GruffTestCase < Test::Unit::TestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]], + [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]], + [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]], + [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + + @labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + 4 => '6/4', + 5 => '6/12', + 6 => '6/21', + 7 => '6/28', + } + end + + def setup_single_dataset + @datasets = [ + [:Jimmy, [25, 36, 86]] + ] + + @labels = { + 0 => 'You', + 1 => 'Average', + 2 => 'Lifetime' + } + end + + def setup_wide_dataset + @datasets = [ + ["Auto", 25], + ["Food", 5], + ["Entertainment", 15] + ] + + @labels = { 0 => 'This Month' } + end + + def test_dummy + assert true + end + +protected + + # Generate graphs at several sizes. + # + # Also writes the graph to disk. + # + # graph_sized 'bar_basic' do |g| + # g.data('students', [1, 2, 3, 4]) + # end + # + def graph_sized(filename, sizes=['', 400]) + class_name = self.class.name.gsub(/^TestGruff/, '') + Array(sizes).each do |size| + g = instance_eval("Gruff::#{class_name}.new #{size}") + g.title = "#{class_name} Graph" + yield g + write_test_file g, "#{filename}_#{size}.png" + end + end + + def write_test_file(graph, filename) + graph.write([TEST_OUTPUT_DIR, filename].join("/")) + end + + ## + # Example: + # + # setup_basic_graph Gruff::Pie, 400 + # + def setup_basic_graph(*args) + klass, size = Gruff::Bar, 400 + # Allow args to be klass, size or just klass or just size. + # + # TODO Refactor + case args.length + when 1 + case args[0] + when Fixnum + size = args[0] + klass = eval("Gruff::#{self.class.name.gsub(/^TestGruff/, '')}") + when String + size = args[0] + klass = eval("Gruff::#{self.class.name.gsub(/^TestGruff/, '')}") + else + klass = args[0] + end + when 2 + klass, size = args[0], args[1] + end + + g = klass.new(size) + g.title = "My Bar Graph" + g.labels = @labels + + + @datasets.each do |data| + g.data(data[0], data[1]) + end + g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_accumulator_bar.rb b/vendor/gruff-0.3.6/test/test_accumulator_bar.rb new file mode 100644 index 0000000..1872c7a --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_accumulator_bar.rb @@ -0,0 +1,50 @@ +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffAccumulatorBar < GruffTestCase + + # TODO Delete old output files once when starting tests + + def setup + @datasets = [ + (1..20).to_a.map { rand(10) } + ] + end + + def test_accumulator + g = Gruff::AccumulatorBar.new 500 + g.title = "Your Savings" + g.hide_legend = true + + # g.font = File.expand_path(File.dirname(__FILE__) + "/../assets/fonts/ATMA____.TTF") + + g.marker_font_size = 18 + + g.theme = { + :colors => ['#aedaa9', '#12a702'], # 3077a9 blue, aedaa9 light green + :marker_color => '#dddddd', + :font_color => 'black', + :background_colors => "white" + # :background_image => File.expand_path(File.dirname(__FILE__) + "/../assets/backgrounds/43things.png") + } + + # Attempt at negative numbers + # g.data 'Savings', (1..20).to_a.map { rand(10) * (rand(2) > 0 ? 1 : -1) } + g.data 'Savings', (1..12).to_a.map { rand(100) } + g.labels = (0..11).to_a.inject({}) {|memo, index| {index => '12-26'}.merge(memo)} + + g.maximum_value = 1000 + g.minimum_value = 0 + + g.write("test/output/accum_bar.png") + end + + def test_too_many_args + assert_raise(Gruff::IncorrectNumberOfDatasetsException) { + g = Gruff::AccumulatorBar.new + g.data 'First', [1,1,1] + g.data 'Too Many', [1,1,1] + g.write("test/output/_SHOULD_NOT_ACTUALLY_BE_WRITTEN.png") + } + end + +end diff --git a/vendor/gruff-0.3.6/test/test_area.rb b/vendor/gruff-0.3.6/test/test_area.rb new file mode 100644 index 0000000..357711c --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_area.rb @@ -0,0 +1,134 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffArea < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]], + [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]], + [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]], + [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + 4 => '6/4', + 5 => '6/12', + 6 => '6/21', + 7 => '6/28', + } + + end + + def test_area_graph + g = Gruff::Area.new + g.title = "Visual Multi-Area Graph Test" + g.labels = { + 0 => '5/6', + 2 => '5/15', + 4 => '5/24', + 6 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/area_keynote.png") + end + + def test_resize + g = Gruff::Area.new(400) + g.title = "Small Size Multi-Area Graph Test" + g.labels = { + 0 => '5/6', + 2 => '5/15', + 4 => '5/24', + 6 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/area_keynote_small.png") + end + + def test_many_datapoints + g = Gruff::Area.new + g.title = "Many Multi-Area Graph Test" + g.labels = { + 0 => 'June', + 10 => 'July', + 30 => 'August', + 50 => 'September', + } + g.data('many points', (0..50).collect {|i| rand(100) }) + + # Default theme + g.write("test/output/area_many.png") + end + + def test_many_areas_graph_small + g = Gruff::Area.new(400) + g.title = "Many Values Area Test 400px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/area_many_areas_small.png") + end + + def test_area_graph_tiny + g = Gruff::Area.new(300) + g.title = "Area Test 300px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/area_tiny.png") + end + + def test_wide + g = setup_basic_graph('800x400') + g.title = "Area Wide" + g.write("test/output/area_wide.png") + end + +protected + + def setup_basic_graph(size=800) + g = Gruff::Area.new(size) + g.title = "My Graph Title" + g.labels = @sample_labels + @datasets.each do |data| + g.data(data[0], data[1]) + end + return g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_bar.rb b/vendor/gruff-0.3.6/test/test_bar.rb new file mode 100644 index 0000000..370bf76 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_bar.rb @@ -0,0 +1,306 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffBar < GruffTestCase + + # TODO Delete old output files once when starting tests + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39]], + [:Charles, [80, 54, 67, 54]], + [:Julie, [22, 29, 35, 38]], + #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + end + + def test_bar_graph + g = setup_basic_graph + g.title = "Bar Graph Test" + g.title_margin = 100 + g.write("test/output/bar_keynote.png") + + g = setup_basic_graph + g.title = "Visual Multi-Line Bar Graph Test" + g.theme_rails_keynote + g.write("test/output/bar_rails_keynote.png") + + g = setup_basic_graph + g.title = "Visual Multi-Line Bar Graph Test" + g.theme_odeo + g.write("test/output/bar_odeo.png") + end + + def test_thousand_separators + g = Gruff::Bar.new(600) + g.title = "Formatted numbers" + g.bar_spacing = 0.2 + g.marker_count = 8 + g.data("data", [4025, 1024, 50257, 703672, 1580456]) + g.write("test/output/bar_formatted_numbers.png") + end + + def test_bar_graph_set_colors + g = Gruff::Bar.new + g.title = "Bar Graph With Manual Colors" + g.legend_margin = 50 + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:Art, [0, 5, 8, 15], '#990000') + g.data(:Philosophy, [10, 3, 2, 8], '#009900') + g.data(:Science, [2, 15, 8, 11], '#990099') + + g.minimum_value = 0 + + g.write("test/output/bar_manual_colors.png") + end + + def test_bar_graph_small + g = Gruff::Bar.new(400) + g.title = "Visual Multi-Line Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/bar_keynote_small.png") + end + + # Somewhat worthless test. Should an error be thrown? + # def test_nil_font + # g = setup_basic_graph 400 + # g.title = "Nil Font" + # g.font = nil + # g.write "test/output/bar_nil_font.png" + # end + + + def test_no_line_markers + g = setup_basic_graph(400) + g.title = "No Line Markers" + g.hide_line_markers = true + g.write("test/output/bar_no_line_markers.png") + end + + def test_no_legend + g = setup_basic_graph(400) + g.title = "No Legend" + g.hide_legend = true + g.write("test/output/bar_no_legend.png") + end + + def test_no_title + g = setup_basic_graph(400) + g.title = "No Title" + g.hide_title = true + g.write("test/output/bar_no_title.png") + end + + def test_no_title_or_legend + g = setup_basic_graph(400) + g.title = "No Title or Legend" + g.hide_legend = true + g.hide_title = true + g.write("test/output/bar_no_title_or_legend.png") + end + + def test_set_marker_count + g = setup_basic_graph(400) + g.title = "Set marker" + g.marker_count = 10 + g.write("test/output/bar_set_marker.png") + end + + def test_set_legend_box_size + g = setup_basic_graph(400) + g.title = "Set Small Legend Box Size" + g.legend_box_size = 10.0 + g.write("test/output/bar_set_legend_box_size_sm.png") + + g = setup_basic_graph(400) + g.title = "Set Large Legend Box Size" + g.legend_box_size = 50.0 + g.write("test/output/bar_set_legend_box_size_lg.png") + end + + def test_x_y_labels + g = setup_basic_graph(400) + g.title = "X Y Labels" + g.x_axis_label = 'Score (%)' + g.y_axis_label = "Students" + g.write("test/output/bar_x_y_labels.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" + g.write("test/output/bar_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" + g.write("test/output/bar_wide_graph_small.png") + end + + + def test_tall_graph + g = setup_basic_graph('400x600') + g.title = "Tall Graph" + g.write("test/output/bar_tall_graph.png") + + g = setup_basic_graph('200x400') + g.title = "Tall Graph Small" + g.write("test/output/bar_tall_graph_small.png") + end + + + def test_one_value + g = Gruff::Bar.new + g.title = "One Value Graph Test" + g.labels = { + 0 => '1', + 1 => '2' + } + g.data('one', [1,1]) + + g.write("test/output/bar_one_value.png") + end + + + def test_negative + g = Gruff::Bar.new + g.title = "Pos/Neg Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) + + g.write("test/output/bar_pos_neg.png") + end + + + def test_nearly_zero + g = Gruff::Bar.new + g.title = "Nearly Zero Graph" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [1, 2, 3, 4]) + g.data(:peaches, [4, 3, 2, 1]) + g.minimum_value = 0 + g.maximum_value = 10 + g.write("test/output/bar_nearly_zero_max_10.png") + end + + def test_y_axis_increment + generate_with_y_axis_increment 2.0 + generate_with_y_axis_increment 1 + generate_with_y_axis_increment 5 + generate_with_y_axis_increment 20 + end + + def generate_with_y_axis_increment(increment) + g = Gruff::Bar.new + g.title = "Y Axis Set to #{increment}" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.y_axis_increment = increment + g.data(:apples, [1, 0.2, 0.5, 0.7]) + g.data(:peaches, [2.5, 2.3, 2, 6.1]) + g.write("test/output/bar_y_increment_#{increment}.png") + end + + + def test_custom_theme + g = Gruff::Bar.new + g.title = "Custom Theme" + g.font = File.expand_path('CREABBRG.TTF', ENV['MAGICK_FONT_PATH']) + g.title_font_size = 60 + g.legend_font_size = 32 + g.marker_font_size = 32 + g.theme = { + :colors => %w(#efd250 #666699 #e5573f #9595e2), + :marker_color => 'white', + :font_color => 'blue', + :background_image => "assets/pc306715.jpg" + } + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:vancouver, [1, 2, 3, 4]) + g.data(:seattle, [2, 4, 6, 8]) + g.data(:portland, [3, 1, 7, 3]) + g.data(:victoria, [4, 3, 5, 7]) + g.minimum_value = 0 + g.write("test/output/bar_themed.png") + end + + def test_legend_should_not_overlap + g = Gruff::Bar.new(400) + g.theme_37signals() + g.title = 'My Graph' + g.data("Apples Oranges Watermelon Apples Oranges", [1, 2, 3, 4, 4, 3]) + g.data('Oranges', [4, 8, 7, 9, 8, 9]) + g.data('Watermelon', [2, 3, 1, 5, 6, 8]) + g.data('Peaches', [9, 9, 10, 8, 7, 9]) + g.labels = {0 => '2003', 2 => '2004', 4 => '2005'} + g.write("test/output/bar_long_legend_text.png") + end + + def test_july_enhancements + g = Gruff::Bar.new(600) + g.hide_legend = true + g.title = "Full speed ahead" + g.labels = (0..10).inject({}) { |memo, i| memo.merge({ i => (i*10).to_s}) } + g.data(:apples, (0..9).map { rand(20)/10.0 }) + g.y_axis_increment = 1.0 + g.x_axis_label = 'Score (%)' + g.y_axis_label = 'Students' + write_test_file g, 'enhancements.png' + end + + +protected + + def setup_basic_graph(size=800) + g = Gruff::Bar.new(size) + g.title = "My Bar Graph" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g + end + +end + diff --git a/vendor/gruff-0.3.6/test/test_base.rb b/vendor/gruff-0.3.6/test/test_base.rb new file mode 100644 index 0000000..d68be92 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_base.rb @@ -0,0 +1,8 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffBase < GruffTestCase + + +end \ No newline at end of file diff --git a/vendor/gruff-0.3.6/test/test_bullet.rb b/vendor/gruff-0.3.6/test/test_bullet.rb new file mode 100644 index 0000000..85acce6 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_bullet.rb @@ -0,0 +1,26 @@ +# require File.dirname(__FILE__) + "/gruff_test_case" +# +# class TestGruffBullet < GruffTestCase +# +# def setup +# @data_args = [75, 100, { +# :target => 80, +# :low => 50, +# :high => 90 +# }] +# end +# +# def test_bullet_graph +# g = Gruff::Bullet.new +# g.title = "Monthly Revenue" +# g.data *@data_args +# g.write("test/output/bullet_greyscale.png") +# end +# +# def test_no_options +# g = Gruff::Bullet.new +# g.data 127, 150 +# g.write("test/output/bullet_no_options.png") +# end +# +# end diff --git a/vendor/gruff-0.3.6/test/test_dot.rb b/vendor/gruff-0.3.6/test/test_dot.rb new file mode 100644 index 0000000..79ce963 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_dot.rb @@ -0,0 +1,273 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffDot < GruffTestCase + + # TODO Delete old output files once when starting tests + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39]], + [:Charles, [80, 54, 67, 54]], + [:Julie, [22, 29, 35, 38]], + #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + end + + def test_dot_graph + g = setup_basic_graph + g.title = "Dot Graph Test" + g.write("test/output/dot_keynote.png") + end + + def test_dot_graph_set_colors + g = Gruff::Dot.new + g.title = "Dot Graph With Manual Colors" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:Art, [0, 5, 8, 15], '#990000') + g.data(:Philosophy, [10, 3, 2, 8], '#009900') + g.data(:Science, [2, 15, 8, 11], '#990099') + + g.minimum_value = 0 + + g.write("test/output/dot_manual_colors.png") + end + + def test_dot_graph_small + g = Gruff::Dot.new(400) + g.title = "Visual Multi-Line Dot Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/dot_keynote_small.png") + end + + # Somewhat worthless test. Should an error be thrown? + # def test_nil_font + # g = setup_basic_graph 400 + # g.title = "Nil Font" + # g.font = nil + # g.write "test/output/dot_nil_font.png" + # end + + + def test_no_line_markers + g = setup_basic_graph(400) + g.title = "No Line Markers" + g.hide_line_markers = true + g.write("test/output/dot_no_line_markers.png") + end + + def test_no_legend + g = setup_basic_graph(400) + g.title = "No Legend" + g.hide_legend = true + g.write("test/output/dot_no_legend.png") + end + + def test_no_title + g = setup_basic_graph(400) + g.title = "No Title" + g.hide_title = true + g.write("test/output/dot_no_title.png") + end + + def test_no_title_or_legend + g = setup_basic_graph(400) + g.title = "No Title or Legend" + g.hide_legend = true + g.hide_title = true + g.write("test/output/dot_no_title_or_legend.png") + end + + def test_set_marker_count + g = setup_basic_graph(400) + g.title = "Set marker" + g.marker_count = 10 + g.write("test/output/dot_set_marker.png") + end + + def test_set_legend_box_size + g = setup_basic_graph(400) + g.title = "Set Small Legend Box Size" + g.legend_box_size = 10.0 + g.write("test/output/dot_set_legend_box_size_sm.png") + + g = setup_basic_graph(400) + g.title = "Set Large Legend Box Size" + g.legend_box_size = 50.0 + g.write("test/output/dot_set_legend_box_size_lg.png") + end + + def test_x_y_labels + g = setup_basic_graph(400) + g.title = "X Y Labels" + g.x_axis_label = 'Score (%)' + g.y_axis_label = "Students" + g.write("test/output/dot_x_y_labels.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" + g.write("test/output/dot_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" + g.write("test/output/dot_wide_graph_small.png") + end + + + def test_tall_graph + g = setup_basic_graph('400x600') + g.title = "Tall Graph" + g.write("test/output/dot_tall_graph.png") + + g = setup_basic_graph('200x400') + g.title = "Tall Graph Small" + g.write("test/output/dot_tall_graph_small.png") + end + + + def test_one_value + g = Gruff::Dot.new + g.title = "One Value Graph Test" + g.labels = { + 0 => '1', + 1 => '2' + } + g.data('one', [1,1]) + + g.write("test/output/dot_one_value.png") + end + + + def test_negative + g = Gruff::Dot.new + g.title = "Pos/Neg Dot Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) + + g.write("test/output/dot_pos_neg.png") + end + + + def test_nearly_zero + g = Gruff::Dot.new + g.title = "Nearly Zero Graph" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [1, 2, 3, 4]) + g.data(:peaches, [4, 3, 2, 1]) + g.minimum_value = 0 + g.maximum_value = 10 + g.write("test/output/dot_nearly_zero_max_10.png") + end + + def test_y_axis_increment + generate_with_y_axis_increment 2.0 + generate_with_y_axis_increment 1 + generate_with_y_axis_increment 5 + generate_with_y_axis_increment 20 + end + + def generate_with_y_axis_increment(increment) + g = Gruff::Dot.new + g.title = "Y Axis Set to #{increment}" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.y_axis_increment = increment + g.data(:apples, [1, 0.2, 0.5, 0.7]) + g.data(:peaches, [2.5, 2.3, 2, 6.1]) + g.write("test/output/dot_y_increment_#{increment}.png") + end + + + def test_custom_theme + g = Gruff::Dot.new + g.title = "Custom Theme" + g.font = File.expand_path('CREABBRG.TTF', ENV['MAGICK_FONT_PATH']) + g.title_font_size = 60 + g.legend_font_size = 32 + g.marker_font_size = 32 + g.theme = { + :colors => %w(#efd250 #666699 #e5573f #9595e2), + :marker_color => 'white', + :font_color => 'blue', + :background_image => "assets/pc306715.jpg" + } + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:vancouver, [1, 2, 3, 4]) + g.data(:seattle, [2, 4, 6, 8]) + g.data(:portland, [3, 1, 7, 3]) + g.data(:victoria, [4, 3, 5, 7]) + g.minimum_value = 0 + g.write("test/output/dot_themed.png") + end + + def test_july_enhancements + g = Gruff::Dot.new(600) + g.hide_legend = true + g.title = "Full speed ahead" + g.labels = (0..10).inject({}) { |memo, i| memo.merge({ i => (i*10).to_s}) } + g.data(:apples, (0..9).map { rand(20)/10.0 }) + g.y_axis_increment = 1.0 + g.x_axis_label = 'Score (%)' + g.y_axis_label = 'Students' + write_test_file g, 'enhancements.png' + end + + +protected + + def setup_basic_graph(size=800) + g = Gruff::Dot.new(size) + g.title = "My Dot Graph" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g + end + +end + diff --git a/vendor/gruff-0.3.6/test/test_legend.rb b/vendor/gruff-0.3.6/test/test_legend.rb new file mode 100644 index 0000000..1e4c8bf --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_legend.rb @@ -0,0 +1,68 @@ +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffLegend < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]], + [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]], + [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]], + [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Vincent", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Jake", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Stephen", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + 4 => '6/4', + 5 => '6/12', + 6 => '6/21', + 7 => '6/28', + } + end + + def full_suite_for(name, type) + [800, 400].each do |width| + [nil, 4, 16, 30].each do |font_size| + g = type.new(width) + g.title = "Wrapped Legend Bar Test #{font_size}pts #{width}px" + g.labels = @sample_labels + 0xEFD250.step(0xFF0000, 60) do |num| + g.colors << "#%x" % num + end + + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.legend_font_size = font_size unless font_size.nil? + g.write("test/output/#{name}_wrapped_legend_#{font_size}_#{width}.png") + end + end + end + + def test_bar_legend_wrap + full_suite_for(:bar, Gruff::Bar) + end + + def test_pie_legend_wrap + full_suite_for(:pie, Gruff::Pie) + end + + def test_more_than_two_lines_of_legends + @datasets = @datasets + [[:Julie2, [22, 29, 35, 38, 36, 40, 46, 57]], + [:Jane2, [95, 95, 95, 90, 85, 80, 88, 100]], + [:Philip2, [90, 34, 23, 12, 78, 89, 98, 88]], + ["Arthur2", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Vincent2", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Jake2", [5, 10, 13, 11, 6, 16, 22, 32]], + ["Stephen2", [5, 10, 13, 11, 6, 16, 22, 32]]] + full_suite_for(:bar2, Gruff::Bar) + end +end diff --git a/vendor/gruff-0.3.6/test/test_line.rb b/vendor/gruff-0.3.6/test/test_line.rb new file mode 100644 index 0000000..4135b1e --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_line.rb @@ -0,0 +1,556 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffLine < GruffTestCase + + # TODO Delete old output files once when starting tests + + def test_should_render_with_transparent_theme + g = Gruff::Line.new(400) + g.title = "Transparent Background" + g.theme = { + :colors => ['black', 'grey'], + :marker_color => 'grey', + :font_color => 'black', + :background_colors => 'transparent' + } + + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) + g.write("test/output/line_transparent.png") + end + + def test_line_graph_with_themes + line_graph_with_themes() + line_graph_with_themes(400) + end + + def test_one_value + g = Gruff::Line.new + g.title = "One Value" + g.labels = { + 0 => '1', + 1 => '2' + } + g.data('one', 1) + + g.write("test/output/line_one_value.png") + end + + def test_one_value_array + g = Gruff::Line.new + g.title = "One Value in an Array" + g.labels = { + 0 => '1', + 1 => '2' + } + g.data('one', [1]) + + g.write("test/output/line_one_value_array.png") + end + + + def test_should_not_hang_with_0_0_100 + g = Gruff::Line.new(320) + g.title = "Hang Value Graph Test" + g.data('test', [0,0,100]) + + g.write("test/output/line_hang_value.png") + end + + # TODO + # def test_fix_crash + # g = Gruff::Line.new(370) + # g.title = "Crash Test" + # g.data "ichi", [5] + # g.data "ni", [0] + # g.data "san", [0] + # g.data "shi", [0] + # g.write("test/output/line_crash_fix_test.png") + # end + + + def test_line_small_values + @datasets = [ + [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]], + [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]] + ] + + g = Gruff::Line.new + g.title = "Small Values Line Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_small.png") + + g = Gruff::Line.new(400) + g.title = "Small Values Line Graph Test 400px" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_small_small.png") + end + + def test_line_starts_with_zero + @datasets = [ + [:first0, [0, 5, 10, 8, 18]], + [:normal, [1, 2, 3, 4, 5]] + ] + + g = Gruff::Line.new + g.title = "Small Values Line Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_small_zero.png") + + g = Gruff::Line.new(400) + g.title = "Small Values Line Graph Test 400px" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_small_small_zero.png") + end + + + def test_line_large_values + @datasets = [ + [:large, [100_005, 35_000, 28_000, 27_000]], + [:large2, [35_000, 28_000, 27_000, 100_005]], + [:large3, [28_000, 27_000, 100_005, 35_000]], + [:large4, [1_238, 39_092, 27_938, 48_876]] + ] + + g = Gruff::Line.new + g.title = "Very Large Values Line Graph Test" + g.baseline_value = 50_000 + g.baseline_color = 'green' + g.dot_radius = 15 + g.line_width = 3 + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/line_large.png") + end + + # def test_long_title + # + # end + # + # def test_add_colors + # + # end + # + + def test_request_too_many_colors + g = Gruff::Line.new + g.title = "More Sets Than in Color Array" +# g.theme = {} # Sets theme with only black and white + @datasets.each do |data| + g.data(data[0], data[1]) + end + @datasets.each do |data| + g.data("#{data[0]}-B", data[1].map {|d| d + 20}) + end + g.write("test/output/line_more_sets_than_colors.png") + end + + # + # def test_add_data + # + # end + + def test_many_datapoints + g = Gruff::Line.new + g.title = "Many Multi-Line Graph Test" + g.labels = { + 0 => 'June', + 10 => 'July', + 30 => 'August', + 50 => 'September', + } + g.data('many points', (0..50).collect {|i| rand(100) }) + g.x_axis_label = "Months" + + # Default theme + g.write("test/output/line_many.png") + end + + + def test_similar_high_end_values + @dataset = %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f} + + g = Gruff::Line.new + g.title = "Similar High End Values Test" + g.data('similar points', @dataset ) + g.write("test/output/line_similar_high_end_values.png") + + g = Gruff::Line.new + g.title = "Similar High End Values With Floor" + g.data('similar points', @dataset ) + g.minimum_value = 0 + g.y_axis_label = "Barometric Pressure" + g.write("test/output/line_similar_high_end_values_with_floor.png") + end + + def test_many_lines_graph_small + g = Gruff::Line.new(400) + g.title = "Many Values Line Test 400px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/line_many_lines_small.png") + end + + def test_graph_tiny + g = Gruff::Line.new(300) + g.title = "Tiny Test 300px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/line_tiny.png") + end + + def test_no_data + g = Gruff::Line.new(400) + g.title = "No Data" + # Default theme + g.write("test/output/line_no_data.png") + + g = Gruff::Line.new(400) + g.title = "No Data Title" + g.no_data_message = 'There is no data' + g.write("test/output/line_no_data_msg.png") + end + + + def test_all_zeros + g = Gruff::Line.new(400) + g.title = "All Zeros" + + g.data(:gus, [0,0,0,0]) + + # Default theme + g.write("test/output/line_no_data_other.png") + end + + + def test_some_nil_points + g = Gruff::Line.new + g.title = "Some Nil Points" + + @datasets = [ + [:data1, [1, 2, 3, nil, 3, 5, 6]], + [:data2, [5, nil, nil, nil, nil, nil, 5]], + [:data3, [4, nil, 2, 1, 0]], + [:data4, [nil, nil, 3, 1, 2]] + ] + + @datasets.each do |data| + g.data(*data) + end + + # Default theme + g.write("test/output/line_some_nil_points.png") + end + + def test_no_title + g = Gruff::Line.new(400) + g.labels = @labels + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/line_no_title.png") + end + + def test_no_line_markers + g = setup_basic_graph(400) + g.title = "No Line Markers" + g.hide_line_markers = true + g.write("test/output/line_no_line_markers.png") + end + + def test_no_legend + g = setup_basic_graph(400) + g.title = "No Legend" + g.hide_legend = true + g.write("test/output/line_no_legend.png") + end + + def test_nothing_but_the_graph + g = setup_basic_graph(400) + g.title = "THIS TITLE SHOULD NOT DISPLAY!!!" + g.hide_line_markers = true + g.hide_legend = true + g.hide_title = true + g.write("test/output/line_nothing_but_the_graph.png") + end + + def test_baseline_larger_than_data + g = setup_basic_graph(400) + g.title = "Baseline Larger Than Data" + g.baseline_value = 150 + g.write("test/output/line_large_baseline.png") + end + + + def test_hide_dots + g = setup_basic_graph(400) + g.title = "Hide Dots" + g.hide_dots = true + g.write("test/output/line_hide_dots.png") + end + + def test_hide_lines + g = setup_basic_graph(400) + g.title = "Hide Lines" + g.hide_lines = true + g.write("test/output/line_hide_lines.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" + g.write("test/output/line_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" + g.write("test/output/line_wide_graph_small.png") + end + + def test_negative + g = setup_pos_neg(800) + g.write("test/output/line_pos_neg.png") + + g = setup_pos_neg(400) + g.title = 'Pos/Neg Line Test Small' + g.write("test/output/line_pos_neg_400.png") + end + + def test_all_negative + g = setup_all_neg(800) + g.write("test/output/line_all_neg.png") + + g = setup_all_neg(400) + g.title = 'All Neg Line Test Small' + g.write("test/output/line_all_neg_400.png") + end + + def test_many_numbers + g = Gruff::Line.new('400x170') + g.title = "Line Test, Many Numbers" + + data = [ + { :date => '01', + :wpm => 0, + :errors => 0, + :accuracy => 0 }, + { :date => '02', + :wpm => 10, + :errors => 2, + :accuracy => 80 }, + { :date => '03', + :wpm => 15, + :errors => 0, + :accuracy => 100 }, + { :date => '04', + :wpm => 16, + :errors => 2, + :accuracy => 87 }, + { :date => '05', + :wpm => nil, + :errors => nil, + :accuracy => nil }, + { :date => '06', + :wpm => 18, + :errors => 1, + :accuracy => 94 }, + { :date => '07'}, + { :date => '08' }, + { :date => '09', + :wpm => 21, + :errors => 1, + :accuracy => 95 }, + { :date => '10'}, + { :date => '11'}, + { :date => '12'}, + { :date => '13'}, + { :date => '14'}, + { :date => '15'}, + { :date => '16'}, + { :date => '17'}, + { :date => '18'}, + { :date => '19', + :wpm => 28, + :errors => 5, + :accuracy => 82 }, + { :date => '20'}, + { :date => '21'}, + { :date => '22'}, + { :date => '23'}, + { :date => '24'}, + { :date => '25'}, + { :date => '26'}, + { :date => '27', + :wpm => 37, + :errors => 3, + :accuracy => 92 }, + ] + + [:wpm, :errors, :accuracy].each do |field| + g.data(field.to_s, data.collect {|d| d[field] }) + end + + labels = Hash.new + data.each_with_index do |d, i| + labels[i] = d[:date] + end + g.labels = labels + + g.write('test/output/line_many_numbers.png') + end + + def test_no_hide_line_no_labels + g = Gruff::Line.new + g.title = "No Hide Line No Labels" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.hide_line_markers = false + g.write('test/output/line_no_hide.png') + end + + + def test_jruby_error + g = Gruff::Line.new + g.theme = { + :colors => ['#7F0099', '#2F85ED', '#2FED09','#EC962F'], + :marker_color => '#aaa', + :background_colors => ['#E8E8E8','#B9FD6C'] + } + g.hide_title = true + + g.legend_font_size = 12 + g.marker_font_size = 16 + g.hide_dots = false + g.label_max_decimals = 1 + + g.write('test/output/line_jruby_error.png') + end + +private + + def bmi(params={}) + g = basic_graph() + + g.y_axis_label = 'BMI' + + bmis = [24.3, 23.9, 23.7, 23.7, 23.6, 23.9, 23.6, 23.7, 23.4, 23.4, 23.4, 22.9] + + g.data( 'BMI', bmis ) + g.hide_legend = true + return g + end + + # TODO Reset data after each theme + def line_graph_with_themes(size=nil) + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels + g.baseline_value = 90 + @datasets.each do |data| + g.data(data[0], data[1]) + end + # Default theme + g.write("test/output/line_theme_keynote_#{size}.png") + + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels + g.baseline_value = 90 + g.theme_37signals + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_theme_37signals_#{size}.png") + + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels + g.baseline_value = 90 + g.theme_rails_keynote + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_theme_rails_keynote_#{size}.png") + + g = Gruff::Line.new(size) + g.title = "Multi-Line Graph Test #{size}" + g.labels = @labels + g.baseline_value = 90 + g.theme_odeo + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/line_theme_odeo_#{size}.png") + end + + def setup_pos_neg(size=800) + g = Gruff::Line.new(size) + g.title = "Pos/Neg Line Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [-1, 0, 4, -4]) + g.data(:peaches, [10, 8, 6, 3]) + return g + end + + + def setup_all_neg(size=800) + g = Gruff::Line.new(size) + g.title = "All Neg Line Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + g.data(:apples, [-1, -5, -20, -4]) + g.data(:peaches, [-10, -8, -6, -3]) + g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_mini_bar.rb b/vendor/gruff-0.3.6/test/test_mini_bar.rb new file mode 100644 index 0000000..b69e60b --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_mini_bar.rb @@ -0,0 +1,33 @@ + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestMiniBar < GruffTestCase + + def test_simple_bar + setup_single_dataset + g = setup_basic_graph(Gruff::Mini::Bar, 200) + g.hide_mini_legend = true + write_test_file g, 'mini_bar.png' + end + + # def test_simple_bar_wide_dataset + # setup_wide_dataset + # g = setup_basic_graph(Gruff::Mini::Bar, 200) + # write_test_file g, 'mini_bar_wide_data.png' + # end + # + # def test_code_sample + # g = Gruff::Mini::Bar.new(200) + # g.data "Jim", [200, 500, 400] + # g.labels = { 0 => 'This Month', 1 => 'Average', 2 => 'Overall'} + # g.write "mini_bar_one_color.png" + # + # g = Gruff::Mini::Bar.new(200) + # g.data "Car", 200 + # g.data "Food", 500 + # g.data "Art", 1000 + # g.data "Music", 16 + # g.write "mini_bar_many_colors.png" + # end + +end diff --git a/vendor/gruff-0.3.6/test/test_mini_pie.rb b/vendor/gruff-0.3.6/test/test_mini_pie.rb new file mode 100644 index 0000000..87ff58a --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_mini_pie.rb @@ -0,0 +1,20 @@ + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestMiniPie < GruffTestCase + + def test_simple_pie + g = setup_basic_graph(Gruff::Mini::Pie, 200) + write_test_file g, 'mini_pie.png' + end + + # def test_code_sample + # g = Gruff::Mini::Pie.new(200) + # g.data "Car", 200 + # g.data "Food", 500 + # g.data "Art", 1000 + # g.data "Music", 16 + # g.write "mini_pie.png" + # end + +end diff --git a/vendor/gruff-0.3.6/test/test_mini_side_bar.rb b/vendor/gruff-0.3.6/test/test_mini_side_bar.rb new file mode 100644 index 0000000..4145380 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_mini_side_bar.rb @@ -0,0 +1,37 @@ + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestMiniSideBar < GruffTestCase + + def test_one_color + # Use a single data set + @datasets = [ + [:Jimmy, [25, 36, 86, 39]] + ] + @labels = { + 0 => 'Auto', + 1 => 'Entertainment', + 2 => 'Food', + 3 => 'Bus' + } + + g = setup_basic_graph(Gruff::Mini::SideBar, 200) + write_test_file g, 'mini_side_bar.png' + end + + def test_multi_color + # @datasets = [ + # [:Jimmy, [25, 36, 86, 39]] + # ] + # @labels = { + # 0 => 'Auto', + # 1 => 'Entertainment', + # 2 => 'Food', + # 3 => 'Bus' + # } + + g = setup_basic_graph(Gruff::Mini::SideBar, 200) + write_test_file g, 'mini_side_bar_multi_color.png' + end + +end diff --git a/vendor/gruff-0.3.6/test/test_net.rb b/vendor/gruff-0.3.6/test/test_net.rb new file mode 100644 index 0000000..869149d --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_net.rb @@ -0,0 +1,230 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffNet < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39, 25, 31, 79, 88]], + [:Charles, [80, 54, 67, 54, 68, 70, 90, 95]], + [:Julie, [22, 29, 35, 38, 36, 40, 46, 57]], + [:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + [:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + ["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + 4 => '6/4', + 5 => '6/12', + 6 => '6/21', + 7 => '6/28', + } + end + + def test_net_small_values + @datasets = [ + [:small, [0.1, 0.14356, 0.0, 0.5674839, 0.456]], + [:small2, [0.2, 0.3, 0.1, 0.05, 0.9]] + ] + + g = Gruff::Net.new + g.title = "Small Values Net Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/net_small.png") + + g = Gruff::Net.new(400) + g.title = "Small Values Net Graph Test 400px" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/net_small_small.png") + end + + def test_net_starts_with_zero + @datasets = [ + [:first0, [0, 5, 10, 8, 18]], + [:normal, [1, 2, 3, 4, 5]] + ] + + g = Gruff::Net.new + g.title = "Small Values Net Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/net_small_zero.png") + + g = Gruff::Net.new(400) + g.title = "Small Values Net Graph Test 400px" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/net_small_small_zero.png") + end + + + def test_net_large_values + @datasets = [ + [:large, [100_005, 35_000, 28_000, 27_000]], + [:large2, [35_000, 28_000, 27_000, 100_005]], + [:large3, [28_000, 27_000, 100_005, 35_000]], + [:large4, [1_238, 39_092, 27_938, 48_876]] + ] + + g = Gruff::Net.new + g.title = "Very Large Values Net Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/net_large.png") + end + + def test_many_datapoints + g = Gruff::Net.new + g.title = "Many Multi-Net Graph Test" + g.labels = { + 0 => 'June', + 10 => 'July', + 30 => 'August', + 50 => 'September', + } + g.data('many points', (0..50).collect {|i| rand(100) }) + + # Default theme + g.write("test/output/net_many.png") + end + + + def test_similar_high_end_values + g = Gruff::Net.new + g.title = "Similar High End Values Test" + g.data('similar points', %w(29.43 29.459 29.498 29.53 29.548 29.589 29.619 29.66 29.689 29.849 29.878 29.74 29.769 29.79 29.808 29.828).collect {|i| i.to_f} ) + + # Default theme + g.write("test/output/net_similar_high_end_values.png") + end + + def test_many_nets_graph_small + g = Gruff::Net.new(400) + g.title = "Many Values Net Test 400px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/net_many_nets_small.png") + end + + def test_dots_graph_tiny + g = Gruff::Net.new(300) + g.title = "Dots Test 300px" + g.labels = { + 0 => '5/6', + 10 => '5/15', + 20 => '5/24', + 30 => '5/30', + 40 => '6/4', + 50 => '6/16' + } + %w{jimmy jane philip arthur julie bert}.each do |student_name| + g.data(student_name, (0..50).collect { |i| rand 100 }) + end + + # Default theme + g.write("test/output/net_dots_tiny.png") + end + + def test_no_data + g = Gruff::Net.new(400) + g.title = "No Data" + # Default theme + g.write("test/output/net_no_data.png") + + g = Gruff::Net.new(400) + g.title = "No Data Title" + g.no_data_message = 'There is no data' + g.write("test/output/net_no_data_msg.png") + end + + + def test_all_zeros + g = Gruff::Net.new(400) + g.title = "All Zeros" + + g.data(:gus, [0,0,0,0]) + + # Default theme + g.write("test/output/net_no_data_other.png") + end + + def test_no_title + g = Gruff::Net.new(400) + g.labels = @sample_labels + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.write("test/output/net_no_title.png") + end + + def test_no_net_markers + g = setup_basic_graph(400) + g.title = "No Net Markers" + g.hide_line_markers = true + g.write("test/output/net_no_net_markers.png") + end + + def test_no_legend + g = setup_basic_graph(400) + g.title = "No Legend" + g.hide_legend = true + g.write("test/output/net_no_legend.png") + end + + def test_nothing_but_the_graph + g = setup_basic_graph(400) + g.title = "THIS TITLE SHOULD NOT DISPLAY!!!" + g.hide_line_markers = true + g.hide_legend = true + g.hide_title = true + g.write("test/output/net_nothing_but_the_graph.png") + end + + def test_wide_graph + g = setup_basic_graph('800x400') + g.title = "Wide Graph" + g.write("test/output/net_wide_graph.png") + + g = setup_basic_graph('400x200') + g.title = "Wide Graph Small" + g.write("test/output/net_wide_graph_small.png") + end + +protected + + def setup_basic_graph(size=800) + g = Gruff::Net.new(size) + g.title = "My Graph Title" + g.labels = @sample_labels + @datasets.each do |data| + g.data(data[0], data[1]) + end + return g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_photo.rb b/vendor/gruff-0.3.6/test/test_photo.rb new file mode 100644 index 0000000..32415aa --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_photo.rb @@ -0,0 +1,41 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffPhotoBar < GruffTestCase + +# def setup +# @datasets = [ +# [:Jimmy, [25, 36, 86, 39]], +# [:Charles, [80, 54, 67, 54]], +# # [:Charity, [0, nil, 100, 90]], +# ] +# end +# +# def test_bar_graph +# bar_graph_sized +# bar_graph_sized(400) +# end +# +# +# protected +# +# def bar_graph_sized(size=800) +# g = Gruff::PhotoBar.new(size) +# g.title = "Photo Bar Graph Test #{size}px" +# g.labels = { +# 0 => '5/6', +# 1 => '5/15', +# 2 => '5/24', +# 3 => '5/30', +# } +# @datasets.each do |data| +# g.data(*data) +# end +# +# g.theme = 'plastik' +# +# g.write("test/output/photo_plastik_#{size}.png") +# end + +end diff --git a/vendor/gruff-0.3.6/test/test_pie.rb b/vendor/gruff-0.3.6/test/test_pie.rb new file mode 100644 index 0000000..4901e2a --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_pie.rb @@ -0,0 +1,154 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffPie < GruffTestCase + + def setup + @datasets = [ + [:Darren, [25]], + [:Chris, [80]], + [:Egbert, [22]], + [:Adam, [95]], + [:Bill, [90]], + ["Frank", [5]], + ["Zero", [0]], + ] + end + + def test_pie_graph + g = Gruff::Pie.new + g.title = "Visual Pie Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/pie_keynote.png") + end + + def test_pie_graph_greyscale + g = Gruff::Pie.new + g.title = "Greyscale Pie Graph Test" + g.theme_greyscale + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/pie_grey.png") + end + + def test_pie_graph_pastel + g = Gruff::Pie.new + g.theme_pastel + g.title = "Pastel Pie Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/pie_pastel.png") + end + + + def test_pie_graph_small + g = Gruff::Pie.new(400) + g.title = "Visual Pie Graph Test Small" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/pie_keynote_small.png") + end + + def test_pie_graph_nearly_equal + g = Gruff::Pie.new + g.title = "Pie Graph Nearly Equal" + + g.data(:Blake, [41]) + g.data(:Aaron, [42]) +# g.data(:Grouch, [40]) +# g.data(:Snuffleupagus, [43]) + + g.write("test/output/pie_nearly_equal.png") + end + + def test_pie_graph_equal + g = Gruff::Pie.new + g.title = "Pie Graph Equal" + + g.data(:Bert, [41]) + g.data(:Adam, [41]) + + g.write("test/output/pie_equal.png") + end + + def test_pie_graph_zero + g = Gruff::Pie.new + g.title = "Pie Graph One Zero" + + g.data(:Bert, [0]) + g.data(:Adam, [1]) + + g.write("test/output/pie_zero.png") + end + + + def test_pie_graph_one_val + g = Gruff::Pie.new + g.title = "Pie Graph One Val" + + g.data(:Bert, 53) + g.data(:Adam, 29) + + g.write("test/output/pie_one_val.png") + end + + + def test_wide + g = setup_basic_graph('800x400') + g.title = "Wide Pie" + g.write("test/output/pie_wide.png") + end + + def test_label_size + g = setup_basic_graph() + g.title = "Pie With Small Legend" + g.legend_font_size = 10 + g.write("test/output/pie_legend.png") + + g = setup_basic_graph(400) + g.title = "Small Pie With Small Legend" + g.legend_font_size = 10 + g.write("test/output/pie_legend_small.png") + end + + + def test_tiny_simple_pie + @datasets = (1..5).map {|n| ['Auto', [rand(100)]]} + + g = setup_basic_graph 200 + g.hide_legend = true + g.hide_title = true + g.hide_line_numbers = true + + g.marker_font_size = 40.0 + g.minimum_value = 0.0 + + write_test_file g, "pie_simple.png" + end + +protected + + def setup_basic_graph(size=800) + g = Gruff::Pie.new(size) + g.title = "My Graph Title" + @datasets.each do |data| + g.data(data[0], data[1]) + end + return g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_scene.rb b/vendor/gruff-0.3.6/test/test_scene.rb new file mode 100644 index 0000000..7603d29 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_scene.rb @@ -0,0 +1,100 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" +require 'yaml' + +class LayerStub < Gruff::Layer; attr_reader :base_dir, :filenames, :selected_filename; end + +class TestGruffScene < GruffTestCase + + def test_hazy + g = setup_scene + g.weather = "cloudy" + g.haze = true + g.time = Time.mktime(2006, 7, 4, 4, 35) + g.write "test/output/scene_hazy_night.png" + end + + def test_stormy_night + g = setup_scene + g.weather = "stormy" + g.time = Time.mktime(2006, 7, 4, 0, 0) + g.write "test/output/scene_stormy_night.png" + end + + + def test_not_hazy + g = setup_scene + g.weather = "cloudy" + g.haze = false + g.time = Time.mktime(2006, 7, 4, 6, 00) + g.write "test/output/scene_not_hazy_day.png" + end + + def test_partly_cloudy + g = setup_scene + g.weather = "partly cloudy" + g.haze = false + g.time = Time.mktime(2006, 7, 4, 13, 00) + g.write "test/output/scene_partly_cloudy_day.png" + end + + + def test_stormy_day + g = setup_scene + g.weather = "stormy" + g.haze = false + g.time = Time.mktime(2006, 7, 4, 8, 00) + g.write "test/output/scene_stormy_day.png" + end + + + def test_layer + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "clouds") + assert_equal %w(cloudy.png partly_cloudy.png stormy.png), l.filenames + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "grass") + assert_equal 'default.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 12, 35) # 12:35, July 4, 2006 + assert_equal '1200.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 0, 0) # 00:00, July 4, 2006 + assert_equal '0000.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 23, 35) # 23:35, July 4, 2006 + assert_equal '2000.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 0, 1) # 00:01, July 4, 2006 + assert_equal '0000.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 2, 0) # 02:00, July 4, 2006 + assert_equal '0200.png', l.selected_filename + + l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "sky") + l.update Time.mktime(2006, 7, 4, 4, 00) # 04:00, July 4, 2006 + assert_equal '0400.png', l.selected_filename + + # TODO Need number_sample folder + # l = LayerStub.new(File.expand_path("../assets/city_scene", File.dirname(__FILE__)), "number_sample") + # assert_equal %w(1.png 2.png default.png), l.filenames + # l.update 3 + # assert_equal 'default.png', l.selected_filename + end + +private + + def setup_scene + g = Gruff::Scene.new("500x100", File.expand_path("../assets/city_scene", File.dirname(__FILE__)) ) + g.layers = %w(background haze sky clouds) + g.weather_group = %w(clouds) + g.time_group = %w(background sky) + g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_side_bar.rb b/vendor/gruff-0.3.6/test/test_side_bar.rb new file mode 100644 index 0000000..7d2ea3d --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_side_bar.rb @@ -0,0 +1,12 @@ + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffSideBar < GruffTestCase + + def test_bar_graph + g = setup_basic_graph(Gruff::SideBar, 800) + write_test_file g, 'side_bar.png' + end + +end + diff --git a/vendor/gruff-0.3.6/test/test_sidestacked_bar.rb b/vendor/gruff-0.3.6/test/test_sidestacked_bar.rb new file mode 100644 index 0000000..5bcc670 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_sidestacked_bar.rb @@ -0,0 +1,89 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffSideStackedBar < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39]], + [:Charles, [80, 54, 67, 54]], + [:Julie, [22, 29, 35, 38]], + #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]], + #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]], + #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]], + ] + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24' + } + + end + + def test_bar_graph + g = Gruff::SideStackedBar.new + g.title = "Visual Stacked Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/side_stacked_bar_keynote.png" + end + + + def test_bar_graph_small + g = Gruff::SideStackedBar.new(400) + g.title = "Visual Stacked Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/side_stacked_bar_keynote_small.png" + end + + def test_wide + g = setup_basic_graph('800x400') + g.title = "Wide SSBar" + g.write "test/output/side_stacked_bar_wide.png" + end + + def test_should_space_long_left_labels_appropriately + g = Gruff::SideStackedBar.new + g.title = "Stacked Bar Long Label" + g.labels = { + 0 => 'September', + 1 => 'Oct', + 2 => 'Nov', + 3 => 'Dec', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/side_stacked_bar_long_label.png" + end + +protected + + def setup_basic_graph(size=800) + g = Gruff::SideStackedBar.new(size) + g.title = "My Graph Title" + g.labels = @sample_labels + @datasets.each do |data| + g.data(data[0], data[1]) + end + return g + end + +end + diff --git a/vendor/gruff-0.3.6/test/test_spider.rb b/vendor/gruff-0.3.6/test/test_spider.rb new file mode 100644 index 0000000..99dbb2d --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_spider.rb @@ -0,0 +1,216 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffSpider < GruffTestCase + + def setup + @datasets = [ + [:Strength, [10]], + [:Dexterity, [16]], + [:Constitution, [12]], + [:Intelligence, [12]], + [:Wisdom, [10]], + ["Charisma", [16]], + ] + +# @datasets = [ +# [:Darren, [25]], +# [:Chris, [80]], +# [:Egbert, [22]], +# [:Adam, [95]], +# [:Bill, [90]], +# ["Frank", [5]], +# ["Zero", [0]], +# ] + end + + def test_spider_graph + g = Gruff::Spider.new(20) + g.title = "Spider Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/spider_keynote.png") + end + + def test_pie_graph_small + g = Gruff::Spider.new(20, 400) + g.title = "Visual Spider Graph Test Small" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + # Default theme + g.write("test/output/spider_small.png") + end + + def test_spider_graph_nearly_equal + g = Gruff::Spider.new(50) + g.title = "Spider Graph Nearly Equal" + + g.data(:Blake, [41]) + g.data(:Aaron, [42]) + g.data(:Grouch, [40]) +# g.data(:Snuffleupagus, [43]) + + g.write("test/output/spider_nearly_equal.png") + end + + def test_pie_graph_equal + g = Gruff::Spider.new(50) + g.title = "Spider Graph Equal" + + g.data(:Bert, [41]) + g.data(:Adam, [41]) + g.data(:Joe, [41]) + + g.write("test/output/spider_equal.png") + end + + def test_pie_graph_zero + g = Gruff::Spider.new(2) + g.title = "Pie Graph Two One Zero" + + g.data(:Bert, [0]) + g.data(:Adam, [1]) + g.data(:Sam, [2]) + + g.write("test/output/spider_zero.png") + end + + def test_wide + g = setup_basic_graph('800x400') + g.title = "Wide spider" + g.write("test/output/spider_wide.png") + end + + def test_label_size + g = setup_basic_graph() + g.title = "Spider With Small Legend" + g.legend_font_size = 10 + g.write("test/output/spider_legend.png") + + g = setup_basic_graph(400) + g.title = "Small spider With Small Legend" + g.legend_font_size = 10 + g.write("test/output/spider_legend_small.png") + end + + def test_theme_37signals + g = Gruff::Spider.new(20) + g.title = "Spider Graph Test" + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.theme_37signals + + # Default theme + g.write("test/output/spider_37signals.png") + end + + def test_no_axes + g = Gruff::Spider.new(20) + g.title = "Look ma, no axes" + g.hide_axes = true + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/spider_no_axes.png") + + end + + def test_no_print + g = Gruff::Spider.new(20) + g.title = "Should not print" + g.hide_text = true + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/spider_no_print.png") + end + + def test_transparency + g = Gruff::Spider.new(20) + g.title = "Transparent background" + g.hide_text = true + g.transparent_background = true + g.hide_axes = true + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/spider_no_background.png") + end + + def test_overlay + g = Gruff::Spider.new(20) + g.title = "George (blue) vs Sarah (white)" + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write("test/output/spider_overlay_1.png") + + g = Gruff::Spider.new(20) + g.title = "Transparent background" + g.hide_text = true + g.hide_axes = true + g.transparent_background = true + @datasets = [ + [:Strength, [18]], + [:Dexterity, [10]], + [:Constitution, [18]], + [:Intelligence, [8]], + [:Wisdom, [14]], + ["Charisma", [4]], + ] + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.marker_color = "#4F6EFF" + g.write("test/output/spider_overlay_2.png") + end + + def test_lots_of_data + g = Gruff::Spider.new(10) + @datasets = [[:a, [1]], [:b, [5]], [:c, [3]], [:d, [9]], [:e, [4]], + [:f, [7]], [:g, [0]], [:h, [4]], [:i, [6]], [:j, [0]], + [:k, [4]], [:l, [8]]] + + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.title = "Sample Data" + g.write("test/output/spider_lots_of_data.png") + end + + def test_lots_of_data_with_large_names + g = Gruff::Spider.new(10) + @datasets = [[:anteaters, [1]], [:bulls, [5]], [:cats, [3]], [:dogs, [9]], [:elephants, [4]], + [:frogs, [7]], [:giraffes, [0]], [:hamsters, [4]], [:iguanas, [6]], + [:jaguar, [0]], [:kangaroo, [4]], [:locust, [8]]] + + @datasets.each do |data| + g.data(data[0], data[1]) + end + + g.title = "Zoo Inventory" + g.write("test/output/spider_lots_of_data_normal_names.png") + end + + +protected + + def setup_basic_graph(size=800, max = 20) + g = Gruff::Spider.new(max, size) + g.title = "My Graph Title" + @datasets.each do |data| + g.data(data[0], data[1]) + end + return g + end + +end diff --git a/vendor/gruff-0.3.6/test/test_stacked_area.rb b/vendor/gruff-0.3.6/test/test_stacked_area.rb new file mode 100644 index 0000000..ecff2e2 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_stacked_area.rb @@ -0,0 +1,52 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffStackedArea < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39]], + [:Charles, [80, 54, 67, 54]], + [:Julie, [22, 29, 35, 38]], + ] + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24' + } + + end + + def test_area_graph + g = Gruff::StackedArea.new + g.title = "Visual Stacked Area Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/stacked_area_keynote.png" + end + + + def test_area_graph_small + g = Gruff::StackedArea.new(400) + g.title = "Visual Stacked Area Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/stacked_area_keynote_small.png" + end + +end diff --git a/vendor/gruff-0.3.6/test/test_stacked_bar.rb b/vendor/gruff-0.3.6/test/test_stacked_bar.rb new file mode 100644 index 0000000..ab943d6 --- /dev/null +++ b/vendor/gruff-0.3.6/test/test_stacked_bar.rb @@ -0,0 +1,52 @@ +#!/usr/bin/ruby + +require File.dirname(__FILE__) + "/gruff_test_case" + +class TestGruffStackedBar < GruffTestCase + + def setup + @datasets = [ + [:Jimmy, [25, 36, 86, 39]], + [:Charles, [80, 54, 67, 54]], + [:Julie, [22, 29, 35, 38]], + ] + @sample_labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24' + } + + end + + def test_bar_graph + g = Gruff::StackedBar.new + g.title = "Visual Stacked Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/stacked_bar_keynote.png" + end + + + def test_bar_graph_small + g = Gruff::StackedBar.new(400) + g.title = "Visual Stacked Bar Graph Test" + g.labels = { + 0 => '5/6', + 1 => '5/15', + 2 => '5/24', + 3 => '5/30', + } + @datasets.each do |data| + g.data(data[0], data[1]) + end + g.write "test/output/stacked_bar_keynote_small.png" + end + +end diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/plugins/open_flash_chart/MIT-LICENSE b/vendor/plugins/open_flash_chart/MIT-LICENSE new file mode 100644 index 0000000..8eaf6db --- /dev/null +++ b/vendor/plugins/open_flash_chart/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 [name of plugin creator] + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/plugins/open_flash_chart/README b/vendor/plugins/open_flash_chart/README new file mode 100644 index 0000000..dbe988a --- /dev/null +++ b/vendor/plugins/open_flash_chart/README @@ -0,0 +1,54 @@ +OpenFlashChart Version 2.0.0 11/14/2008 +============== + +1) rails ofc2_test_app +2) cd ofc2_test_app +3) script/plugin install git://github.com/pullmonkey/open_flash_chart.git +3.1) If the install didn't copy the contents of the assets directory to your RAILS_ROOT/public directory, make sure to do so. +4) script/generate controller test_it + +5) Add the following to the test_it_controller.rb in RAILS_ROOT/app/controllers: +class TestItController < ApplicationController + + def index + respond_to do |wants| + wants.html { + @graph = open_flash_chart_object( 600, 300, url_for( :action => 'index', :format => :json ) ) + } + wants.json { + chart = OpenFlashChart.new( "MY TITLE" ) do |c| + c << BarGlass.new( :values => (1..10).sort_by{rand} ) + end + render :text => chart, :layout => false + } + end + end + +end + +6) Add the following to index.html.erb in RAILS_ROOT/app/views/test_it/: + + + + + +<%= @graph %> + + + +7) script/server +8) Let me know how it goes, thanks. + + +Example +======= + +Example above and more to follow here - http://www.pullmonkey.com/projects/open_flash_chart + +Notes +====== +The plugin breaks if the json gem is included, because of the way that the gem generates json vs the rails native json generator. + +Not tested, but klochner claims to have implemented a fix for it here - http://github.com/klochner/open_flash_chart/commit/00cf531387880af8c49ed5118737f0492b437f75 + +Copyright (c) 2008 PullMonkey, released under the MIT license diff --git a/vendor/plugins/open_flash_chart/Rakefile b/vendor/plugins/open_flash_chart/Rakefile new file mode 100644 index 0000000..5c1e249 --- /dev/null +++ b/vendor/plugins/open_flash_chart/Rakefile @@ -0,0 +1,22 @@ +require 'rake' +require 'rake/testtask' +require 'rake/rdoctask' + +desc 'Default: run unit tests.' +task :default => :test + +desc 'Test the open_flash_chart plugin.' +Rake::TestTask.new(:test) do |t| + t.libs << 'lib' + t.pattern = 'test/**/*_test.rb' + t.verbose = true +end + +desc 'Generate documentation for the open_flash_chart plugin.' +Rake::RDocTask.new(:rdoc) do |rdoc| + rdoc.rdoc_dir = 'rdoc' + rdoc.title = 'OpenFlashChart' + rdoc.options << '--line-numbers' << '--inline-source' + rdoc.rdoc_files.include('README') + rdoc.rdoc_files.include('lib/**/*.rb') +end diff --git a/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js b/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js new file mode 100644 index 0000000..08fb270 --- /dev/null +++ b/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js @@ -0,0 +1,5 @@ +/* SWFObject v2.1 + Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis + This software is released under the MIT License +*/ +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write(" + #{self.to_open_flash_chart_data(div_name)} +

+ OUTPUT + end + + def link_to_ofc_load(link_text, div_name) + data_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" + <<-OUTPUT + + #{ActionView::Base.new.link_to_function link_text, "load_#{data_name}()"} + OUTPUT + end + + def link_to_remote_ofc_load(link_text, div_name, url) + fx_name = "#{link_text.gsub(" ","_")}_#{div_name.gsub(" ","_")}" + <<-OUTPUT + + #{ActionView::Base.new.link_to_function link_text, "reload_#{fx_name}()"} + OUTPUT + end + + def periodically_call_to_remote_ofc_load(div_name, url, options={}) + fx_name = "#{div_name.gsub(" ","_")}" + # fix a bug in rails with url_for + url = url.gsub("&","&") + <<-OUTPUT + + #{periodically_call_function("reload_#{fx_name}()", options)} + OUTPUT + end + + def findSWF_method + <<-OUTPUT + function findSWF(movieName) { + if (navigator.appName.indexOf("Microsoft")!= -1) { + return window[movieName]; + } else { + return document[movieName]; + } + } + OUTPUT + end + + def to_open_flash_chart_data(id="in", options={}) + # this builds the open_flash_chart_data js function + <<-OUTPUT + + OUTPUT + end + + def save_as_image(post_url, options={}) + id = options[:id] || "in" + + <<-OUTPUT + + OUTPUT + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb new file mode 100644 index 0000000..d4637f8 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb @@ -0,0 +1,53 @@ +require 'digest/sha1' + +module OpenFlashChart + module Controller + def open_flash_chart_object(width, height, url, use_swfobject=true, base="/", swf_file_name="open-flash-chart.swf") + get_object_values(url) + get_html(@ofc_url, @div_name, base, swf_file_name, width, height, @protocol, @obj_id) + end + + # if you want the div name back for working with js, this is the ticket + def open_flash_chart_object_and_div_name(width, height, url, use_swfobject=true, base="/", swf_file_name="open-flash-chart.swf") + get_object_values(url) + html = get_html(@ofc_url, @div_name, base, swf_file_name, width, height, @protocol, @obj_id) + return [html, @div_name] + end + + def open_flash_chart_object_from_hash(url, options={}) + get_object_values(url) + get_html(@ofc_url, + options[:div_name] || @div_name, + options[:base] || "/", + options[:swf_file_name] || "open-flash-chart.swf", + options[:width] || 550, + options[:height] || 300, + options[:protocol] || @protocol, + options[:obj_id] || @obj_id) + end + + def get_object_values(url) + @ofc_url = CGI::escape(url) + # need something that will not be repeated on the same request + @special_hash = Base64.encode64(Digest::SHA1.digest("#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{@ofc_url}"))[0..7] + # only good characters for our div + @special_hash = @special_hash.gsub(/[^a-zA-Z0-9]/,rand(10).to_s) + @obj_id = "chart_#{@special_hash}" # some sequencing without all the work of tracking it + @div_name = "flash_content_#{@special_hash}" + @protocol = "http" # !request.nil? ? request.env["HTTPS"] || "http" : "http" + end + + def get_html(url, div_name, base, swf_file_name, width, height, protocol, obj_id) + # NOTE: users should put this in the section themselves: + ## + + <<-HTML +
+ + HTML + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb new file mode 100644 index 0000000..1ef5596 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb @@ -0,0 +1,75 @@ +module OpenFlashChart + + class PieValue < Base + def initialize(value, label, args={}) + super args + @value = value + @label = label + @animate = [] + end + + def set_label(label, label_color, font_size) + self.label = label + self.label_colour = label_color + self.font_size = font_size + end + + def on_click(event) + @on_click = event + end + + def add_animation animation + @animate ||= [] + @animate << animation + return self + end + end + + class BasePieAnimation < Base; end + + class PieFade < BasePieAnimation + def initialize args={} + @type = "fade" + super + end + end + + class PieBounce < BasePieAnimation + def initialize distance, args={} + @type = "bounce" + @distance = distance + super + end + end + + class Pie < Base + def initialize args={} + @type = "pie" + @colours = [] + super + end + + def set_animate bool + self.add_animation PieFade.new if bool + end + + def add_animation animation + @animate ||= [] + @animate << animation + return self + end + + def set_gradient_fill + @gradient_fill = true + end + + def set_no_labels + @no_labels = true + end + + def on_click(event) + @on_click = event + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb new file mode 100644 index 0000000..77a5886 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarAxis < Base + def initialize(max, args={}) + super args + @max = max + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb new file mode 100644 index 0000000..80990c1 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarAxisLabels < Base + def initialize(labels, args={}) + super args + @labels = labels + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb new file mode 100644 index 0000000..b7d795d --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class RadarSpokeLabels < Base + def initialize(labels, args={}) + super args + @labels = labels + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb new file mode 100644 index 0000000..abebaa4 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb @@ -0,0 +1,22 @@ +module OpenFlashChart + + class ScatterValue < Base + def initialize(x,y,dot_size=-1, args={}) + super args + @x = x + @y = y + @dot_size = dot_size if dot_size.to_i > 0 + end + end + + class Scatter < Base + def initialize(colour, dot_style=nil, args={}) + @type = "scatter" + @colour = colour + @dot_style = dot_style + @values = [] + super args + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb new file mode 100644 index 0000000..3b2e8ac --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb @@ -0,0 +1,20 @@ +module OpenFlashChart + + class ScatterLine < Base + def initialize(colour, width, args={}) + super args + @type = 'scatter_line' + @colour = colour + @width = width + end + + def set_step_horizonal + @stepgraph = 'horizontal' + end + + def set_step_vertical + @stepgraph = 'vertical' + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb new file mode 100644 index 0000000..27981cf --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb @@ -0,0 +1,20 @@ +module OpenFlashChart + + class ShapePoint < Base + def initialize(x, y, args={}) + super args + @x = x + @y = y + end + end + + class Shape < Base + def initialize(colour, args={}) + @type = "shape" + @colour = colour + @values = [] + super args + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb new file mode 100644 index 0000000..0ff74a8 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb @@ -0,0 +1,27 @@ +module OpenFlashChart + class SStar < Star + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + end + end + + class SBox < Anchor + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + @sides = 4 + @rotation = 45 + end + end + + class SHollowDot < HollowDot + def initialize(colour, size, args={}) + super args + @colour = colour + @size = size + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb new file mode 100644 index 0000000..deda838 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb @@ -0,0 +1,62 @@ +module OpenFlashChart + class OFCTags < Base + def initialize args={} + super args + @type = 'tags' + @values = [] + end + + def font(font, size) + @font = font + @font_size = size + end + + def padding(x,y) + @pad_x = x + @pad_y = y + end + + def align_x_center + @align_x = "center" + end + + def align_x_left + @align_x = "left" + end + + def align_x_right + @align_x = "right" + end + + def align_y_above + @align_y = "above" + end + + def align_y_below + @align_y = "below" + end + + def align_y_center + @align_y = "center" + end + + def style(bold, underline, border, alpha) + @bold = bold + @border = border + @underline = underline + @alpha = alpha + end + + def append_tag(tag) + @values << tag + end + end + + class OFCTag < Base + def initialize(x,y, args={}) + super args + @x = x + @y = y + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb new file mode 100644 index 0000000..41346d8 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class Title < Base + def initialize(text='', args = {}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb new file mode 100644 index 0000000..0d7239c --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb @@ -0,0 +1,25 @@ +module OpenFlashChart + + class Tooltip < Base + def set_body_style(style) + @body = style + end + + def set_title_style(style) + @title = style + end + + def set_background_colour(bg) + @background = bg + end + + def set_proximity + @mouse = 1 + end + + def set_hover + @mouse = 2 + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb @@ -0,0 +1 @@ +# TODO diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb new file mode 100644 index 0000000..7c28931 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb @@ -0,0 +1,18 @@ +module OpenFlashChart + + class XAxis < Base + def set_3d(v) + @threed = v + end + # for some reason the json that needs to be produced is like this: + # "x_axis": { "offset": false, "labels": { "labels": [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ] } } + # note the "labels":{"labels": ....} + def set_labels(labels) + @labels = labels + @labels = {:labels => labels} unless labels.is_a?(XAxisLabels) + end + + alias_method :labels=, :set_labels + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb new file mode 100644 index 0000000..c4837b9 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb @@ -0,0 +1,21 @@ +module OpenFlashChart + + class XAxisLabel < Base + def initialize(text, colour, size, rotate, args={}) + super args + @text = text + @colour = colour + @size = size + @rotate = rotate + end + + def set_vertical + @rotate = "vertical" + end + + def set_visible + @visible = true + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb new file mode 100644 index 0000000..ef180af --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb @@ -0,0 +1,9 @@ +module OpenFlashChart + + class XAxisLabels < Base + def set_vertical + @rotate = 270 + end + end + +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb new file mode 100644 index 0000000..596b7b5 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class XLegend < Base + def initialize(text, args={}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb new file mode 100644 index 0000000..865d7e9 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb @@ -0,0 +1,3 @@ +module OpenFlashChart + class YAxis < YAxisBase ; end +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb new file mode 100644 index 0000000..f1097ac --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + class YAxisBase < Base + def set_vertical + @rotate = "vertical" + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb new file mode 100644 index 0000000..6ea2a08 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb @@ -0,0 +1,12 @@ +module OpenFlashChart + class YAxisLabel < Base + def initialize(y, text) + @y = y + @text = text + end + + def set_vertical + @rotate = "vertical" + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb new file mode 100644 index 0000000..ecf6713 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb @@ -0,0 +1,7 @@ +module OpenFlashChart + class YAxisLabels < Base + def set_vertical + @rotate = 270 + end + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb new file mode 100644 index 0000000..66a431e --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb @@ -0,0 +1,4 @@ +module OpenFlashChart + class YAxisRight < YAxisBase + end +end diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb new file mode 100644 index 0000000..c705321 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb @@ -0,0 +1,10 @@ +module OpenFlashChart + + class YLegend < Base + def initialize(text = '', args={}) + super args + @text = text + end + end + +end \ No newline at end of file diff --git a/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb new file mode 100644 index 0000000..ce25801 --- /dev/null +++ b/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb @@ -0,0 +1,6 @@ +module OpenFlashChart + + class YLegendRight < YLegend + end + +end diff --git a/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake b/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake new file mode 100644 index 0000000..7308f8c --- /dev/null +++ b/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :open_flash_chart do +# # Task goes here +# end diff --git a/vendor/plugins/open_flash_chart/test/open_flash_chart_test.rb b/vendor/plugins/open_flash_chart/test/open_flash_chart_test.rb new file mode 100644 index 0000000..15efe3a --- /dev/null +++ b/vendor/plugins/open_flash_chart/test/open_flash_chart_test.rb @@ -0,0 +1,8 @@ +require 'test/unit' + +class OpenFlashChartTest < Test::Unit::TestCase + # Replace this with your real tests. + def test_this_plugin + flunk + end +end diff --git a/vendor/plugins/open_flash_chart/uninstall.rb b/vendor/plugins/open_flash_chart/uninstall.rb new file mode 100644 index 0000000..9738333 --- /dev/null +++ b/vendor/plugins/open_flash_chart/uninstall.rb @@ -0,0 +1 @@ +# Uninstall hook code here