diff options
| author | Luc Donnet | 2012-02-13 11:22:42 +0100 |
|---|---|---|
| committer | Luc Donnet | 2012-02-13 11:22:42 +0100 |
| commit | befb5afa0ffa88ebced3b9db8f69091f0dcaee3b (patch) | |
| tree | daae4d74f7ebfd34e999e4fa995fe72098bc59fa | |
| parent | a4eeeeaa4b7b199e5b4e41c61c33e5a56fccc823 (diff) | |
| download | chouette-core-befb5afa0ffa88ebced3b9db8f69091f0dcaee3b.tar.bz2 | |
Add referential model and gem apartment
42 files changed, 519 insertions, 63 deletions
@@ -0,0 +1 @@ +--colour @@ -3,17 +3,21 @@ source 'http://rubygems.org' gem 'rails', '3.1.3' # Bundle edge Rails instead: -# gem 'rails', :git => 'git://github.com/rails/rails.git' +# gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'user_interface', :path => '~/projects/user_interface' #gem 'user_interface', :git => 'git://sim.dryade.priv/user_interface' +gem 'apartment', :path => '~/projects/apartment' + platforms :jruby do + gem 'activerecord-jdbcpostgresql-adapter', :git => 'git://github.com/dryade/activerecord-jdbc-adapter.git' gem 'activerecord-jdbcsqlite3-adapter' gem 'jruby-openssl' end platforms :ruby do + gem 'pg', '~> 0.11.0' gem 'sqlite3' end @@ -25,7 +29,7 @@ gem 'warbler' group :assets do gem 'sass-rails', '~> 3.1.5' gem 'coffee-rails', '~> 3.1.1' - gem 'coffee-script-source' + #gem 'coffee-script-source' gem 'uglifier', '>= 1.0.3' end @@ -45,7 +49,36 @@ gem 'jquery-rails' gem 'formtastic' gem 'inherited_resources' -gem 'activerecord-jdbcpostgresql-adapter' gem 'chouette-ninoxe', :git => 'git://chouette.dryade.priv/ninoxe' +group :development do +# gem 'less' + gem 'autotest-rails' + gem 'autotest-notification' + gem 'capistrano' + gem 'capistrano-ext' +end + +group :test, :development, :cucumber do + gem "rspec" + gem "rspec-rails" + gem "remarkable", "~> 4.0.0.alpha4" + gem "remarkable_activerecord", "~> 4.0.0.alpha4" + gem "shoulda", :git => 'git://github.com/thoughtbot/shoulda.git' +end + +group :cucumber do + gem 'capybara' + gem 'cucumber' + gem 'cucumber-rails' + gem 'launchy' + gem 'pickle', :git => 'git://github.com/mflorisson/pickle.git' +end + +group :test, :cucumber do + gem 'database_cleaner' + gem 'factory_girl_rails' + gem 'factory_girl' +end + diff --git a/Gemfile.lock b/Gemfile.lock index 70f7761d6..a38e4f514 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,6 +8,42 @@ GIT composite_primary_keys geokit +GIT + remote: git://github.com/mflorisson/pickle.git + revision: 4316faa3ef00c414bf286336c57a6d10addcf79f + specs: + pickle (0.4.4) + cucumber (>= 0.8) + rake + rspec (>= 1.3) + yard + +GIT + remote: git://github.com/thoughtbot/shoulda.git + revision: 80545637b957fc68a3b7be8993033d089913ac66 + specs: + shoulda (3.0.0.beta2) + shoulda-context (~> 1.0.0.beta1) + shoulda-matchers (~> 1.0.0.beta1) + +PATH + remote: /home/luc/projects/activerecord-jdbc-adapter + specs: + activerecord-jdbc-adapter (1.2.2) + activerecord-jdbcpostgresql-adapter (1.2.2) + activerecord-jdbc-adapter (~> 1.2.2) + jdbc-postgres (>= 9.0, < 9.2) + activerecord-jdbcsqlite3-adapter (1.2.2) + activerecord-jdbc-adapter (~> 1.2.2) + jdbc-sqlite3 (~> 3.7.2) + jdbc-postgres (9.1.901) + jdbc-sqlite3 (3.7.2) + +PATH + remote: ~/projects/apartment + specs: + apartment (0.14.1) + PATH remote: ~/projects/user_interface specs: @@ -18,6 +54,7 @@ GEM remote: http://rubygems.org/ specs: GeoRuby (1.3.4) + ZenTest (4.5.0) actionmailer (3.1.3) actionpack (= 3.1.3) mail (~> 2.3.0) @@ -41,21 +78,37 @@ GEM activesupport (= 3.1.3) arel (~> 2.2.1) tzinfo (~> 0.3.29) - activerecord-jdbc-adapter (1.2.1) - activerecord-jdbcpostgresql-adapter (1.2.1) - activerecord-jdbc-adapter (~> 1.2.1) - jdbc-postgres (~> 9.0.0) - activerecord-jdbcsqlite3-adapter (1.2.1) - activerecord-jdbc-adapter (~> 1.2.1) - jdbc-sqlite3 (~> 3.7.2) activeresource (3.1.3) activemodel (= 3.1.3) activesupport (= 3.1.3) activesupport (3.1.3) multi_json (~> 1.0) + addressable (2.2.6) arel (2.2.1) + autotest-notification (2.3.4) + autotest-standalone (~> 4.5) + autotest-rails (4.1.1) + ZenTest (= 4.5) + autotest-standalone (4.5.9) bouncy-castle-java (1.5.0146.1) builder (3.0.0) + capistrano (2.9.0) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) + capistrano-ext (1.2.1) + capistrano (>= 1.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.0) + ffi (~> 1.0.6) coffee-rails (3.1.1) coffee-script (>= 2.2.0) railties (~> 3.1.0) @@ -65,20 +118,42 @@ GEM coffee-script-source (1.1.2) composite_primary_keys (4.1.1) activerecord (~> 3.1) + cucumber (1.1.4) + builder (>= 2.1.2) + diff-lcs (>= 1.1.2) + gherkin (~> 2.7.1) + json (>= 1.4.6) + term-ansicolor (>= 1.0.6) + cucumber-rails (1.2.1) + capybara (>= 1.1.2) + cucumber (>= 1.1.3) + nokogiri (>= 1.5.0) + database_cleaner (0.7.1) + diff-lcs (1.1.3) erubis (2.7.0) execjs (1.2.13) multi_json (~> 1.0) + factory_girl (2.5.0) + activesupport + factory_girl_rails (1.6.0) + factory_girl (~> 2.5.0) + railties (>= 3.0.0) + ffi (1.0.11) + ffi (1.0.11-java) formtastic (2.0.2) rails (~> 3.0) geokit (1.6.0) + gherkin (2.7.6) + json (>= 1.4.6) + gherkin (2.7.6-java) + json (>= 1.4.6) has_scope (0.5.1) + highline (1.6.11) hike (1.2.1) i18n (0.6.0) inherited_resources (1.3.0) has_scope (~> 0.5.0) responders (~> 0.6.0) - jdbc-postgres (9.0.801) - jdbc-sqlite3 (3.7.2) jquery-rails (1.0.19) railties (~> 3.0) thor (~> 0.14) @@ -88,12 +163,27 @@ GEM jruby-rack (1.1.2) json (1.6.4) json (1.6.4-java) + launchy (2.0.5) + addressable (~> 2.2.6) + launchy (2.0.5-java) + addressable (~> 2.2.6) + ffi (~> 1.0.9) + spoon (~> 0.0.1) mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.17.2) multi_json (1.0.4) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-sftp (2.0.5) + net-ssh (>= 2.0.9) + net-ssh (2.3.0) + net-ssh-gateway (1.1.0) + net-ssh (>= 1.99.1) + nokogiri (1.5.0) + nokogiri (1.5.0-java) polyglot (0.3.3) rack (1.3.6) rack-cache (1.1) @@ -122,7 +212,29 @@ GEM rake (0.9.2.2) rdoc (3.12) json (~> 1.4) + remarkable (4.0.0.alpha4) + rspec (>= 2.0.0.alpha11) + remarkable_activemodel (4.0.0.alpha4) + remarkable (~> 4.0.0.alpha4) + rspec (>= 2.0.0.alpha11) + remarkable_activerecord (4.0.0.alpha4) + remarkable (~> 4.0.0.alpha4) + remarkable_activemodel (~> 4.0.0.alpha4) + rspec (>= 2.0.0.alpha11) responders (0.6.4) + rspec (2.8.0) + rspec-core (~> 2.8.0) + rspec-expectations (~> 2.8.0) + rspec-mocks (~> 2.8.0) + rspec-core (2.8.0) + rspec-expectations (2.8.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.8.0) + rspec-rails (2.8.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.8.0) rubyzip (0.9.5) sass (3.1.12) sass-rails (3.1.5) @@ -130,11 +242,20 @@ GEM railties (~> 3.1.0) sass (~> 3.1.10) tilt (~> 1.3.2) + selenium-webdriver (2.17.0) + childprocess (>= 0.2.5) + ffi (~> 1.0.9) + multi_json (~> 1.0.4) + rubyzip + shoulda-context (1.0.0) + shoulda-matchers (1.0.0) + spoon (0.0.1) sprockets (2.0.3) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.5) + term-ansicolor (1.0.7) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) @@ -149,24 +270,45 @@ GEM jruby-rack (>= 1.0.0) rake (>= 0.8.7) rubyzip (>= 0.9.4) + xpath (0.1.4) + nokogiri (~> 1.3) + yard (0.7.4) PLATFORMS java ruby DEPENDENCIES - activerecord-jdbcpostgresql-adapter + activerecord-jdbcpostgresql-adapter! activerecord-jdbcsqlite3-adapter + apartment! + autotest-notification + autotest-rails + capistrano + capistrano-ext + capybara chouette-ninoxe! coffee-rails (~> 3.1.1) - coffee-script-source + cucumber + cucumber-rails + database_cleaner + factory_girl + factory_girl_rails formtastic inherited_resources jquery-rails jruby-openssl json + launchy + pg (~> 0.11.0) + pickle! rails (= 3.1.3) + remarkable (~> 4.0.0.alpha4) + remarkable_activerecord (~> 4.0.0.alpha4) + rspec + rspec-rails sass-rails (~> 3.1.5) + shoulda! sqlite3 uglifier (>= 1.0.3) user_interface! diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb new file mode 100644 index 000000000..a65af2e9a --- /dev/null +++ b/app/controllers/referentials_controller.rb @@ -0,0 +1,2 @@ +class ReferentialsController < InheritedResources::Base +end diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb new file mode 100644 index 000000000..73384bef6 --- /dev/null +++ b/app/helpers/referentials_helper.rb @@ -0,0 +1,2 @@ +module ReferentialsHelper +end diff --git a/app/models/referential.rb b/app/models/referential.rb new file mode 100644 index 000000000..36f3df100 --- /dev/null +++ b/app/models/referential.rb @@ -0,0 +1,6 @@ +class Referential < ActiveRecord::Base + validates_presence_of :name + validates_presence_of :slug + + +end diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index b716705ad..50932fef6 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -1,4 +1,4 @@ -<%= title_tag "Ligne #{@line.name}" %> +<%= title_tag @line.name %> <div class="line_show"> diff --git a/app/views/referentials/_form.erb b/app/views/referentials/_form.erb new file mode 100644 index 000000000..031621b00 --- /dev/null +++ b/app/views/referentials/_form.erb @@ -0,0 +1,12 @@ +<%= semantic_form_for @referential do |form| %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :slug%> + <% end %> + + <%= form.buttons do %> + <%= form.commit_button true %> + <li><%= t('or') %></li> + <li><%= link_to t('back'), :back %></li> + <% end %> +<% end %> diff --git a/app/views/referentials/edit.html.erb b/app/views/referentials/edit.html.erb new file mode 100644 index 000000000..e6027b4b5 --- /dev/null +++ b/app/views/referentials/edit.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t(".title") %> + +<%= render "form" %> diff --git a/app/views/referentials/new.html.erb b/app/views/referentials/new.html.erb new file mode 100644 index 000000000..e6027b4b5 --- /dev/null +++ b/app/views/referentials/new.html.erb @@ -0,0 +1,3 @@ +<%= title_tag t(".title") %> + +<%= render "form" %> diff --git a/app/views/referentials/show.html.erb b/app/views/referentials/show.html.erb new file mode 100644 index 000000000..9fad647bc --- /dev/null +++ b/app/views/referentials/show.html.erb @@ -0,0 +1,8 @@ +<%= title_tag t('.title', :title => @referential.name) %> + +<div> + <p> + <label><%= Referential.human_attribute_name("slug") %>: </label> + <%= @referential.slug %> + </p> +</div>
\ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 07b94ace7..8c7e93062 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,6 +11,11 @@ end module ChouetteIhm class Application < Rails::Application + + config.generators do |g| + g.test_framework :rspec + end + # 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. diff --git a/config/initializers/apartment.rb b/config/initializers/apartment.rb new file mode 100644 index 000000000..d51724a04 --- /dev/null +++ b/config/initializers/apartment.rb @@ -0,0 +1,4 @@ +Apartment.configure do |config| + # set your options (described below) here + config.excluded_models = ["Referential"] # these models will not be multi-tenanted, but remain in the global (public) namespace +end
\ No newline at end of file diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml new file mode 100644 index 000000000..624dba689 --- /dev/null +++ b/config/locales/referentials.yml @@ -0,0 +1,21 @@ +fr: + referentials: + edit: + title: "Modifier le référentiel" + show: + title: Référentiel + new: + title: Créer une nouveau référentiel + submit: "Créer un référentiel" + actions: + new: Ajouter une référentiel + destroy_confirm: "Etes vous sûr de vouloir supprimer le référentiel ?" + destroy: Supprimer + edit: Modifier + activerecord: + models: + referential: Référentiel + attributes: + referential: + name: Nom + slug: Code diff --git a/config/routes.rb b/config/routes.rb index 53fcaae98..81dd47560 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,6 +13,7 @@ ChouetteIhm::Application.routes.draw do # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products resources :lines + resources :referentials # Sample resource route with options: # resources :products do @@ -49,7 +50,7 @@ ChouetteIhm::Application.routes.draw do # You can have the root of your site routed with "root" # just remember to delete public/index.html. - root :to => 'welcome#index' + root :to => 'lines#index' # See how all your routes lay out with "rake routes" diff --git a/db/migrate/20120126110946_create_referentials.rb b/db/migrate/20120126110946_create_referentials.rb new file mode 100644 index 000000000..64af40135 --- /dev/null +++ b/db/migrate/20120126110946_create_referentials.rb @@ -0,0 +1,10 @@ +class CreateReferentials < ActiveRecord::Migration + def change + create_table :referentials do |t| + t.string :name + t.string :slug + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 000000000..2740b6590 --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,22 @@ +# 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 => 20120126110946) do + + create_table "referentials", :force => true do |t| + t.string "name" + t.string "slug" + t.datetime "created_at" + t.datetime "updated_at" + end + +end diff --git a/spec/controllers/referentials_controller_spec.rb b/spec/controllers/referentials_controller_spec.rb new file mode 100644 index 000000000..eba195a1f --- /dev/null +++ b/spec/controllers/referentials_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe ReferentialsController do + +end diff --git a/spec/factories/chouette_lines.rb b/spec/factories/chouette_lines.rb new file mode 100644 index 000000000..913b88538 --- /dev/null +++ b/spec/factories/chouette_lines.rb @@ -0,0 +1,4 @@ +Factory.define :chouette_line, :class => "Chouette::Line" do |f| + f.sequence(:name) { |n| "Line #{n}" } + f.objectid +end
\ No newline at end of file diff --git a/spec/factories/chouette_stop_areas.rb b/spec/factories/chouette_stop_areas.rb new file mode 100644 index 000000000..315b84679 --- /dev/null +++ b/spec/factories/chouette_stop_areas.rb @@ -0,0 +1,7 @@ +Factory.define :chouette_stop_area, :class => "Chouette::StopArea" do |f| + f.latitude 10 * rand + f.longitude 10 * rand + f.sequence(:name) { |n| "StopArea #{n}" } + f.areatype "CommercialStopPoint" + f.objectid +end
\ No newline at end of file diff --git a/spec/factories/referential.rb b/spec/factories/referential.rb new file mode 100644 index 000000000..4bdacb8c7 --- /dev/null +++ b/spec/factories/referential.rb @@ -0,0 +1,4 @@ +Factory.define :referential, :class => "Referential" do |f| + f.sequence(:name) { |n| "Referential #{n}" } + f.sequence(:slug) { |n| "referential_#{n}" } +end
\ No newline at end of file diff --git a/spec/helpers/referentials_helper_spec.rb b/spec/helpers/referentials_helper_spec.rb new file mode 100644 index 000000000..883116983 --- /dev/null +++ b/spec/helpers/referentials_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ReferentialsHelper. For example: +# +# describe ReferentialsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# helper.concat_strings("this","that").should == "this that" +# end +# end +# end +describe ReferentialsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb new file mode 100644 index 000000000..363fe237f --- /dev/null +++ b/spec/models/referential_spec.rb @@ -0,0 +1,8 @@ +require 'spec_helper' + +describe Referential do + + it { should validate_presence_of(:name) } + it { should validate_presence_of(:slug) } + +end
\ No newline at end of file diff --git a/spec/requests/referentials_spec.rb b/spec/requests/referentials_spec.rb new file mode 100644 index 000000000..1fcd4f8a3 --- /dev/null +++ b/spec/requests/referentials_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe "Referentials" do + + # describe "create" do + # get new_referential_path + # fill_in "Nom", :with => "Test" + # fill_in "Slug", :with => "test" + # click_button "Créer" + + # Referential.where(:name => "Test").should_not be_nil + # end + +end
\ No newline at end of file diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 000000000..e66d9802c --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,32 @@ +# 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' + +# 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 diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb new file mode 100644 index 000000000..f889410ee --- /dev/null +++ b/spec/views/lines/edit.html.erb_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe "/lines/edit" do + let!(:network) { assign(:network, Factory(:network)) } + let!(:line) { assign(:line, Factory(:line, :network => network)) } + let!(:lines) { Array.new(2) { Factory(:line, :network => network) } } + + describe "test" do + it "should render h2 with the group name" do + render + rendered.should have_selector("h2", :text => Regexp.new(line.name)) + end + end + + describe "form" do + it "should render input for name" do + render + rendered.should have_selector("form") do + with_tag "input[type=text][name='line[name]'][value=?]", line.name + end + end + + it "should render a checkbox for each line" do + render + lines.each do |line| + rendered.should have_selector("form") do + with_tag "input[type='checkbox'][value=?]", line.id + end + end + + end + end +end diff --git a/spec/views/lines/index.html.erb_spec.rb b/spec/views/lines/index.html.erb_spec.rb new file mode 100644 index 000000000..dee3565f4 --- /dev/null +++ b/spec/views/lines/index.html.erb_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe "/lines/index" do + + let!(:network) { assign( :network, Factory(:network) ) } + let!(:lines) { assign( :lines, Array.new(2) { Factory(:line, :network => network) } ) } + + before :each do + rendered.stub(:collection).and_return( lines.order_by [[:code, :asc]] ) + view.stub(:link_to_order).and_return( "#" ) + end + + it "should render a show link for each group" do + render + lines.each do |line| + rendered.should have_selector(".line a[href='#{view.line_path(line)}']", :text => line.name) + end + end + + it "should render a link to create a new group" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{new_network_line_path(network)}']") + end + +end diff --git a/spec/views/lines/new.html.erb_spec.rb b/spec/views/lines/new.html.erb_spec.rb new file mode 100644 index 000000000..b50f73356 --- /dev/null +++ b/spec/views/lines/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "/lines/new" do + let!(:network) { assign(:network, Factory(:network)) } + let!(:line) { assign(:line, Factory.build(:line, :network => network)) } + + describe "form" do + + it "should render input for name" do + render + rendered.should have_selector("form") do + with_selector "input[type=text][name=?]", line.name + end + end + + end +end diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb new file mode 100644 index 000000000..14f315333 --- /dev/null +++ b/spec/views/lines/show.html.erb_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe "/lines/show" do + + let!(:network) { assign(:network, Factory(:network)) } + let!(:line) { assign(:line, Factory(:line, :network => network)) } + let!(:map) { assign(:map, LineMap.new(line) ) } + + it "should render h2 with the line name" do + render + rendered.should have_selector("h2", :text => Regexp.new(line.name)) + end + + it "should display a map with class 'line'" do + render + rendered.should have_selector("#map", :class => 'line') + end + + it "should render a link to edit the line" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.edit_line_path(line)}']") + end + + it "should render a link to remove the line" do + render + view.content_for(:sidebar).should have_selector(".actions a[href='#{view.line_path(line)}'][class='remove']") + end + +end + diff --git a/spec/views/referentials/edit.html.erb_spec.rb b/spec/views/referentials/edit.html.erb_spec.rb new file mode 100644 index 000000000..3c2fbc5c3 --- /dev/null +++ b/spec/views/referentials/edit.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "referentials/edit.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/referentials/new.html.erb_spec.rb b/spec/views/referentials/new.html.erb_spec.rb new file mode 100644 index 000000000..dccd990cb --- /dev/null +++ b/spec/views/referentials/new.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "referentials/new.html.erb" do + + let!(:referential) { assign(:referential, Referential.new) } + + it "should have a textfield for name" do + render + rendered.should have_selector("input", :name => "referential[name]") + end + + it "should have a textfield for slug" do + render + rendered.should have_selector("input", :name => "referential[slug]") + end + +end diff --git a/spec/views/referentials/show.html.erb_spec.rb b/spec/views/referentials/show.html.erb_spec.rb new file mode 100644 index 000000000..2f3a64568 --- /dev/null +++ b/spec/views/referentials/show.html.erb_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "referentials/show.html.erb" do + let!(:referential) { assign(:referential, Factory(:referential)) } + + it "should have a title with name" do + render + puts render + rendered.should have_selector("h2", :text => Regexp.new(referential.name)) + end + +end diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep deleted file mode 100644 index e69de29bb..000000000 --- a/test/fixtures/.gitkeep +++ /dev/null diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep deleted file mode 100644 index e69de29bb..000000000 --- a/test/functional/.gitkeep +++ /dev/null diff --git a/test/functional/lines_controller_test.rb b/test/functional/lines_controller_test.rb deleted file mode 100644 index 7e8bfcd51..000000000 --- a/test/functional/lines_controller_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class LinesControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/functional/welcome_controller_test.rb b/test/functional/welcome_controller_test.rb deleted file mode 100644 index fb5085692..000000000 --- a/test/functional/welcome_controller_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class WelcomeControllerTest < ActionController::TestCase - # test "the truth" do - # assert true - # end -end diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep deleted file mode 100644 index e69de29bb..000000000 --- a/test/integration/.gitkeep +++ /dev/null diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb deleted file mode 100644 index 3fea27b91..000000000 --- a/test/performance/browsing_test.rb +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 8bf1192ff..000000000 --- a/test/test_helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index e69de29bb..000000000 --- a/test/unit/.gitkeep +++ /dev/null diff --git a/test/unit/helpers/lines_helper_test.rb b/test/unit/helpers/lines_helper_test.rb deleted file mode 100644 index f9353c9b7..000000000 --- a/test/unit/helpers/lines_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class LinesHelperTest < ActionView::TestCase -end diff --git a/test/unit/helpers/welcome_helper_test.rb b/test/unit/helpers/welcome_helper_test.rb deleted file mode 100644 index d6ded5995..000000000 --- a/test/unit/helpers/welcome_helper_test.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'test_helper' - -class WelcomeHelperTest < ActionView::TestCase -end |
