Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified and extracted config to Gitnesse::Configuration
- Loading branch information
Andrew Stewart
committed
Nov 30, 2012
1 parent
54ecaa5
commit 66eb101
Showing
11 changed files
with
65 additions
and
115 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
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
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
module Gitnesse | |||
class Configuration | |||
attr_accessor :repository_url | |||
attr_accessor :branch | |||
attr_accessor :target_directory | |||
|
|||
def initialize | |||
@branch = 'master' | |||
@target_directory = File.join(Dir.pwd, 'features') | |||
end | |||
|
|||
# Public: Returns the current Gitnesse configuration as a Hash | |||
# | |||
# Returns a hash containing the current Gitnesse configuration | |||
def to_hash | |||
{ 'repository_url' => @repository_url, | |||
'branch' => @branch, | |||
'target_directory' => @target_directory } | |||
end | |||
end | |||
end |
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
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
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
15 changes: 8 additions & 7 deletions
15
test/lib/gitnesse/config_to_hash_test.rb → ...ib/gitnesse/configuration_to_hash_test.rb
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
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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,25 +1,24 @@ | |||
require_relative '../../test_helper' | require_relative '../../test_helper' | ||
|
|
||
describe Gitnesse do | describe Gitnesse::Configuration do | ||
describe "#branch" do | describe "#branch" do | ||
describe "defaults to 'master'" do | describe "defaults to 'master'" do | ||
before { Gitnesse.branch nil } | it { Gitnesse.configuration.branch.must_equal "master" } | ||
it { Gitnesse.branch.must_equal "master" } | |||
end | end | ||
|
|
||
describe "when changed" do | describe "when changed" do | ||
before { Gitnesse.branch "wiki" } | before { Gitnesse.configuration.branch = "wiki" } | ||
it { Gitnesse.branch.must_equal "wiki" } | it { Gitnesse.configuration.branch.must_equal "wiki" } | ||
end | end | ||
|
|
||
describe "when changed through #config" do | describe "when changed through #configure" do | ||
before do | before do | ||
Gitnesse.config do | Gitnesse.configure do |config| | ||
branch "wiki" | config.branch = "wiki" | ||
end | end | ||
end | end | ||
|
|
||
it { Gitnesse.branch.must_equal "wiki" } | it { Gitnesse.configuration.branch.must_equal "wiki" } | ||
end | end | ||
end | end | ||
end | end |
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
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