Permalink
Browse files

Switch to rspec

  • Loading branch information...
1 parent ec57b6b commit e8df3cf0c42f46718da8a504c4fcd52f3bb266b7 @jetaggart jetaggart committed Apr 20, 2014
View
@@ -0,0 +1,4 @@
+KOBOL_SECRET=somesecret
+KOBOL_DOMAIN=localhost
+GITHUB_KEY=github_key
+GITHUB_SECRET=github_secret
View
@@ -1,2 +1,4 @@
.idea
-*.iml
+*.iml
+.env
+.rspec
View
@@ -3,8 +3,14 @@ source "http://rubygems.org"
ruby "2.1.1"
gem 'rake'
+gem 'dotenv'
gem 'octokit'
gem 'omniauth-github'
gem 'sinatra'
gem 'github-markup'
gem 'rdiscount'
+
+group :test do
+ gem 'rspec'
+ gem 'capybara'
+end
View
@@ -2,16 +2,28 @@ GEM
remote: http://rubygems.org/
specs:
addressable (2.3.6)
+ capybara (2.2.1)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ xpath (~> 2.0)
+ diff-lcs (1.2.5)
+ dotenv (0.10.0)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
github-markup (1.2.0)
posix-spawn (~> 0.3.8)
hashie (2.1.1)
jwt (0.1.11)
multi_json (>= 1.5)
+ mime-types (2.1)
+ mini_portile (0.5.2)
multi_json (1.9.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
+ nokogiri (1.6.1)
+ mini_portile (~> 0.5.0)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
@@ -35,8 +47,18 @@ GEM
rack (1.5.2)
rack-protection (1.5.3)
rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
rake (10.3.1)
rdiscount (2.1.7.1)
+ rspec (2.14.1)
+ rspec-core (~> 2.14.0)
+ rspec-expectations (~> 2.14.0)
+ rspec-mocks (~> 2.14.0)
+ rspec-core (2.14.7)
+ rspec-expectations (2.14.5)
+ diff-lcs (>= 1.1.3, < 2.0)
+ rspec-mocks (2.14.6)
sawyer (0.5.4)
addressable (~> 2.3.5)
faraday (~> 0.8, < 0.10)
@@ -45,14 +67,19 @@ GEM
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
tilt (1.4.1)
+ xpath (2.0.0)
+ nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
+ capybara
+ dotenv
github-markup
octokit
omniauth-github
rake
rdiscount
+ rspec
sinatra
View
@@ -1,6 +1,6 @@
-require 'rake/testtask'
-Rake::TestTask.new do |t|
- t.pattern = "test/*/*_test.rb"
-end
+require 'rspec/core/rake_task'
-task :default => [:test]
+desc "run specs"
+RSpec::Core::RakeTask.new
+
+task :default => :spec
View
@@ -1,4 +1,7 @@
APP_ROOT = File.dirname(__FILE__)
require './lib/kobol'
+require 'dotenv'
+Dotenv.load
+
run Kobol::App
View
@@ -24,7 +24,6 @@ class App < Sinatra::Base
enable :sessions
set :session_secret, ENV["KOBOL_SECRET"]
-
set :public_folder, APP_ROOT + '/public'
set :views, APP_ROOT + "/views"
@@ -63,7 +62,7 @@ class App < Sinatra::Base
redirect "/"
end
- def retrieve_issues page=1
+ def retrieve_issues(page=1)
@issues = []
github { issues_request.search(parameters(params), page) }
@@ -0,0 +1,9 @@
+require_relative '../spec_helper'
+
+describe "viewing the homepage", :type => :feature do
+ it "shows the page" do
+ visit "/"
+
+ expect(page).to have_content("issuehub")
+ end
+end
@@ -1,4 +1,4 @@
-require_relative '../test_helper'
+require_relative '../spec_helper'
describe Kobol::Requests::Issues do
let(:issues) { Kobol::Requests::Issues.new }
@@ -11,6 +11,6 @@
properties = { label: ["bug", "refactoring"], language: ["ruby"] }
processed_properties = %{label:"bug" label:"refactoring" language:"ruby"}
- issues.search_params(properties).must_equal(processed_properties)
+ expect(issues.search_params(properties)).to eq(processed_properties)
end
end
View
@@ -0,0 +1,13 @@
+APP_ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
+$:.unshift File.expand_path File.join(APP_ROOT, "lib")
+require 'bundler/setup'
+require 'dotenv'
+
+Dotenv.load(File.expand_path File.join(APP_ROOT, '.env'))
+
+Bundler.require(:test)
+require 'kobol'
+require 'capybara/rspec'
+
+Capybara.app = Kobol::App
+
View
@@ -1,5 +0,0 @@
-APP_ROOT = File.expand_path File.join(File.dirname(__FILE__), '..')
-$:.unshift File.expand_path File.join(APP_ROOT, "lib")
-
-require 'kobol'
-require 'minitest/autorun'

0 comments on commit e8df3cf

Please sign in to comment.