rspec_candy 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/.gitignore +1 -0
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +5 -4
  4. data/README.md +5 -13
  5. data/Rakefile +18 -25
  6. data/gemfiles/Gemfile.rspec1-rails2 +17 -0
  7. data/gemfiles/Gemfile.rspec1-rails2.lock +31 -0
  8. data/gemfiles/Gemfile.rspec2-rails3 +9 -0
  9. data/gemfiles/Gemfile.rspec2-rails3.lock +51 -0
  10. data/gemfiles/Gemfile.rspec3-rails4 +9 -0
  11. data/gemfiles/Gemfile.rspec3-rails4.lock +61 -0
  12. data/lib/rspec_candy/base.rb +1 -0
  13. data/lib/rspec_candy/helpers.rb +1 -1
  14. data/lib/rspec_candy/helpers/it_should_act_like.rb +2 -2
  15. data/lib/rspec_candy/helpers/rails/it_should_run_callbacks.rb +6 -26
  16. data/lib/rspec_candy/helpers/rails/store_with_values.rb +7 -2
  17. data/lib/rspec_candy/helpers/stub_any_instance.rb +2 -2
  18. data/lib/rspec_candy/switcher.rb +27 -15
  19. data/lib/rspec_candy/version.rb +1 -1
  20. data/spec/{shared/rspec_candy → rspec_candy}/helpers/disposable_copy_spec.rb +1 -1
  21. data/spec/{shared/rspec_candy → rspec_candy}/helpers/it_should_act_like_spec.rb +0 -0
  22. data/spec/{shared/rspec_candy → rspec_candy}/helpers/new_with_stubs_spec.rb +0 -0
  23. data/spec/rspec_candy/helpers/rails/it_should_run_callbacks_spec.rb +84 -0
  24. data/spec/{shared/rspec_candy → rspec_candy}/helpers/rails/prevent_storage_spec.rb +1 -1
  25. data/spec/{shared/rspec_candy → rspec_candy}/helpers/rails/store_with_values_spec.rb +6 -2
  26. data/spec/{shared/rspec_candy → rspec_candy}/helpers/should_receive_and_execute_spec.rb +0 -0
  27. data/spec/{shared/rspec_candy → rspec_candy}/helpers/should_receive_and_return_spec.rb +0 -0
  28. data/spec/{shared/rspec_candy → rspec_candy}/helpers/should_receive_chain_spec.rb +0 -0
  29. data/spec/{shared/rspec_candy → rspec_candy}/helpers/stub_any_instance_spec.rb +0 -0
  30. data/spec/{shared/rspec_candy → rspec_candy}/helpers/stub_existing_spec.rb +0 -0
  31. data/spec/{shared/rspec_candy → rspec_candy}/matchers/be_same_number_as_spec.rb +0 -0
  32. data/spec/{shared/rspec_candy → rspec_candy}/matchers/be_same_second_as_spec.rb +0 -0
  33. data/spec/{shared/rspec_candy → rspec_candy}/matchers/include_hash_spec.rb +0 -0
  34. data/spec/{rspec1/app_root/config/environments/test.rb → shared_examples/.keep} +0 -0
  35. data/spec/spec_helper.rb +9 -0
  36. data/spec/support/database.rb +15 -0
  37. data/spec/support/database_cleaner.rb +20 -0
  38. data/spec/{shared/support → support}/matchers/pass_as_describe_block.rb +14 -3
  39. data/spec/{shared/support → support}/matchers/pass_as_example.rb +2 -0
  40. data/spec/{shared/app_root/app/models/model.rb → support/models.rb} +19 -0
  41. metadata +74 -123
  42. data/spec/rspec1/Gemfile +0 -16
  43. data/spec/rspec1/Gemfile.lock +0 -74
  44. data/spec/rspec1/Rakefile +0 -11
  45. data/spec/rspec1/app_root/config/boot.rb +0 -114
  46. data/spec/rspec1/app_root/config/database.yml +0 -4
  47. data/spec/rspec1/app_root/config/environment.rb +0 -14
  48. data/spec/rspec1/app_root/config/initializers/state_machine.rb +0 -1
  49. data/spec/rspec1/app_root/config/routes.rb +0 -4
  50. data/spec/rspec1/rcov.opts +0 -2
  51. data/spec/rspec1/spec.opts +0 -4
  52. data/spec/rspec1/spec/spec_helper.rb +0 -25
  53. data/spec/rspec1/spec/switcher_spec.rb +0 -26
  54. data/spec/rspec2/.rspec +0 -2
  55. data/spec/rspec2/Gemfile +0 -14
  56. data/spec/rspec2/Gemfile.lock +0 -137
  57. data/spec/rspec2/Rakefile +0 -11
  58. data/spec/rspec2/app_root/.gitignore +0 -4
  59. data/spec/rspec2/app_root/config/application.rb +0 -32
  60. data/spec/rspec2/app_root/config/boot.rb +0 -13
  61. data/spec/rspec2/app_root/config/database.yml +0 -4
  62. data/spec/rspec2/app_root/config/environment.rb +0 -5
  63. data/spec/rspec2/app_root/config/environments/test.rb +0 -0
  64. data/spec/rspec2/app_root/config/initializers/backtrace_silencers.rb +0 -7
  65. data/spec/rspec2/app_root/config/initializers/inflections.rb +0 -10
  66. data/spec/rspec2/app_root/config/initializers/mime_types.rb +0 -5
  67. data/spec/rspec2/app_root/config/initializers/secret_token.rb +0 -7
  68. data/spec/rspec2/app_root/config/initializers/session_store.rb +0 -8
  69. data/spec/rspec2/app_root/config/initializers/state_machine.rb +0 -1
  70. data/spec/rspec2/app_root/config/locales/en.yml +0 -5
  71. data/spec/rspec2/app_root/config/routes.rb +0 -58
  72. data/spec/rspec2/rcov.opts +0 -2
  73. data/spec/rspec2/spec/spec_helper.rb +0 -24
  74. data/spec/rspec2/spec/switcher_spec.rb +0 -21
  75. data/spec/shared/app_root/app/controllers/application_controller.rb +0 -2
  76. data/spec/shared/app_root/app/models/state_machine_model.rb +0 -53
  77. data/spec/shared/app_root/app/models/sti_child.rb +0 -3
  78. data/spec/shared/app_root/app/models/sti_parent.rb +0 -12
  79. data/spec/shared/app_root/config/initializers/state_machine.rb +0 -1
  80. data/spec/shared/app_root/db/migrate/001_create_model.rb +0 -14
  81. data/spec/shared/app_root/db/migrate/002_create_state_machine_model.rb +0 -13
  82. data/spec/shared/app_root/db/migrate/003_create_sti_model.rb +0 -14
  83. data/spec/shared/rspec_candy/helpers/rails/it_should_run_callbacks_spec.rb +0 -158
