Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add writer for custom option

  • Loading branch information...
commit 31fd5e6532dc089206013641945d95142f33fb29 1 parent 16e7f6b
David Chelimsky dchelimsky authored
2  lib/rspec/core/configuration.rb
View
@@ -243,7 +243,7 @@ def add_option(mname, options)
case options[:type]
when :boolean
(class << self; self; end).class_eval do
- attr_reader mname
+ attr_accessor mname
define_method("#{mname}?") { !!(send mname) }
end
instance_variable_set "@#{mname}", options[:default]
6 rspec-core.gemspec
View
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.authors = ["Chad Humphries", "David Chelimsky"]
- s.date = %q{2010-05-07}
+ s.date = %q{2010-05-15}
s.description = %q{Rspec runner and example group classes}
s.email = %q{dchelimsky@gmail.com;chad.humphries@gmail.com}
s.executables = ["rspec", "spec"]
@@ -75,12 +75,14 @@ Gem::Specification.new do |s|
"example_specs/passing/stack_spec.rb",
"example_specs/passing/stack_spec_with_nested_example_groups.rb",
"example_specs/passing/stubbing_example.rb",
+ "example_specs/passing/subject_example.rb",
"example_specs/passing/yielding_example.rb",
"example_specs/ruby1.9.compatibility/access_to_constants_spec.rb",
"example_specs/spec_helper.rb",
"features/command_line/example_name_option.feature",
"features/command_line/line_number_appended_to_path.feature",
"features/command_line/line_number_option.feature",
+ "features/configuration/custom_options.feature",
"features/configuration/options_file.feature",
"features/example_groups/describe_aliases.feature",
"features/example_groups/nested_groups.feature",
@@ -140,6 +142,7 @@ Gem::Specification.new do |s|
"spec/autotest/rspec_spec.rb",
"spec/rspec/core/configuration_options_spec.rb",
"spec/rspec/core/configuration_spec.rb",
+ "spec/rspec/core/deprecations_spec.rb",
"spec/rspec/core/example_group_spec.rb",
"spec/rspec/core/example_spec.rb",
"spec/rspec/core/formatters/base_formatter_spec.rb",
@@ -186,6 +189,7 @@ Gem::Specification.new do |s|
"spec/autotest/rspec_spec.rb",
"spec/rspec/core/configuration_options_spec.rb",
"spec/rspec/core/configuration_spec.rb",
+ "spec/rspec/core/deprecations_spec.rb",
"spec/rspec/core/example_group_spec.rb",
"spec/rspec/core/example_spec.rb",
"spec/rspec/core/formatters/base_formatter_spec.rb",
10 spec/rspec/core/configuration_spec.rb
View
@@ -273,6 +273,11 @@ def that_thing
it "adds a predicate" do
config.custom_option?.should be_false
end
+
+ it "can be overridden" do
+ config.custom_option = true
+ config.custom_option.should be_true
+ end
end
context "with :default => true" do
@@ -285,6 +290,11 @@ def that_thing
it "adds a predicate" do
config.custom_option?.should be_true
end
+
+ it "can be overridden" do
+ config.custom_option = false
+ config.custom_option.should be_false
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.