forked from codegram/spinach
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3ebbd99
commit 48617e6
Showing
5 changed files
with
62 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class UserLogsIn < Spinach::Feature | ||
feature "User logs in" | ||
|
||
Given 'I am not logged in' do | ||
123 | ||
end | ||
|
||
When 'I log in' do | ||
@a = 'hey' | ||
end | ||
|
||
Then 'I should be logged in' do | ||
user.must_equal 'heyo' | ||
end | ||
|
||
private | ||
|
||
def user | ||
@user ||= User.make | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Spinach | ||
def self.config | ||
@config ||= Config.new | ||
end | ||
class Config | ||
attr_writer :step_definitions_path | ||
def step_definitions_path | ||
@step_definitions_path || 'features/steps' | ||
end | ||
def [](attribute) | ||
self.send(attribute) | ||
end | ||
def []=(attribute, params) | ||
self.send("#{attribute}=", params) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require_relative '../test_helper' | ||
|
||
describe Spinach::Config do | ||
describe "#step_definitions_path" do | ||
it "returns a default" do | ||
(Spinach.config[:step_definitions_path].kind_of? String).must_equal true | ||
end | ||
it "can be overwritten" do | ||
Spinach.config[:step_definitions_path] = 'steps' | ||
Spinach.config[:step_definitions_path].must_equal 'steps' | ||
end | ||
end | ||
end |