Skip to content

Commit ca1ffff

Browse files
committed
First steak test runs.
Okay! We have our signup test running with steak. Cool stuff.
1 parent 072f995 commit ca1ffff

4 files changed

Lines changed: 51 additions & 4 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require File.dirname(__FILE__) + "/../spec_helper"
2+
3+
require 'capybara/dsl'
4+
require 'steak'
5+
6+
RSpec.configure do |config|
7+
8+
config.include Capybara
9+
10+
end
11+
12+
13+
require 'sinatra'
14+
require 'rack/test'
15+
set :environment, :test
16+
17+
app_file = File.join(File.dirname(__FILE__), '..', '..', 'hackety.rb')
18+
require app_file
19+
Sinatra::Application.app_file = app_file
20+
Capybara.app = Sinatra::Application
21+
22+
Capybara.save_and_open_page_path = '/tmp'
23+
Capybara.javascript_driver = :culerity
24+
25+
Dir["#{File.dirname(__FILE__)}/support/*.rb"].each {|f| require f}

spec/acceptance/hacker_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
require File.dirname(__FILE__) + '/acceptance_helper'
2+
3+
feature "Hackers" do
4+
5+
scenario "can register" do
6+
7+
visit '/signup'
8+
9+
fill_in "Email", :with => "steve@example.com"
10+
fill_in "Username", :with => "steve"
11+
fill_in "Password", :with => "foobar"
12+
fill_in "Confirm Password", :with => "foobar"
13+
click_button "Create account"
14+
15+
page.should have_content "Account created."
16+
should_be_on "/"
17+
end
18+
19+
end

spec/acceptance/support/helpers.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def should_be_on(path)
2+
page.current_url.should match(Regexp.new(path))
3+
end
4+
5+
def should_not_be_on(path)
6+
page.current_url.should_not match(Regexp.new(path))
7+
end

spec/spec_helper.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
require 'rubygems'
22
require 'rspec'
33
require 'database_cleaner'
4-
require 'sinatra'
5-
require 'rack/test'
64
require 'factory_girl'
7-
set :environment, :test
85

9-
require 'hackety'
106

117
RSpec.configure do |config|
128
config.mock_with :rspec

0 commit comments

Comments
 (0)