rspec-rails 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/Changelog.md +17 -0
  5. data/README.md +7 -7
  6. data/lib/generators/rspec.rb +10 -6
  7. data/lib/generators/rspec/controller/templates/controller_spec.rb +1 -1
  8. data/lib/generators/rspec/install/install_generator.rb +19 -2
  9. data/lib/generators/rspec/install/templates/spec/rails_helper.rb +13 -4
  10. data/lib/generators/rspec/integration/templates/request_spec.rb +1 -1
  11. data/lib/generators/rspec/job/job_generator.rb +12 -0
  12. data/lib/generators/rspec/job/templates/job_spec.rb.erb +7 -0
  13. data/lib/generators/rspec/model/model_generator.rb +18 -5
  14. data/lib/generators/rspec/scaffold/scaffold_generator.rb +107 -100
  15. data/lib/rspec-rails.rb +1 -1
  16. data/lib/rspec/rails.rb +1 -0
  17. data/lib/rspec/rails/adapters.rb +9 -7
  18. data/lib/rspec/rails/configuration.rb +2 -3
  19. data/lib/rspec/rails/example/controller_example_group.rb +172 -149
  20. data/lib/rspec/rails/example/feature_example_group.rb +25 -23
  21. data/lib/rspec/rails/example/helper_example_group.rb +27 -25
  22. data/lib/rspec/rails/example/mailer_example_group.rb +26 -22
  23. data/lib/rspec/rails/example/model_example_group.rb +8 -6
  24. data/lib/rspec/rails/example/request_example_group.rb +19 -17
  25. data/lib/rspec/rails/example/routing_example_group.rb +40 -38
  26. data/lib/rspec/rails/example/view_example_group.rb +140 -137
  27. data/lib/rspec/rails/extensions/active_record/proxy.rb +0 -1
  28. data/lib/rspec/rails/feature_check.rb +35 -0
  29. data/lib/rspec/rails/fixture_support.rb +1 -1
  30. data/lib/rspec/rails/matchers.rb +5 -2
  31. data/lib/rspec/rails/matchers/be_a_new.rb +68 -64
  32. data/lib/rspec/rails/matchers/be_new_record.rb +24 -20
  33. data/lib/rspec/rails/matchers/be_valid.rb +38 -34
  34. data/lib/rspec/rails/matchers/have_http_status.rb +340 -334
  35. data/lib/rspec/rails/matchers/have_rendered.rb +35 -32
  36. data/lib/rspec/rails/matchers/redirect_to.rb +30 -27
  37. data/lib/rspec/rails/matchers/routing_matchers.rb +103 -101
  38. data/lib/rspec/rails/version.rb +1 -1
  39. data/lib/rspec/rails/view_assigns.rb +1 -2
  40. data/lib/rspec/rails/view_rendering.rb +6 -8
  41. metadata +16 -13
  42. metadata.gz.sig +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 531ee4388e3473684c081da49e38e0254cc1503a
4
- data.tar.gz: a24b272abedc01e713c31c991473bf8b290dec87
3
+ metadata.gz: e7082373e70e8e1b7a77e4a29acde414d3a0f88d
4
+ data.tar.gz: 0a6fd867ecf7f7d201e2b6f8d3ebaaef7357b6bd
5
5
  SHA512:
