From 3826983b48bdd9243894bf4da18cff17b6ff00ee Mon Sep 17 00:00:00 2001 From: Ed Lenox Date: Thu, 9 Oct 2014 15:25:00 +0100 Subject: [PATCH 1/3] added a job delete button --- app/views/jobs/edit.html.erb | 13 ++++++++++++- spec/features/job_spec.rb | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 spec/features/job_spec.rb diff --git a/app/views/jobs/edit.html.erb b/app/views/jobs/edit.html.erb index 9f54d9170..a9f8b74ea 100644 --- a/app/views/jobs/edit.html.erb +++ b/app/views/jobs/edit.html.erb @@ -9,4 +9,15 @@

<%= form.submit "Update Job >>" %>

-<% end %> \ No newline at end of file +<% end %> + +<%= form_for(@job, method: "delete", html: {:onsubmit => "return confirm('Are you sure?');" }) do |form| %> + <%= hidden_field_tag :key, @job.key %> + +

+ <%= form.submit "Delete Job" %> +

+ + +<% end %> + diff --git a/spec/features/job_spec.rb b/spec/features/job_spec.rb new file mode 100644 index 000000000..ec8188edb --- /dev/null +++ b/spec/features/job_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +describe 'viewing jobs' do + before do + visit '/jobs' + end + + it 'should have a text' do + page.should have_text('The latest Ruby jobs in Ireland') + end +end + + +describe 'editing a job' do + before do + job = create :job + visit "/jobs/#{job.id}/edit?key=#{job.key}" + end + + it 'should have a text' do + page.should have_selector("input[type=submit][value='Delete Job']") + end + +end From 8c7302f542367bbb363527d2922e36117852ed59 Mon Sep 17 00:00:00 2001 From: vicqstream Date: Tue, 10 May 2016 16:16:11 -0700 Subject: [PATCH 2/3] update travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac272ad1f..7bd73ef86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: ruby rvm: - - 1.9.3 + - 2.2.3 before_install: - "export DISPLAY=:99.0" - "bundle install" @@ -8,4 +8,4 @@ before_install: - "bundle exec rspec spec" env: global: - - DISPLAY=:99.0 \ No newline at end of file + - DISPLAY=:99.0 From f0b20dbdd548ae9bdaa52657969c051abb4fe7f8 Mon Sep 17 00:00:00 2001 From: vicqstream Date: Tue, 10 May 2016 17:01:52 -0700 Subject: [PATCH 3/3] add test-unit to Gemfile --- Gemfile | 1 + Gemfile.lock | 113 +++++++++++++---------- app/controllers/jobs_controller.rb | 1 + config/database.yml | 2 +- spec/controllers/jobs_controller_spec.rb | 1 - spec/spec_helper.rb | 2 +- 6 files changed, 67 insertions(+), 53 deletions(-) diff --git a/Gemfile b/Gemfile index 63ded947a..0cddf62bc 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ group :production do end group :test do + gem 'test-unit' gem 'shoulda-matchers' end diff --git a/Gemfile.lock b/Gemfile.lock index 4c2ccfa2c..94f14149e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -29,9 +29,11 @@ GEM activesupport (3.2.21) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) + addressable (2.4.0) arel (3.0.3) builder (3.0.4) - capybara (2.1.0) + capybara (2.7.1) + addressable mime-types (>= 1.16) nokogiri (>= 1.3.3) rack (>= 1.0.0) @@ -40,23 +42,24 @@ GEM coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) - coffee-script (2.2.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.6.3) - coveralls (0.6.9) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - daemons (1.1.9) - diff-lcs (1.2.4) + coffee-script-source (1.10.0) + coveralls (0.8.13) + json (~> 1.8) + simplecov (~> 0.11.0) + term-ansicolor (~> 1.3) + thor (~> 0.19.1) + tins (~> 1.6.0) + daemons (1.2.3) + diff-lcs (1.2.5) + docile (1.1.5) dynamic_form (1.1.4) erubis (2.7.0) - eventmachine (1.0.8) - execjs (2.0.1) - factory_girl (4.2.0) + eventmachine (1.2.0.1) + execjs (2.6.0) + factory_girl (4.7.0) activesupport (>= 3.0.0) hike (1.2.3) i18n (0.7.0) @@ -65,19 +68,19 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.3) - mail (2.4.4) - i18n (>= 0.4.0) + mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.25.1) - mini_portile (0.5.1) - multi_json (1.11.0) - nokogiri (1.6.0) - mini_portile (~> 0.5.0) + mini_portile2 (2.0.0) + multi_json (1.12.0) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) pg (0.15.1) polyglot (0.3.5) - rack (1.4.5) - rack-cache (1.2) + power_assert (0.2.6) + rack (1.4.7) + rack-cache (1.6.1) rack (>= 0.4) rack-ssl (1.3.4) rack @@ -98,57 +101,63 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.4.2) + rake (11.1.2) rdoc (3.12.2) json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec-core (2.14.5) - rspec-expectations (2.14.2) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.3) - rspec-rails (2.14.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - sass (3.2.10) + rspec-core (3.4.4) + rspec-support (~> 3.4.0) + rspec-expectations (3.4.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-mocks (3.4.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.4.0) + rspec-rails (3.4.2) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.4.0) + rspec-expectations (~> 3.4.0) + rspec-mocks (~> 3.4.0) + rspec-support (~> 3.4.0) + rspec-support (3.4.1) + sass (3.4.22) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - scoped_search (2.6.0) + scoped_search (2.6.5) activerecord (>= 2.1.0) - shoulda-matchers (2.3.0) + shoulda-matchers (2.8.0) activesupport (>= 3.0.0) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) + simplecov (0.11.2) + docile (~> 1.1.0) + json (~> 1.8) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.11) - term-ansicolor (1.2.2) - tins (~> 0.8) + term-ansicolor (1.3.2) + tins (~> 1.0) + test-unit (3.1.5) + power_assert thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.19.1) tilt (1.4.1) - tins (0.9.0) + tins (1.6.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.43) - uglifier (2.2.1) - execjs (>= 0.3.0) - multi_json (~> 1.0, >= 1.0.2) + tzinfo (0.3.49) + uglifier (3.0.0) + execjs (>= 0.3.0, < 3) xpath (2.0.0) nokogiri (~> 1.3) @@ -170,5 +179,9 @@ DEPENDENCIES scoped_search (~> 2.6.0) shoulda-matchers sqlite3 + test-unit thin (~> 1.5.0) uglifier (>= 1.3.0) + +BUNDLED WITH + 1.11.2 diff --git a/app/controllers/jobs_controller.rb b/app/controllers/jobs_controller.rb index 213bb315f..2893cdca2 100644 --- a/app/controllers/jobs_controller.rb +++ b/app/controllers/jobs_controller.rb @@ -31,6 +31,7 @@ def new end def edit + puts params.inspect @job = find_job_with_key unless @job.present? redirect_not_found diff --git a/config/database.yml b/config/database.yml index b1394845b..29cc2b2f0 100644 --- a/config/database.yml +++ b/config/database.yml @@ -8,4 +8,4 @@ test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 - timeout: 5000 \ No newline at end of file + timeout: 5000 diff --git a/spec/controllers/jobs_controller_spec.rb b/spec/controllers/jobs_controller_spec.rb index 12834f544..eaaad7b6f 100644 --- a/spec/controllers/jobs_controller_spec.rb +++ b/spec/controllers/jobs_controller_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' describe JobsController do - integrate_views describe "the index action" do before do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b5e726f39..b121309a8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -21,7 +21,7 @@ config.use_transactional_fixtures = true config.infer_base_class_for_anonymous_controllers = false config.order = "random" - config.color_enabled = true + #config.color_enabled = true config.formatter = 'documentation' config.include FactoryGirl::Syntax::Methods