data/spec/rspec1/Gemfile DELETED
@@ -1,16 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'sqlite3'
4
- gem 'rails', '~>2'
5
- gem 'has_defaults'
6
- gem 'rspec', '~>1'
7
- gem 'rspec-rails', '~>1'
8
- gem 'ruby-debug', :platforms => :ruby_18
9
- gem 'debugger', :platforms => :ruby_19
10
- gem 'rspec_candy', :path => '../..'
11
- gem 'test-unit', '~>1.2', :platforms => :ruby_19
12
- gem 'hoe', '=2.8.0', :platforms => :ruby_19
13
-
14
- group :state_machine do
15
- gem 'state_machine'
16
- end
@@ -1,74 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- rspec_candy (0.3.1)
5
- rspec
6
- sneaky-save
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- actionmailer (2.3.18)
12
- actionpack (= 2.3.18)
13
- actionpack (2.3.18)
14
- activesupport (= 2.3.18)
15
- rack (~> 1.1.0)
16
- activerecord (2.3.18)
17
- activesupport (= 2.3.18)
18
- activeresource (2.3.18)
19
- activesupport (= 2.3.18)
20
- activesupport (2.3.18)
21
- columnize (0.3.6)
22
- debugger (1.6.1)
23
- columnize (>= 0.3.1)
24
- debugger-linecache (~> 1.2.0)
25
- debugger-ruby_core_source (~> 1.2.3)
26
- debugger-linecache (1.2.0)
27
- debugger-ruby_core_source (1.2.3)
28
- has_defaults (0.4.1)
29
- activerecord
30
- hoe (2.8.0)
31
- rake (>= 0.8.7)
32
- linecache (0.46)
33
- rbx-require-relative (> 0.0.4)
34
- rack (1.1.6)
35
- rails (2.3.18)
36
- actionmailer (= 2.3.18)
37
- actionpack (= 2.3.18)
38
- activerecord (= 2.3.18)
39
- activeresource (= 2.3.18)
40
- activesupport (= 2.3.18)
41
- rake (>= 0.8.3)
42
- rake (10.1.0)
43
- rbx-require-relative (0.0.9)
44
- rspec (1.3.2)
45
- rspec-rails (1.3.4)
46
- rack (>= 1.0.0)
47
- rspec (~> 1.3.1)
48
- ruby-debug (0.10.4)
49
- columnize (>= 0.1)
50
- ruby-debug-base (~> 0.10.4.0)
51
- ruby-debug-base (0.10.4)
52
- linecache (>= 0.3)
53
- sneaky-save (0.0.2)
54
- activerecord (>= 2.3.2)
55
- sqlite3 (1.3.8)
56
- state_machine (1.2.0)
57
- test-unit (1.2.3)
58
- hoe (>= 1.5.1)
59
-
60
- PLATFORMS
61
- ruby
62
-
63
- DEPENDENCIES
64
- debugger
65
- has_defaults
66
- hoe (= 2.8.0)
67
- rails (~> 2)
68
- rspec (~> 1)
69
- rspec-rails (~> 1)
70
- rspec_candy!
71
- ruby-debug
72
- sqlite3
73
- state_machine
74
- test-unit (~> 1.2)
data/spec/rspec1/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
3
-
4
- desc 'Default: Run all specs for a specific rails version.'
5
- task :default => :spec
6
-
7
- desc "Run all specs for a specific rails version"
8
- Spec::Rake::SpecTask.new() do |t|
9
- t.spec_opts = ['--options', "\"spec.opts\""]
10
- t.spec_files = defined?(SPEC) ? SPEC : FileList['**/*_spec.rb', '../shared/**/*_spec.rb']
11
- end
@@ -1,114 +0,0 @@
1
- # Allow customization of the rails framework path
2
- RAILS_FRAMEWORK_ROOT = (ENV['RAILS_FRAMEWORK_ROOT'] || "#{File.dirname(__FILE__)}/../../../../../../vendor/rails") unless defined?(RAILS_FRAMEWORK_ROOT)
3
-
4
- # Don't change this file!
5
- # Configure your app in config/environment.rb and config/environments/*.rb
6
-
7
- RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
8
-
9
- module Rails
10
- class << self
11
- def boot!
12
- unless booted?
13
- preinitialize
14
- pick_boot.run
15
- end
16
- end
17
-
18
- def booted?
19
- defined? Rails::Initializer
20
- end
21
-
22
- def pick_boot
23
- (vendor_rails? ? VendorBoot : GemBoot).new
24
- end
25
-
26
- def vendor_rails?
27
- File.exist?(RAILS_FRAMEWORK_ROOT)
28
- end
29
-
30
- def preinitialize
31
- load(preinitializer_path) if File.exist?(preinitializer_path)
32
- end
33
-
34
- def preinitializer_path
35
- "#{RAILS_ROOT}/config/preinitializer.rb"
36
- end
37
- end
38
-
39
- class Boot
40
- def run
41
- load_initializer
42
- Rails::Initializer.run(:set_load_path)
43
- end
44
- end
45
-
46
- class VendorBoot < Boot
47
- def load_initializer
48
- require "#{RAILS_FRAMEWORK_ROOT}/railties/lib/initializer"
49
- Rails::Initializer.run(:install_gem_spec_stubs)
50
- end
51
- end
52
-
53
- class GemBoot < Boot
54
- def load_initializer
55
- self.class.load_rubygems
56
- load_rails_gem
57
- require 'initializer'
58
- end
59
-
60
- def load_rails_gem
61
- if version = self.class.gem_version
62
- gem 'rails', version
63
- else
64
- gem 'rails'
65
- end
66
- rescue Gem::LoadError => load_error
67
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
68
- exit 1
69
- end
70
-
71
- class << self
72
- def rubygems_version
73
- Gem::RubyGemsVersion rescue nil
74
- end
75
-
76
- def gem_version
77
- if defined? RAILS_GEM_VERSION
78
- RAILS_GEM_VERSION
79
- elsif ENV.include?('RAILS_GEM_VERSION')
80
- ENV['RAILS_GEM_VERSION']
81
- else
82
- parse_gem_version(read_environment_rb)
83
- end
84
- end
85
-
86
- def load_rubygems
87
- require 'rubygems'
88
- min_version = '1.1.1'
89
- unless rubygems_version >= min_version
90
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
91
- exit 1
92
- end
93
-
94
- rescue LoadError
95
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
96
- exit 1
97
- end
98
-
99
- def parse_gem_version(text)
100
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
101
- end
102
-
103
- private
104
- def read_environment_rb
105
- environment_rb = "#{RAILS_ROOT}/config/environment.rb"
106
- environment_rb = "#{HELPER_RAILS_ROOT}/config/environment.rb" unless File.exists?(environment_rb)
107
- File.read(environment_rb)
108
- end
109
- end
110
- end
111
- end
112
-
113
- # All that for this:
114
- Rails.boot!
@@ -1,4 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: ":memory:"
4
- verbosity: quiet
@@ -1,14 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'boot')
2
-
3
- Rails::Initializer.run do |config|
4
- config.cache_classes = false
5
- config.whiny_nils = true
6
- config.action_controller.session = { :key => "_myapp_session", :secret => "gwirofjweroijger8924rt2zfwehfuiwehb1378rifowenfoqwphf23" }
7
- config.plugin_locators.unshift(
8
- Class.new(Rails::Plugin::Locator) do
9
- def plugins
10
- [Rails::Plugin.new(File.expand_path('.'))]
11
- end
12
- end
13
- ) unless defined?(PluginTestHelper::PluginLocator)
14
- end
@@ -1 +0,0 @@
1
- Bundler.require(:state_machine) if ENV['REQUIRE_STATE_MACHINE'] == 'true'
@@ -1,4 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- map.connect ':controller/:action/:id'
3
- map.connect ':controller/:action/:id.:format'
4
- end
@@ -1,2 +0,0 @@
1
- --exclude "spec/*,gems/*"
2
- --rails
@@ -1,4 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
@@ -1,25 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), "/../lib" )
2
- $: << File.dirname(__FILE__)
3
-
4
- ENV['RAILS_ENV'] = 'test'
5
- ENV['RAILS_ROOT'] = 'app_root'
6
-
7
- # Load the Rails environment and testing framework
8
- require "#{File.dirname(__FILE__)}/../app_root/config/environment"
9
- require 'spec/rails'
10
-
11
- # Load dependencies
12
- require 'rspec_candy/all'
13
-
14
- # Require support code
15
- Dir["../shared/support/**/*.rb"].each {|f| require f}
16
-
17
- # Run the migrations
18
- print "\033[30m" # dark gray text
19
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
20
- print "\033[0m"
21
-
22
- Spec::Runner.configure do |config|
23
- config.use_transactional_fixtures = true
24
- config.use_instantiated_fixtures = false
25
- end
@@ -1,26 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # Some gems that are actually compatible with RSpec 1 define RSpec,
4
- # so make sure we don't detect on that.
5
- module ::RSpec
6
- end
7
-
8
- describe RSpecCandy::Switcher do
9
-
10
- describe "#rspec_version" do
11
-
12
- it "should detect rspec1" do
13
- RSpecCandy::Switcher.rspec_version.should == :rspec1
14
- end
15
-
16
- end
17
-
18
- describe '#rspec_root' do
19
-
20
- it 'should return the Spec module' do
21
- RSpecCandy::Switcher.rspec_root.should == Spec
22
- end
23
-
24
- end
25
-
26
- end
data/spec/rspec2/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour
2
- --format progress
data/spec/rspec2/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'sqlite3'
4
- gem 'rails', '~>3'
5
- gem 'has_defaults'
6
- gem 'rspec', '~>2'
7
- gem 'rspec-rails', '~>2'
8
- gem 'ruby-debug', :platforms => :ruby_18
9
- gem 'debugger', :platforms => :ruby_19
10
- gem 'rspec_candy', :path => '../..'
11
-
12
- group :state_machine do
13
- gem 'state_machine'
14
- end
@@ -1,137 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- rspec_candy (0.3.1)
5
- rspec
6
- sneaky-save
7
-
8
- GEM
9
- remote: http://rubygems.org/
10
- specs:
11
- actionmailer (3.2.14)
12
- actionpack (= 3.2.14)
13
- mail (~> 2.5.4)
14
- actionpack (3.2.14)
15
- activemodel (= 3.2.14)
16
- activesupport (= 3.2.14)
17
- builder (~> 3.0.0)
18
- erubis (~> 2.7.0)
19
- journey (~> 1.0.4)
20
- rack (~> 1.4.5)
21
- rack-cache (~> 1.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.2.1)
24
- activemodel (3.2.14)
25
- activesupport (= 3.2.14)
26
- builder (~> 3.0.0)
27
- activerecord (3.2.14)
28
- activemodel (= 3.2.14)
29
- activesupport (= 3.2.14)
30
- arel (~> 3.0.2)
31
- tzinfo (~> 0.3.29)
32
- activeresource (3.2.14)
33
- activemodel (= 3.2.14)
34
- activesupport (= 3.2.14)
35
- activesupport (3.2.14)
36
- i18n (~> 0.6, >= 0.6.4)
37
- multi_json (~> 1.0)
38
- arel (3.0.2)
39
- builder (3.0.4)
40
- columnize (0.3.6)
41
- debugger (1.6.1)
42
- columnize (>= 0.3.1)
43
- debugger-linecache (~> 1.2.0)
44
- debugger-ruby_core_source (~> 1.2.3)
45
- debugger-linecache (1.2.0)
46
- debugger-ruby_core_source (1.2.3)
47
- diff-lcs (1.2.4)
48
- erubis (2.7.0)
49
- has_defaults (0.4.1)
50
- activerecord
51
- hike (1.2.3)
52
- i18n (0.6.5)
53
- journey (1.0.4)
54
- json (1.8.0)
55
- linecache (0.46)
56
- rbx-require-relative (> 0.0.4)
57
- mail (2.5.4)
58
- mime-types (~> 1.16)
59
- treetop (~> 1.4.8)
60
- mime-types (1.24)
61
- multi_json (1.7.9)
62
- polyglot (0.3.3)
63
- rack (1.4.5)
64
- rack-cache (1.2)
65
- rack (>= 0.4)
66
- rack-ssl (1.3.3)
67
- rack
68
- rack-test (0.6.2)
69
- rack (>= 1.0)
70
- rails (3.2.14)
71
- actionmailer (= 3.2.14)
72
- actionpack (= 3.2.14)
73
- activerecord (= 3.2.14)
74
- activeresource (= 3.2.14)
75
- activesupport (= 3.2.14)
76
- bundler (~> 1.0)
77
- railties (= 3.2.14)
78
- railties (3.2.14)
79
- actionpack (= 3.2.14)
80
- activesupport (= 3.2.14)
81
- rack-ssl (~> 1.3.2)
82
- rake (>= 0.8.7)
83
- rdoc (~> 3.4)
84
- thor (>= 0.14.6, < 2.0)
85
- rake (10.1.0)
86
- rbx-require-relative (0.0.9)
87
- rdoc (3.12.2)
88
- json (~> 1.4)
89
- rspec (2.14.1)
90
- rspec-core (~> 2.14.0)
91
- rspec-expectations (~> 2.14.0)
92
- rspec-mocks (~> 2.14.0)
93
- rspec-core (2.14.5)
94
- rspec-expectations (2.14.2)
95
- diff-lcs (>= 1.1.3, < 2.0)
96
- rspec-mocks (2.14.3)
97
- rspec-rails (2.14.0)
98
- actionpack (>= 3.0)
99
- activesupport (>= 3.0)
100
- railties (>= 3.0)
101
- rspec-core (~> 2.14.0)
102
- rspec-expectations (~> 2.14.0)
103
- rspec-mocks (~> 2.14.0)
104
- ruby-debug (0.10.4)
105
- columnize (>= 0.1)
106
- ruby-debug-base (~> 0.10.4.0)
107
- ruby-debug-base (0.10.4)
108
- linecache (>= 0.3)
109
- sneaky-save (0.0.4)
110
- activerecord (>= 3.2.0)
111
- sprockets (2.2.2)
112
- hike (~> 1.2)
113
- multi_json (~> 1.0)
114
- rack (~> 1.0)
115
- tilt (~> 1.1, != 1.3.0)
116
- sqlite3 (1.3.8)
117
- state_machine (1.2.0)
118
- thor (0.18.1)
119
- tilt (1.4.1)
120
- treetop (1.4.15)
121
- polyglot
122
- polyglot (>= 0.3.1)
123
- tzinfo (0.3.37)
124
-
125
- PLATFORMS
126
- ruby
127
-
128
- DEPENDENCIES
129
- debugger
130
- has_defaults
131
- rails (~> 3)
132
- rspec (~> 2)
133
- rspec-rails (~> 2)
134
- rspec_candy!
135
- ruby-debug
136
- sqlite3
137
- state_machine