shoulda-matchers 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.gitignore +11 -0
  2. data/.travis.yml +13 -0
  3. data/Appraisals +4 -6
  4. data/CONTRIBUTING.md +38 -0
  5. data/Gemfile +8 -5
  6. data/Gemfile.lock +77 -41
  7. data/NEWS.md +32 -0
  8. data/README.md +84 -0
  9. data/Rakefile +5 -36
  10. data/features/rails_integration.feature +88 -0
  11. data/features/step_definitions/rails_steps.rb +111 -0
  12. data/features/support/env.rb +5 -0
  13. data/gemfiles/3.0.gemfile +14 -0
  14. data/gemfiles/3.0.gemfile.lock +142 -0
  15. data/gemfiles/3.1.gemfile +16 -0
  16. data/gemfiles/3.1.gemfile.lock +164 -0
  17. data/lib/shoulda/matchers/action_controller/assign_to_matcher.rb +6 -9
  18. data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +1 -3
  19. data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +10 -6
  20. data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +1 -4
  21. data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +6 -6
  22. data/lib/shoulda/matchers/action_controller/respond_with_content_type_matcher.rb +11 -10
  23. data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +0 -2
  24. data/lib/shoulda/matchers/action_controller/route_matcher.rb +17 -14
  25. data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +24 -16
  26. data/lib/shoulda/matchers/action_controller/set_the_flash_matcher.rb +52 -15
  27. data/lib/shoulda/matchers/action_mailer.rb +1 -1
  28. data/lib/shoulda/matchers/action_mailer/{have_sent_email.rb → have_sent_email_matcher.rb} +37 -21
  29. data/lib/shoulda/matchers/active_model.rb +1 -0
  30. data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +9 -10
  31. data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +60 -33
  32. data/lib/shoulda/matchers/active_model/ensure_length_of_matcher.rb +0 -1
  33. data/lib/shoulda/matchers/active_model/helpers.rb +13 -9
  34. data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +63 -0
  35. data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +38 -8
  36. data/lib/shoulda/matchers/active_model/validation_matcher.rb +1 -5
  37. data/lib/shoulda/matchers/active_record.rb +3 -1
  38. data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +127 -0
  39. data/lib/shoulda/matchers/active_record/association_matcher.rb +19 -7
  40. data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +20 -5
  41. data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +4 -10
  42. data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +3 -7
  43. data/lib/shoulda/matchers/active_record/query_the_database_matcher.rb +107 -0
  44. data/lib/shoulda/matchers/active_record/serialize_matcher.rb +111 -0
  45. data/lib/shoulda/matchers/integrations/rspec.rb +0 -1
  46. data/lib/shoulda/matchers/version.rb +1 -1
  47. data/shoulda-matchers.gemspec +30 -0
  48. data/spec/fixtures/addresses.yml +3 -0
  49. data/spec/fixtures/friendships.yml +0 -0
  50. data/spec/fixtures/posts.yml +5 -0
  51. data/spec/fixtures/products.yml +0 -0
  52. data/spec/fixtures/taggings.yml +0 -0
  53. data/spec/fixtures/tags.yml +9 -0
  54. data/spec/fixtures/users.yml +6 -0
  55. data/spec/shoulda/action_controller/assign_to_matcher_spec.rb +61 -0
  56. data/spec/shoulda/action_controller/filter_param_matcher_spec.rb +20 -0
  57. data/spec/shoulda/action_controller/redirect_to_matcher_spec.rb +40 -0
  58. data/spec/shoulda/action_controller/render_template_matcher_spec.rb +69 -0
  59. data/spec/shoulda/action_controller/render_with_layout_matcher_spec.rb +47 -0
  60. data/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb +28 -0
  61. data/spec/shoulda/action_controller/respond_with_matcher_spec.rb +83 -0
  62. data/spec/shoulda/action_controller/route_matcher_spec.rb +65 -0
  63. data/spec/shoulda/action_controller/set_session_matcher_spec.rb +46 -0
  64. data/spec/shoulda/action_controller/set_the_flash_matcher_spec.rb +124 -0
  65. data/spec/shoulda/action_mailer/have_sent_email_spec.rb +293 -0
  66. data/spec/shoulda/active_model/allow_mass_assignment_of_matcher_spec.rb +95 -0
  67. data/spec/shoulda/active_model/allow_value_matcher_spec.rb +91 -0
  68. data/spec/shoulda/active_model/ensure_exclusion_of_matcher_spec.rb +57 -0
  69. data/spec/shoulda/active_model/ensure_inclusion_of_matcher_spec.rb +71 -0
  70. data/spec/shoulda/active_model/ensure_length_of_matcher_spec.rb +125 -0
  71. data/spec/shoulda/active_model/helpers_spec.rb +100 -0
  72. data/spec/shoulda/active_model/validate_acceptance_of_matcher_spec.rb +43 -0
  73. data/spec/shoulda/active_model/validate_confirmation_of_matcher_spec.rb +48 -0
  74. data/spec/shoulda/active_model/validate_format_of_matcher_spec.rb +38 -0
  75. data/spec/shoulda/active_model/validate_numericality_of_matcher_spec.rb +62 -0
  76. data/spec/shoulda/active_model/validate_presence_of_matcher_spec.rb +121 -0
  77. data/spec/shoulda/active_model/validate_uniqueness_of_matcher_spec.rb +143 -0
  78. data/spec/shoulda/active_record/accept_nested_attributes_for_matcher_spec.rb +84 -0
  79. data/spec/shoulda/active_record/association_matcher_spec.rb +449 -0
  80. data/spec/shoulda/active_record/have_db_column_matcher_spec.rb +185 -0
  81. data/spec/shoulda/active_record/have_db_index_matcher_spec.rb +88 -0
  82. data/spec/shoulda/active_record/have_readonly_attributes_matcher_spec.rb +46 -0
  83. data/spec/shoulda/active_record/query_the_database_matcher_spec.rb +45 -0
  84. data/spec/shoulda/active_record/serialize_matcher_spec.rb +81 -0
  85. data/spec/spec_helper.rb +31 -0
  86. data/spec/support/model_builder.rb +149 -0
  87. metadata +211 -60
  88. data/CONTRIBUTION_GUIDELINES.rdoc +0 -10
  89. data/README.rdoc +0 -80
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ test/*/log/*.log
2
+ doc
3
+ coverage
4
+ .svn/
5
+ pkg
6
+ *.swp
7
+ *.swo
8
+ tags
9
+ tmp
10
+ .bundle
11
+ *.rbc
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - ree
6
+ - rbx-18mode
7
+ - jruby
8
+
9
+ script: "bundle exec rake spec cucumber"
10
+
11
+ gemfile:
12
+ - gemfiles/3.0.gemfile
13
+ - gemfiles/3.1.gemfile
data/Appraisals CHANGED
@@ -1,11 +1,9 @@
1
- appraise "3.0" do
2
- gem "rails", "3.0.10"
1
+ appraise '3.0' do
2
+ gem 'rails', '3.0.12'
3
3
  end
4
4
 
5
- appraise "3.1" do
6
- gem "rails", "3.1.0"
7
- gem 'uglifier'
5
+ appraise '3.1' do
6
+ gem 'rails', '3.1.4'
8
7
  gem 'jquery-rails'
9
- gem 'coffee-rails'
10
8
  gem 'sass-rails'
11
9
  end
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ We love pull requests. Here's a quick guide:
2
+
3
+ 1. Fork the repo.
4
+
5
+ 2. Run the tests. We only take pull requests with passing tests, and it's great
6
+ to know that you have a clean slate: `bundle && rake`
7
+
8
+ 3. Add a test for your change. Only refactoring and documentation changes
9
+ require no new tests. If you are adding functionality or fixing a bug, we need
10
+ a test!
11
+
12
+ 4. Make the test pass.
13
+
14
+ 5. Push to your fork and submit a pull request.
15
+
16
+
17
+ At this point you're waiting on us. We like to at least comment on, if not
18
+ accept, pull requests within three business days (and, typically, one business
19
+ day). We may suggest some changes or improvements or alternatives.
20
+
21
+ Some things that will increase the chance that your pull request is accepted,
22
+ taken straight from the Ruby on Rails guide:
23
+
24
+ * Use Rails idioms and helpers
25
+ * Include tests that fail without your code, and pass with it
26
+ * Update the documentation, the surrounding one, examples elsewhere, guides,
27
+ whatever is affected by your contribution
28
+
29
+ Syntax:
30
+
31
+ * Two spaces, no tabs.
32
+ * No trailing whitespace. Blank lines should not have any space.
33
+ * Prefer &&/|| over and/or.
34
+ * MyClass.my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
35
+ * a = b and not a=b.
36
+ * Follow the conventions you see used in the source already.
37
+
38
+ And in case we didn't emphasize it enough: we love tests!
data/Gemfile CHANGED
@@ -1,12 +1,15 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
- gem 'rake', '~> 0.9.2'
5
4
 
6
5
  # For test Rails application
6
+ gem 'shoulda-context', '~> 1.0.0'
7
7
  gem 'sqlite3', :platform => :ruby
8
- gem 'activerecord-jdbc-adapter', :platform => :jruby
8
+
9
+ # Can't wrap in platform :jruby do...end block because appraisal doesn't support
10
+ # it
11
+ gem 'activerecord-jdbc-adapter', :platform => :jruby
9
12
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
10
- gem 'jdbc-sqlite3', :platform => :jruby
11
- gem 'jruby-openssl', :platform => :jruby
12
- gem 'shoulda-context', '~> 1.0.0.beta1'
13
+ gem 'jdbc-sqlite3', :platform => :jruby
14
+ gem 'jruby-openssl', :platform => :jruby
15
+ gem 'therubyrhino', :platform => :jruby
data/Gemfile.lock CHANGED
@@ -1,77 +1,106 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shoulda-matchers (1.0.0.beta3)
4
+ shoulda-matchers (1.1.0)
5
+ activesupport (>= 3.0.0)
5
6
 
6
7
  GEM
7
8
  remote: http://rubygems.org/
8
9
  specs:
9
- actionpack (3.1.1)
10
- activemodel (= 3.1.1)
11
- activesupport (= 3.1.1)
10
+ actionmailer (3.2.3)
11
+ actionpack (= 3.2.3)
12
+ mail (~> 2.4.4)
13
+ actionpack (3.2.3)
14
+ activemodel (= 3.2.3)
15
+ activesupport (= 3.2.3)
12
16
  builder (~> 3.0.0)
13
17
  erubis (~> 2.7.0)
14
- i18n (~> 0.6)
15
- rack (~> 1.3.2)
16
- rack-cache (~> 1.1)
17
- rack-mount (~> 0.8.2)
18
+ journey (~> 1.0.1)
19
+ rack (~> 1.4.0)
20
+ rack-cache (~> 1.2)
18
21
  rack-test (~> 0.6.1)
19
- sprockets (~> 2.0.2)
20
- activemodel (3.1.1)
21
- activesupport (= 3.1.1)
22
+ sprockets (~> 2.1.2)
23
+ activemodel (3.2.3)
24
+ activesupport (= 3.2.3)
22
25
  builder (~> 3.0.0)
26
+ activerecord (3.2.3)
27
+ activemodel (= 3.2.3)
28
+ activesupport (= 3.2.3)
29
+ arel (~> 3.0.2)
30
+ tzinfo (~> 0.3.29)
31
+ activeresource (3.2.3)
32
+ activemodel (= 3.2.3)
33
+ activesupport (= 3.2.3)
34
+ activesupport (3.2.3)
23
35
  i18n (~> 0.6)
24
- activesupport (3.1.1)
25
36
  multi_json (~> 1.0)
26
- appraisal (0.3.8)
37
+ appraisal (0.4.1)
27
38
  bundler
28
39
  rake
29
- aruba (0.4.5)
40
+ arel (3.0.2)
41
+ aruba (0.4.6)
30
42
  bcat (>= 0.6.1)
31
- childprocess (>= 0.1.9)
32
- cucumber (>= 0.10.7)
43
+ childprocess (>= 0.2.0)
44
+ cucumber (>= 1.0.2)
33
45
  rdiscount (>= 1.6.8)
34
46
  rspec (>= 2.6.0)
35
47
  bcat (0.6.2)
36
48
  rack (~> 1.0)
49
+ bourne (1.1.2)
50
+ mocha (= 0.10.5)
37
51
  builder (3.0.0)
38
- childprocess (0.2.2)
52
+ childprocess (0.3.1)
39
53
  ffi (~> 1.0.6)
40
- cucumber (0.10.7)
54
+ cucumber (1.1.9)
41
55
  builder (>= 2.1.2)
42
56
  diff-lcs (>= 1.1.2)
43
- gherkin (~> 2.4.0)
57
+ gherkin (~> 2.9.0)
44
58
  json (>= 1.4.6)
45
- term-ansicolor (>= 1.0.5)
59
+ term-ansicolor (>= 1.0.6)
46
60
  diff-lcs (1.1.3)
47
61
  erubis (2.7.0)
48
- ffi (1.0.10)
49
- gherkin (2.4.21)
62
+ ffi (1.0.11)
63
+ gherkin (2.9.3)
50
64
  json (>= 1.4.6)
51
65
  hike (1.2.1)
52
66
  i18n (0.6.0)
53
- json (1.6.1)
54
- mocha (0.9.12)
55
- multi_json (1.0.3)
56
- rack (1.3.5)
57
- rack-cache (1.1)
67
+ journey (1.0.3)
68
+ json (1.6.6)
69
+ mail (2.4.4)
70
+ i18n (>= 0.4.0)
71
+ mime-types (~> 1.16)
72
+ treetop (~> 1.4.8)
73
+ metaclass (0.0.1)
74
+ mime-types (1.18)
75
+ mocha (0.10.5)
76
+ metaclass (~> 0.0.1)
77
+ multi_json (1.2.0)
78
+ polyglot (0.3.3)
79
+ rack (1.4.1)
80
+ rack-cache (1.2)
58
81
  rack (>= 0.4)
59
- rack-mount (0.8.3)
60
- rack (>= 1.0.0)
61
82
  rack-ssl (1.3.2)
62
83
  rack
63
84
  rack-test (0.6.1)
64
85
  rack (>= 1.0)
65
- railties (3.1.1)
66
- actionpack (= 3.1.1)
67
- activesupport (= 3.1.1)
86
+ rails (3.2.3)
87
+ actionmailer (= 3.2.3)
88
+ actionpack (= 3.2.3)
89
+ activerecord (= 3.2.3)
90
+ activeresource (= 3.2.3)
91
+ activesupport (= 3.2.3)
92
+ bundler (~> 1.0)
93
+ railties (= 3.2.3)
94
+ railties (3.2.3)
95
+ actionpack (= 3.2.3)
96
+ activesupport (= 3.2.3)
68
97
  rack-ssl (~> 1.3.2)
69
98
  rake (>= 0.8.7)
70
99
  rdoc (~> 3.4)
71
100
  thor (~> 0.14.6)
72
101
  rake (0.9.2.2)
73
102
  rdiscount (1.6.8)
74
- rdoc (3.11)
103
+ rdoc (3.12)
75
104
  json (~> 1.4)
76
105
  rspec (2.6.0)
77
106
  rspec-core (~> 2.6.0)
@@ -86,15 +115,19 @@ GEM
86
115
  activesupport (~> 3.0)
87
116
  railties (~> 3.0)
88
117
  rspec (~> 2.6.0)
89
- shoulda-context (1.0.0.beta1)
90
- sprockets (2.0.3)
118
+ shoulda-context (1.0.0)
119
+ sprockets (2.1.2)
91
120
  hike (~> 1.2)
92
121
  rack (~> 1.0)
93
122
  tilt (~> 1.1, != 1.3.0)
94
- sqlite3 (1.3.4)
123
+ sqlite3 (1.3.5)
95
124
  term-ansicolor (1.0.7)
96
125
  thor (0.14.6)
97
126
  tilt (1.3.3)
127
+ treetop (1.4.10)
128
+ polyglot
129
+ polyglot (>= 0.3.1)
130
+ tzinfo (0.3.33)
98
131
 
99
132
  PLATFORMS
100
133
  ruby
@@ -102,14 +135,17 @@ PLATFORMS
102
135
  DEPENDENCIES
103
136
  activerecord-jdbc-adapter
104
137
  activerecord-jdbcsqlite3-adapter
105
- appraisal (~> 0.3.4)
138
+ appraisal (~> 0.4.0)
106
139
  aruba
107
- cucumber (~> 0.10.0)
140
+ bourne (~> 1.1.2)
141
+ bundler (~> 1.1.0)
142
+ cucumber (~> 1.1.9)
108
143
  jdbc-sqlite3
109
144
  jruby-openssl
110
- mocha (~> 0.9.10)
145
+ rails (~> 3.0)
111
146
  rake (~> 0.9.2)
112
- rspec-rails (~> 2.6.1.beta1)
113
- shoulda-context (~> 1.0.0.beta1)
147
+ rspec-rails (~> 2.6.1)
148
+ shoulda-context (~> 1.0.0)
114
149
  shoulda-matchers!
115
150
  sqlite3
151
+ therubyrhino
data/NEWS.md ADDED
@@ -0,0 +1,32 @@
1
+ # HEAD
2
+
3
+ * Added `only_integer` option to `validate_numericality_of`:
4
+ `should validate_numericality_of(:attribute).only_integer`
5
+
6
+ * Added a `query_the_database` matcher:
7
+
8
+ `it { should query_the_database(4.times).when_calling(:complicated_method) }`
9
+ `it { should query_the_database(4.times).or_less.when_calling(:complicated_method) }`
10
+ `it { should_not query_the_database.when_calling(:complicated_method) }`
11
+
12
+ * Database columns are now correctly checked for primality. E.G., this works
13
+ now: `it { should have_db_column(:id).with_options(:primary => true) }`
14
+
15
+ * The flash matcher can check specific flash keys using [], like so:
16
+ `it { should set_the_flash[:alert].to("Password doesn't match") }`
17
+
18
+ * The `have_sent_email` matcher can check `reply_to`:
19
+ ` it { should have_sent_email.reply_to([user, other]) }`
20
+
21
+ * Added `validates_confirmation_of` matcher:
22
+ `it { should validate_confirmation_of(:password) }`
23
+
24
+ * Added `serialize` matcher:
25
+ `it { should serialize(:details).as(Hash).as_instance_of(Hash) }`
26
+
27
+ * shoulda-matchers checks for all possible I18n keys, instead of just
28
+ e.g. `activerecord.errors.messages.blank`
29
+
30
+ * Add `accept_nested_attributes` matcher
31
+
32
+ * Our very first dependency: ActiveSupport >= 3.0.0
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # shoulda-matchers [![Build Status](https://secure.travis-ci.org/thoughtbot/shoulda-matchers.png?branch=master)](http://travis-ci.org/thoughtbot/shoulda-matchers)
2
+
3
+ [Official Documentation](http://rubydoc.info/github/thoughtbot/shoulda-matchers/master/frames)
4
+
5
+ Test::Unit- and RSpec-compatible one-liners that test common Rails functionality.
6
+ These tests would otherwise be much longer, more complex, and error-prone.
7
+
8
+ Refer to the [shoulda-context](https://github.com/thoughtbot/shoulda-context) gem if you want to know more
9
+ about using shoulda with Test::Unit.
10
+
11
+ ## ActiveRecord Matchers
12
+
13
+ Matchers to test associations:
14
+
15
+ describe Post do
16
+ it { should belong_to(:user) }
17
+ it { should have_many(:tags).through(:taggings) }
18
+ end
19
+
20
+ describe User do
21
+ it { should have_many(:posts) }
22
+ end
23
+
24
+ ## ActiveModel Matchers
25
+
26
+ Matchers to test validations and mass assignments:
27
+
28
+ describe Post do
29
+ it { should validate_uniqueness_of(:title) }
30
+ it { should validate_presence_of(:body).with_message(/wtf/) }
31
+ it { should validate_presence_of(:title) }
32
+ it { should validate_numericality_of(:user_id) }
33
+
34
+ # validates_uniqueness_of requires an entry to be in the database already
35
+ it "validates uniqueness of title" do
36
+ Post.create!(title: "My Awesome Post", body: "whatever")
37
+ should validate_uniqueness_of(:title)
38
+ end
39
+ end
40
+
41
+ describe User do
42
+ it { should_not allow_value("blah").for(:email) }
43
+ it { should allow_value("a@b.com").for(:email) }
44
+ it { should ensure_inclusion_of(:age).in_range(1..100) }
45
+ it { should_not allow_mass_assignment_of(:password) }
46
+ end
47
+
48
+ ## ActionController Matchers
49
+
50
+ Matchers to test common patterns:
51
+
52
+ describe PostsController, "#show" do
53
+ context "for a fictional user" do
54
+ before do
55
+ get :show, :id => 1
56
+ end
57
+
58
+ it { should assign_to(:user) }
59
+ it { should respond_with(:success) }
60
+ it { should render_template(:show) }
61
+ it { should_not set_the_flash }
62
+ end
63
+ end
64
+
65
+ ## Installation
66
+
67
+ In Rails 3 and Bundler, add the following to your Gemfile:
68
+
69
+ group :test do
70
+ gem "rspec-rails"
71
+ gem "shoulda-matchers"
72
+ end
73
+
74
+ Shoulda will automatically include matchers into the appropriate example groups.
75
+
76
+ ## Credits
77
+
78
+ Shoulda is maintained and funded by [thoughtbot](http://thoughtbot.com/community).
79
+ Thank you to all the [contributors](https://github.com/thoughtbot/shoulda-matchers/contributors).
80
+
81
+ ## License
82
+
83
+ Shoulda is Copyright © 2006-2010 thoughtbot, inc.
84
+ It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
data/Rakefile CHANGED
@@ -1,55 +1,24 @@
1
- require 'rubygems'
2
1
  require 'bundler/setup'
3
- require 'rake'
4
- require 'rake/rdoctask'
5
- require 'rubygems/package_task'
2
+ require 'bundler/gem_tasks'
6
3
  require 'rspec/core/rake_task'
7
4
  require 'cucumber/rake/task'
8
5
  require 'appraisal'
9
6
 
10
- $LOAD_PATH.unshift("lib")
11
- require 'shoulda/matchers/version'
12
-
13
- Rake::RDocTask.new { |rdoc|
14
- rdoc.rdoc_dir = 'doc'
15
- rdoc.title = "Shoulda -- Making tests easy on the fingers and eyes"
16
- rdoc.options << '--line-numbers'
17
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
18
- rdoc.rdoc_files.include('README.rdoc', 'CONTRIBUTION_GUIDELINES.rdoc', 'lib/**/*.rb')
19
- }
20
-
21
7
  RSpec::Core::RakeTask.new do |t|