6
- metadata.gz: 626e65139ca363cff2f5c770cd2eee8d2b4c45923a9f06ca56bf25010b55fba93f6d650a5c4092549dbef17943230e65e2aeb60b8c250ce9b2da77febb9c0fc2
7
- data.tar.gz: 50b67c8d265abe9a766d50df2d0780febd6910f9ff3aef9a74aed19de6ae37c6a0ceee306851c2ca5129c1ae355e44e72283db60959bd2e4481e6a31d6786ba6
6
+ metadata.gz: edae3eef56dee24c9ef3b6aa78e971ac353c83058a38a9bbc05efb7da6cd8ed00b89f4add64f54c5d606cf88b4df8ba0846d9315f966b4dc0709583bf51b1b50
7
+ data.tar.gz: ac61c06796d8788ba676bb95d1ee3551b727e4757e1b78c2bbecfdba86551fb4bfbc9d141c594f42a03ed6c8008009dea09237ea1ba2b75d3440a809ad2256c6
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,20 @@
1
+ ### 3.1.0 / 2014-09-04
2
+ [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.0.2...v3.1.0)
3
+
4
+ Enhancements:
5
+
6
+ * Switch to using the `have_http_status` matcher in spec generators. (Aaron Kromer, #1086)
7
+ * Update `rails_helper` generator to allow users to opt-in to auto-loading
8
+ `spec/support` files instead of forcing it upon them. (Aaron Kromer, #1137)
9
+ * Include generator for `ActiveJob`. (Abdelkader Boudih, #1155)
10
+ * Improve support for non-ActiveRecord apps by not loading ActiveRecord related
11
+ settings in the generated `rails_helper`. (Aaron Kromer, #1150)
12
+ * Remove Ruby warnings as a suggested configuration. (Aaron Kromer, #1163)
13
+
14
+ Bug Fixes:
15
+
16
+ * Fix controller route lookup for Rails 4.2. (Tomohiro Hashidate, #1142)
17
+
1
18
  ### 3.0.2 / 2014-07-21
2
19
  [Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.0.1...v3.0.2)
3
20
 
data/README.md CHANGED
@@ -102,7 +102,7 @@ Use model specs to describe behavior of models (usually ActiveRecord-based) in
102
102
  the application.
103
103
 
104
104
  Model specs default to residing in the `spec/models` folder. Tagging any
105
- context with the metadata `:type => :model` treats it's examples as model
105
+ context with the metadata `:type => :model` treats its examples as model
106
106
  specs.
107
107
 
108
108
  For example:
@@ -128,7 +128,7 @@ specs](https://www.relishapp.com/rspec/rspec-rails/docs/model-specs).
128
128
  Use controller specs to describe behavior of Rails controllers.
129
129
 
130
130
  Controller specs default to residing in the `spec/controllers` folder. Tagging
131
- any context with the metadata `:type => :controller` treats it's examples as
131
+ any context with the metadata `:type => :controller` treats its examples as
132
132
  controller specs.
133
133
 
134
134
  For example:
@@ -177,7 +177,7 @@ end using a black box approach.
177
177
 
178
178
  Request specs default to residing in the `spec/requests`, `spec/api`, and
179
179
  `spec/integration` directories. Tagging any context with the metadata `:type =>
180
- :request` treats it's examples as request specs.
180
+ :request` treats its examples as request specs.
181
181
 
182
182
  Request specs mix in behavior from
183
183
  [ActionDispatch::Integration::Runner](http://api.rubyonrails.org/classes/ActionDispatch/Integration/Runner.html),
@@ -247,7 +247,7 @@ Feature specs test your application from the outside by simulating a browser.
247
247
  simulated browser.
248
248
 
249
249
  Feature specs default to residing in the `spec/features` folder. Tagging any
250
- context with the metadata `:type => :feature` treats it's examples as feature
250
+ context with the metadata `:type => :feature` treats its examples as feature
251
251
  specs.
252
252
 
253
253
  Feature specs mix in functionality from the capybara gem, thus they require
@@ -263,7 +263,7 @@ specs](https://www.relishapp.com/rspec/rspec-rails/v/3-0/docs/feature-specs/feat
263
263
  ## View specs
264
264
 
265
265
  View specs default to residing in the `spec/views` folder. Tagging any context
266
- with the metadata `:type => :view` treats it's examples as view specs.
266
+ with the metadata `:type => :view` treats its examples as view specs.
267
267
 
268
268
  View specs mix in `ActionView::TestCase::Behavior`.
269
269
 
@@ -370,7 +370,7 @@ expect(rendered).to xxx
370
370
  ## Routing specs
371
371
 
372
372
  Routing specs default to residing in the `spec/routing` folder. Tagging any
373
- context with the metadata `:type => :routing` treats it's examples as routing
373
+ context with the metadata `:type => :routing` treats its examples as routing
374
374
  specs.
375
375
 
376
376
  ```ruby
@@ -399,7 +399,7 @@ instead.
399
399
  ## Helper specs
400
400
 
401
401
  Helper specs default to residing in the `spec/helpers` folder. Tagging any
402
- context with the metadata `:type => :helper` treats it's examples as helper
402
+ context with the metadata `:type => :helper` treats its examples as helper
403
403
  specs.
404
404
 
405
405
  Helper specs mix in ActionView::TestCase::Behavior. A `helper` object is
@@ -7,8 +7,12 @@ module Rspec
7
7
  module Generators
8
8
  # @private
9
9
  class Base < ::Rails::Generators::NamedBase
10
- def self.source_root
11
- @_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
10
+ def self.source_root(path = nil)
11
+ if path
12
+ @_rspec_source_root = path
13
+ else
14
+ @_rspec_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'rspec', generator_name, 'templates'))
15
+ end
12
16
  end
13
17
 
14
18
  if ::Rails::VERSION::STRING < '3.1'
@@ -27,10 +31,10 @@ module Rails
27
31
  class GeneratedAttribute
28
32
  def input_type
29
33
  @input_type ||= if type == :text
30
- "textarea"
31
- else
32
- "input"
33
- end
34
+ "textarea"
35
+ else
36
+ "input"
37
+ end
34
38
  end
35
39
  end
36
40
  end
@@ -7,7 +7,7 @@ RSpec.describe <%= class_name %>Controller, :type => :controller do
7
7
  describe "GET <%= action %>" do
8
8
  it "returns http success" do
9
9
  get :<%= action %>
10
- expect(response).to be_success
10
+ expect(response).to have_http_status(:success)
11
11
  end
12
12
  end
13
13
 
@@ -1,12 +1,12 @@
1
1
  require "rspec/support"
2
2
  require "rspec/core"
3
3
  RSpec::Support.require_rspec_core "project_initializer"
4
+ require "rspec/rails/feature_check"
4
5
 
5
6
  module Rspec
6
7
  module Generators
7
8
  # @private
8
9
  class InstallGenerator < ::Rails::Generators::Base
9
-
10
10
  desc <<DESC
11
11
  Description:
12
12
  Copy rspec files to your application.
@@ -36,11 +36,28 @@ DESC
36
36
  :report_stream => StringIO.new
37
37
  )
38
38
  initializer.run
39
- gsub_file File.join(tmpdir, 'spec', 'spec_helper.rb'),
39
+
40
+ spec_helper_path = File.join(tmpdir, 'spec', 'spec_helper.rb')
41
+
42
+ replace_generator_command(spec_helper_path)
43
+ remove_warnings_configuration(spec_helper_path)
44
+ end
45
+
46
+ def replace_generator_command(spec_helper_path)
47
+ gsub_file spec_helper_path,
40
48
  'rspec --init',
41
49
  'rails generate rspec:install',
42
50
  :verbose => false
43
51
  end
52
+
53
+ def remove_warnings_configuration(spec_helper_path)
54
+ empty_line = '^\n'
55
+ comment_line = '^\s*#.+\n'
56
+ gsub_file spec_helper_path,
57
+ /#{empty_line}(#{comment_line})+\s+config\.warnings = true\n/,
58
+ '',
59
+ :verbose => false
60
+ end
44
61
  end
45
62
  end
46
63
  end
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
3
3
  require 'spec_helper'
4
4
  require File.expand_path("../../config/environment", __FILE__)
5
5
  require 'rspec/rails'
6
+ # Add additional requires below this line. Rails is not loaded until this point!
6
7
 
7
8
  # Requires supporting ruby files with custom matchers and macros, etc, in
8
9
  # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
@@ -11,20 +12,27 @@ require 'rspec/rails'
11
12
  # run twice. It is recommended that you do not name files matching this glob to
12
13
  # end with _spec.rb. You can configure this pattern with the --pattern
13
14
  # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
14
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
15
+ #
16
+ # The following line is provided for convenience purposes. It has the downside
17
+ # of increasing the boot-up time by auto-requiring all files in the support
18
+ # directory. Alternatively, in the individual `*_spec.rb` files, manually
19
+ # require only the support files necessary.
20
+ #
21
+ # Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
15
22
 
16
- <% if ::Rails::VERSION::STRING >= '4.1' -%>
23
+ <% if RSpec::Rails::FeatureCheck.can_maintain_test_schema? -%>
17
24
  # Checks for pending migrations before tests are run.
18
25
  # If you are not using ActiveRecord, you can remove this line.
19
26
  ActiveRecord::Migration.maintain_test_schema!
20
27
 
21
- <% elsif ::Rails::VERSION::STRING >= '4' -%>
28
+ <% elsif RSpec::Rails::FeatureCheck.can_check_pending_migrations? -%>
22
29
  # Checks for pending migrations before tests are run.
23
30
  # If you are not using ActiveRecord, you can remove this line.
24
- ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
31
+ ActiveRecord::Migration.check_pending!
25
32
 
26
33
  <% end -%>
27
34
  RSpec.configure do |config|
35
+ <% if RSpec::Rails::FeatureCheck.has_active_record? -%>
28
36
  # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
37
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
30
38
 
@@ -33,6 +41,7 @@ RSpec.configure do |config|
33
41
  # instead of true.
34
42
  config.use_transactional_fixtures = true
35
43
 
44
+ <% end -%>
36
45
  # RSpec Rails can automatically mix in different behaviours to your tests
37
46
  # based on their file location, for example enabling you to call `get` and
38
47
  # `post` in specs under `spec/controllers`.
@@ -4,7 +4,7 @@ RSpec.describe "<%= class_name.pluralize %>", :type => :request do
4
4
  describe "GET /<%= table_name %>" do
5
5
  it "works! (now write some real specs)" do
6
6
  get <%= index_helper %>_path
7
- expect(response.status).to be(200)
7
+ expect(response).to have_http_status(200)
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,12 @@
1
+ require 'generators/rspec'
2
+
3
+ module Rspec
4
+ module Generators
5
+ # @private
6
+ class JobGenerator < Base
7
+ def create_job_spec
8
+ template 'job_spec.rb.erb', File.join('spec/jobs', class_path, "#{file_name}_job_spec.rb")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ require 'rails_helper'
2
+
3
+ <% module_namespacing do -%>
4
+ RSpec.describe <%= class_name %>Job, :type => :job do
5
+ pending "add some examples to (or delete) #{__FILE__}"
6
+ end
7
+ <% end -%>
@@ -4,19 +4,32 @@ module Rspec
4
4
  module Generators
5
5
  # @private
6
6
  class ModelGenerator < Base
7
- argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
7
+ argument :attributes,
8
+ :type => :array,
9
+ :default => [],
10
+ :banner => "field:type field:type"
8
11
  class_option :fixture, :type => :boolean
9
12
 
10
13
  def create_model_spec
11
- template 'model_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
14
+ template_file = File.join(
15
+ 'spec/models',
16
+ class_path,
17
+ "#{file_name}_spec.rb"
18
+ )
19
+ template 'model_spec.rb', template_file
12
20
  end
13
21
 
14
22
  hook_for :fixture_replacement
15
23
 
16
24
  def create_fixture_file
17
- if options[:fixture] && options[:fixture_replacement].nil?
18
- template 'fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml")
19
- end
25
+ return unless missing_fixture_replacement?
26
+ template 'fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml")
27
+ end
28
+
29
+ private
30
+
31
+ def missing_fixture_replacement?
32
+ options[:fixture] && options[:fixture_replacement].nil?
20
33
  end
21
34
  end
22
35
  end
@@ -21,8 +21,12 @@ module Rspec
21
21
  def generate_controller_spec
22
22
  return unless options[:controller_specs]
23
23
 
24
- template 'controller_spec.rb',
25
- File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
24
+ template_file = File.join(
25
+ 'spec/controllers',
26
+ controller_class_path,
27
+ "#{controller_file_name}_controller_spec.rb"
28
+ )
29
+ template 'controller_spec.rb', template_file
26
30
  end
27
31
 
28
32
  def generate_view_specs
@@ -37,123 +41,126 @@ module Rspec
37
41
  def generate_routing_spec
38
42
  return unless options[:routing_specs]
39
43
 
40
- template 'routing_spec.rb',
41
- File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
44
+ template_file = File.join(
45
+ 'spec/routing',
46
+ controller_class_path,
47
+ "#{controller_file_name}_routing_spec.rb"
48
+ )
49
+ template 'routing_spec.rb', template_file
42
50
  end
43
51
 
44
52
  hook_for :integration_tool, :as => :integration
45
53
 
46
- protected
54
+ protected
47
55
 
48
- def copy_view(view)
49
- template "#{view}_spec.rb",
50
- File.join("spec/views", controller_file_path, "#{view}.html.#{options[:template_engine]}_spec.rb")
51
- end
52
-
53
- def formatted_hash(hash)
54
- formatted = hash.inspect
55
- formatted.gsub!("{", "{ ")
56
- formatted.gsub!("}", " }")
57
- formatted.gsub!("=>", " => ")
58
- formatted
59
- end
56
+ def copy_view(view)
57
+ template "#{view}_spec.rb",
58
+ File.join("spec/views", controller_file_path, "#{view}.html.#{options[:template_engine]}_spec.rb")
59
+ end
60
60
 
61
- # support for namespaced-resources
62
- def ns_file_name
63
- ns_parts.empty? ? file_name : "#{ns_parts[0].underscore}_#{ns_parts[1].singularize.underscore}"
64
- end
61
+ def formatted_hash(hash)
62
+ formatted = hash.inspect
63
+ formatted.gsub!("{", "{ ")
64
+ formatted.gsub!("}", " }")
65
+ formatted.gsub!("=>", " => ")
66
+ formatted
67
+ end
65
68
 
66
- # support for namespaced-resources
67
- def ns_table_name
68
- ns_parts.empty? ? table_name : "#{ns_parts[0].underscore}/#{ns_parts[1].tableize}"
69
- end
69
+ # support for namespaced-resources
70
+ def ns_file_name
71
+ ns_parts.empty? ? file_name : "#{ns_parts[0].underscore}_#{ns_parts[1].singularize.underscore}"
72
+ end
70
73
 
71
- def ns_parts
72
- @ns_parts ||= begin
73
- matches = ARGV[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
74
- matches ? [matches[1], matches[2]] : []
75
- end
76
- end
74
+ # support for namespaced-resources
75
+ def ns_table_name
76
+ ns_parts.empty? ? table_name : "#{ns_parts[0].underscore}/#{ns_parts[1].tableize}"
77
+ end
77
78
 
78
- # Returns the name of the mock. For example, if the file name is user,
79
- # it returns mock_user.
80
- #
81
- # If a hash is given, it uses the hash key as the ORM method and the
82
- # value as response. So, for ActiveRecord and file name "User":
83
- #
84
- # mock_file_name(:save => true)
85
- # #=> mock_user(:save => true)
86
- #
87
- # If another ORM is being used and another method instead of save is
88
- # called, it will be the one used.
89
- #
90
- def mock_file_name(hash=nil)
91
- if hash
92
- method, and_return = hash.to_a.first
93
- method = orm_instance.send(method).split('.').last.gsub(/\(.*?\)/, '')
94
- "mock_#{ns_file_name}(:#{method} => #{and_return})"
95
- else
96
- "mock_#{ns_file_name}"
97
- end
98
- end
79
+ def ns_parts
80
+ @ns_parts ||= begin
81
+ matches = ARGV[0].to_s.match(/\A(\w+)(?:\/|::)(\w+)/)
82
+ matches ? [matches[1], matches[2]] : []
83
+ end
84
+ end
99
85
 
100
- # Receives the ORM chain and convert to expects. For ActiveRecord:
101
- #
102
- # should! orm_class.find(User, "37")
103
- # #=> User.should_receive(:find).with(37)
104
- #
105
- # For Datamapper:
106
- #
107
- # should! orm_class.find(User, "37")
108
- # #=> User.should_receive(:get).with(37)
109
- #
110
- def should_receive(chain)
111
- stub_or_should_chain(:should_receive, chain)
86
+ # Returns the name of the mock. For example, if the file name is user,
87
+ # it returns mock_user.
88
+ #
89
+ # If a hash is given, it uses the hash key as the ORM method and the
90
+ # value as response. So, for ActiveRecord and file name "User":
91
+ #
92
+ # mock_file_name(:save => true)
93
+ # #=> mock_user(:save => true)
94
+ #
95
+ # If another ORM is being used and another method instead of save is
96
+ # called, it will be the one used.
97
+ #
98
+ def mock_file_name(hash = nil)
99
+ if hash
100
+ method, and_return = hash.to_a.first
101
+ method = orm_instance.send(method).split('.').last.gsub(/\(.*?\)/, '')
102
+ "mock_#{ns_file_name}(:#{method} => #{and_return})"
103
+ else
104
+ "mock_#{ns_file_name}"
112
105
  end
106
+ end
113
107
 
114
- # Receives the ORM chain and convert to stub. For ActiveRecord:
115
- #
116
- # stub orm_class.find(User, "37")
117
- # #=> User.stub(:find).with(37)
118
- #
119
- # For Datamapper:
120
- #
121
- # stub orm_class.find(User, "37")
122
- # #=> User.stub(:get).with(37)
123
- #
124
- def stub(chain)
125
- stub_or_should_chain(:stub, chain)
126
- end
108
+ # Receives the ORM chain and convert to expects. For ActiveRecord:
109
+ #
110
+ # should! orm_class.find(User, "37")
111
+ # #=> User.should_receive(:find).with(37)
112
+ #
113
+ # For Datamapper:
114
+ #
115
+ # should! orm_class.find(User, "37")
116
+ # #=> User.should_receive(:get).with(37)
117
+ #
118
+ def should_receive(chain)
119
+ stub_or_should_chain(:should_receive, chain)
120
+ end
127
121
 
128
- def stub_or_should_chain(mode, chain)
129
- receiver, method = chain.split(".")
130
- method.gsub!(/\((.*?)\)/, '')
122
+ # Receives the ORM chain and convert to stub. For ActiveRecord:
123
+ #
124
+ # stub orm_class.find(User, "37")
125
+ # #=> User.stub(:find).with(37)
126
+ #
127
+ # For Datamapper:
128
+ #
129
+ # stub orm_class.find(User, "37")
130
+ # #=> User.stub(:get).with(37)
131
+ #
132
+ def stub(chain)
133
+ stub_or_should_chain(:stub, chain)
134
+ end
131
135
 
132
- response = "#{receiver}.#{mode}(:#{method})"
133
- response << ".with(#{$1})" unless $1.blank?
134
- response
135
- end
136
+ def stub_or_should_chain(mode, chain)
137
+ receiver, method = chain.split(".")
138
+ method.gsub!(/\((.*?)\)/, '')
136
139
 
137
- def value_for(attribute)
138
- raw_value_for(attribute).inspect
139
- end
140
+ response = "#{receiver}.#{mode}(:#{method})"
141
+ response << ".with(#{$1})" unless $1.blank?
142
+ response
143
+ end
140
144
 
141
- def raw_value_for(attribute)
142
- case attribute.type
143
- when :string
144
- attribute.name.titleize
145
- when :integer
146
- @attribute_id_map ||= {}
147
- @attribute_id_map[attribute] ||= @attribute_id_map.keys.size.next
148
- else
149
- attribute.default
150
- end
151
- end
145
+ def value_for(attribute)
146
+ raw_value_for(attribute).inspect
147
+ end
152
148
 
153
- def banner
154
- self.class.banner
149
+ def raw_value_for(attribute)
150
+ case attribute.type
151
+ when :string
152
+ attribute.name.titleize
153
+ when :integer
154
+ @attribute_id_map ||= {}
155
+ @attribute_id_map[attribute] ||= @attribute_id_map.keys.size.next
156
+ else
157
+ attribute.default
155
158
  end
159
+ end
156
160
 
161
+ def banner
162
+ self.class.banner
163
+ end
157
164
  end
158
165
  end
159
166
  end