Class: Spring::Test::RailsVersion
- Inherits:
-
Object
- Object
- Spring::Test::RailsVersion
- Defined in:
- lib/spring/test/rails_version.rb
Instance Attribute Summary collapse
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #bundles_spring? ⇒ Boolean
- #controller_tests_dir ⇒ Object
-
#initialize(string) ⇒ RailsVersion
constructor
A new instance of RailsVersion.
- #major ⇒ Object
- #minor ⇒ Object
- #rails_3? ⇒ Boolean (also: #needs_testunit?)
- #test_command ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(string) ⇒ RailsVersion
Returns a new instance of RailsVersion.
6 7 8 |
# File 'lib/spring/test/rails_version.rb', line 6 def initialize(string) @version = Gem::Version.new(string) end |
Instance Attribute Details
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/spring/test/rails_version.rb', line 4 def version @version end |
Instance Method Details
#bundles_spring? ⇒ Boolean
23 24 25 |
# File 'lib/spring/test/rails_version.rb', line 23 def bundles_spring? version.segments.take(2) == [4, 1] || version > Gem::Version.new("4.1") end |
#controller_tests_dir ⇒ Object
19 20 21 |
# File 'lib/spring/test/rails_version.rb', line 19 def controller_tests_dir rails_3? ? 'functional' : 'controllers' end |
#major ⇒ Object
27 28 29 |
# File 'lib/spring/test/rails_version.rb', line 27 def major version.segments[0] end |
#minor ⇒ Object
31 32 33 |
# File 'lib/spring/test/rails_version.rb', line 31 def minor version.segments[1] end |
#rails_3? ⇒ Boolean Also known as: needs_testunit?
10 11 12 |
# File 'lib/spring/test/rails_version.rb', line 10 def rails_3? version < Gem::Version.new("4.0.0") end |
#test_command ⇒ Object
15 16 17 |
# File 'lib/spring/test/rails_version.rb', line 15 def test_command needs_testunit? ? 'bin/testunit' : 'bin/rake test' end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/spring/test/rails_version.rb', line 35 def to_s version.to_s end |