22
8
  t.pattern = "spec/**/*_spec.rb"
23
9
  t.rspec_opts = '--color --format progress'
24
10
  t.verbose = false
25
11
  end
26
12
 
27
- desc "Run code-coverage analysis using rcov"
28
- RSpec::Core::RakeTask.new(:coverage) do |t|
29
- t.rspec_opts = '--color --format progress'
30
- t.rcov = true
31
- t.rcov_opts = %{--exclude osx\/objc,spec,gems\/ --failure-threshold 100}
32
- t.pattern = "spec/**/*_spec.rb"
33
- end
34
-
35
- eval("$specification = begin; #{IO.read('shoulda-matchers.gemspec')}; end")
36
- Gem::PackageTask.new $specification do |pkg|
37
- pkg.need_tar = true
38
- pkg.need_zip = true
39
- end
40
-
41
- desc "Clean files generated by rake tasks"
42
- task :clobber => [:clobber_rdoc, :clobber_package]
43
-
44
13
  Cucumber::Rake::Task.new do |t|
45
14
  t.fork = false
46
15
  t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'progress')]
47
16
  end
48
17
 
49
- desc 'Default: run specs and cucumber features'
50
- task :default => [:all]
51
-
52
18
  desc 'Test the plugin under all supported Rails versions.'
53
- task :all => ["appraisal:cleanup", "appraisal:install"] do |t|
19
+ task :all => ["appraisal:cleanup", "appraisal:install"] do
54
20
  exec('rake appraisal spec cucumber')
55
21
  end
22
+
23
+ desc 'Default: run specs and cucumber features'
24
+ task :default => [:all]