-
-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add @wip feature describing custom boolean option
- Loading branch information
1 parent
b78129b
commit f720e8b
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@wip | ||
Feature: custom options | ||
|
||
In order to seamlessly provide my users more options | ||
As an Rspec extenstion-library author | ||
I want to define new options on the Rspec.configuration | ||
|
||
Scenario: boolean option with default settings | ||
Given a file named "boolean_option_spec.rb" with: | ||
""" | ||
Rspec.configure do |c| | ||
c.add_option :custom_option, :type => :boolean | ||
end | ||
describe "custom option" do | ||
it "is false by default" do | ||
Rspec.configuration.custom_option.should be_false | ||
end | ||
it "is exposed as a predicate" do | ||
Rspec.configuration.custom_option?.should be_false | ||
end | ||
end | ||
""" | ||
When I run "rspec boolean_option_spec.rb" | ||
Then I should see "2 examples, 0 failures" | ||
|
||
Scenario: boolean option set to default to true | ||
Given a file named "boolean_option_spec.rb" with: | ||
""" | ||
Rspec.configure do |c| | ||
c.add_option :custom_option, :type => :boolean, :default => true | ||
end | ||
describe "custom option" do | ||
it "is true by default" do | ||
Rspec.configuration.custom_option.should be_true | ||
end | ||
it "is exposed as a predicate" do | ||
Rspec.configuration.custom_option?.should be_true | ||
end | ||
end | ||
""" | ||
When I run "rspec boolean_option_spec.rb" | ||
Then I should see "2 examples, 0 failures" | ||
|
||
Scenario: boolean option overridden in client app | ||
Given a file named "boolean_option_spec.rb" with: | ||
""" | ||
Rspec.configure do |c| | ||
c.add_option :custom_option, :type => :boolean | ||
end | ||
Rspec.configure do |c| | ||
c.custom_option = :reset | ||
end | ||
describe "custom option" do | ||
it "returns the value set in the client app" do | ||
Rspec.configuration.custom_option.should == :reset | ||
end | ||
it "is exposed as a predicate" do | ||
Rspec.configuration.custom_option?.should be_true | ||
end | ||
end | ||
""" | ||
When I run "rspec boolean_option_spec.rb" | ||
Then I should see "2 examples, 0 failures" | ||
|