Permalink
Browse files

Delete helpers, add featers, delete views spec, add gems.

  • Loading branch information...
1 parent 5c197b1 commit e732c9e92bc69759b97720f9f8bbda843b48499a @lisovskyvlad committed Jun 17, 2012
View
@@ -11,3 +11,4 @@
/log/*.log
/tmp
keys.rb
+.rspec
View
@@ -1 +1 @@
---colour
+--colour --format documentation
View
@@ -9,31 +9,36 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
gem 'twitter-bootstrap-rails'
end
+gem 'jquery-rails'
+
+gem 'omniauth-twitter'
gem 'mongoid'
gem 'bson_ext'
-gem 'jquery-rails'
gem 'haml'
-gem 'haml-rails', :group => :development
gem 'simple_form'
-
-gem 'thin'
-gem 'quiet_assets', :group => :development
-
-gem 'rspec-rails', :group => [:test, :development]
-
group :development do
+ gem 'rails3-generators', :git => 'https://github.com/neocoin/rails3-generators.git'
+ gem 'quiet_assets'
+ gem 'thin'
+ gem 'haml-rails'
+
+ gem 'pry-rails'
+end
+
+group :development, :test do
+ gem 'rspec-rails'
gem 'factory_girl_rails'
- gem "rails3-generators", :git => "https://github.com/neocoin/rails3-generators.git"
+ gem 'mongoid-rspec'
end
group :test do
- gem 'database_cleaner'
gem 'cucumber-rails', :require => false
gem 'capybara'
+ gem 'faker'
+ gem 'launchy'
+ gem 'guard-rspec'
end
-
-gem 'omniauth-twitter'
View
@@ -50,6 +50,7 @@ GEM
xpath (~> 0.1.4)
childprocess (0.3.2)
ffi (~> 1.0.6)
+ coderay (1.0.6)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
@@ -68,7 +69,6 @@ GEM
cucumber (>= 1.1.8)
nokogiri (>= 1.5.0)
daemons (1.1.8)
- database_cleaner (0.8.0)
diff-lcs (1.1.3)
erubis (2.7.0)
eventmachine (0.12.10)
@@ -79,9 +79,16 @@ GEM
factory_girl_rails (3.4.0)
factory_girl (~> 3.4.0)
railties (>= 3.0.0)
+ faker (1.0.1)
+ i18n (~> 0.4)
ffi (1.0.11)
gherkin (2.11.0)
json (>= 1.4.6)
+ guard (1.1.1)
+ listen (>= 0.4.2)
+ thor (>= 0.14.6)
+ guard-rspec (1.0.1)
+ guard (>= 1.1)
haml (3.1.6)
haml-rails (0.3.4)
actionpack (~> 3.0)
@@ -96,6 +103,8 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.3)
+ launchy (2.1.0)
+ addressable (~> 2.2.6)
less (2.2.1)
commonjs (~> 0.2.6)
less-rails (2.2.3)
@@ -104,17 +113,26 @@ GEM
libv8 (3.3.10.4)
libwebsocket (0.1.3)
addressable
+ listen (0.4.5)
+ rb-fchange (~> 0.0.5)
+ rb-fsevent (~> 0.9.1)
+ rb-inotify (~> 0.8.8)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
+ method_source (0.7.1)
mime-types (1.18)
mongo (1.6.2)
bson (~> 1.6.2)
mongoid (2.4.11)
activemodel (~> 3.1)
mongo (<= 1.6.2)
tzinfo (~> 0.3.22)
+ mongoid-rspec (1.4.5)
+ mongoid (>= 2.4.6)
+ rake
+ rspec (>= 2.9)
multi_json (1.3.6)
nokogiri (1.5.4)
oauth (0.4.6)
@@ -128,6 +146,12 @@ GEM
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
polyglot (0.3.3)
+ pry (0.9.9.6)
+ coderay (~> 1.0.5)
+ method_source (~> 0.7.1)
+ slop (>= 2.4.4, < 3)
+ pry-rails (0.1.6)
+ pry
quiet_assets (1.0.1)
railties (~> 3.1)
rack (1.4.1)
@@ -153,6 +177,11 @@ GEM
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
+ rb-fchange (0.0.5)
+ ffi
+ rb-fsevent (0.9.1)
+ rb-inotify (0.8.8)
+ ffi (>= 0.5.0)
rdoc (3.12)
json (~> 1.4)
rspec (2.10.0)
@@ -183,6 +212,7 @@ GEM
simple_form (2.0.2)
actionpack (~> 3.0)
activemodel (~> 3.0)
+ slop (2.4.4)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
@@ -218,13 +248,17 @@ DEPENDENCIES
capybara
coffee-rails (~> 3.2.1)
cucumber-rails
- database_cleaner
factory_girl_rails
+ faker
+ guard-rspec
haml
haml-rails
jquery-rails
+ launchy
mongoid
+ mongoid-rspec
omniauth-twitter
+ pry-rails
quiet_assets
rails (= 3.2.6)
rails3-generators!
@@ -1,2 +0,0 @@
-module ApplicationHelper
-end
@@ -1,2 +0,0 @@
-module PostsHelper
-end
View
@@ -1,5 +1,5 @@
class Post
include Mongoid::Document
- field :title, :type => String
- field :content, :type => String
+ field :title, type: String
+ field :content, type: String
end
View
@@ -70,9 +70,18 @@ class Application < Rails::Application
config.sass.preferred_syntax = :sass
config.generators do |g|
+ g.helper false
+
+ g.test_framework :rspec,
+ fixtures: true,
+ view_specs: false,
+ helper_specs: false,
+ routing_specs: false,
+ controller_specs: true,
+ request_specs: true
+ g.fixture_replacement :factory_girl, dir: "spec/factories"
+
g.template_engine :haml
- g.test_framework :rspec, :fixture => true, :views => false
- g.fixture_replacement :factory_girl, :dir => 'spec/factories'
g.form_builder :simple_form
g.orm :mongoid
end
@@ -0,0 +1,23 @@
+# env.rb
+
+ENV["RAILS_ENV"] ||= "test"
+require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
+
+require 'cucumber/formatter/unicode'
+require 'cucumber/rails/rspec'
+require 'cucumber/rails/world'
+require 'cucumber/web/tableish'
+
+require 'capybara/rails'
+require 'capybara/cucumber'
+require 'capybara/session'
+require 'cucumber/rails/capybara_javascript_emulation'
+
+Capybara.default_selector = :css
+
+ActionController::Base.allow_rescue = false
+
+require 'factory_girl'
+require 'factory_girl/step_definitions'
+Dir[File.expand_path(File.join(File.dirname(__FILE__),'..','..', 'spec','factories','*.rb'))].each {|f| require f}
+
@@ -0,0 +1,5 @@
+# features/support/hooks.rb
+
+Before do |scenario|
+ Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
+end
@@ -36,9 +36,9 @@ def valid_session
describe "GET index" do
it "assigns all posts as @posts" do
- post = Post.create! valid_attributes
- get :index, {}, valid_session
- assigns(:posts).should eq([post])
+ post = FactoryGirl.create(:post)
+ get :index
+ assigns(:posts).to_a.should eq([post])
end
end
@@ -1,8 +1,10 @@
# Read about factories at https://github.com/thoughtbot/factory_girl
+require 'faker'
+
FactoryGirl.define do
factory :post do
- title "MyString"
- content "MyString"
+ title 'Title'
+ content { Faker::Lorem::paragraph 10 }
end
end
@@ -1,15 +0,0 @@
-require 'spec_helper'
-
-# Specs in this file have access to a helper object that includes
-# the PostsHelper. For example:
-#
-# describe PostsHelper do
-# describe "string concat" do
-# it "concats two strings with spaces" do
-# helper.concat_strings("this","that").should == "this that"
-# end
-# end
-# end
-describe PostsHelper do
- pending "add some examples to (or delete) #{__FILE__}"
-end
View
@@ -1,25 +1,19 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../config/environment", __FILE__)
+ENV['RAILS_ENV'] ||= 'test'
+require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
+require 'capybara/rspec'
+require 'factory_girl'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
-Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f}
RSpec.configure do |config|
- # ## Mock Framework
- #
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
- #
- # config.mock_with :mocha
- # config.mock_with :flexmock
- # config.mock_with :rr
-
-
- # If true, the base class of anonymous controllers will be inferred
- # automatically. This will be the default behavior in future versions of
- # rspec-rails.
- config.infer_base_class_for_anonymous_controllers = false
+ config.mock_with :rspec
+ config.include Mongoid::Matchers
+ config.before :each do
+ Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
+ end
end
@@ -1,20 +0,0 @@
-require 'spec_helper'
-
-describe "posts/edit" do
- before(:each) do
- @post = assign(:post, stub_model(Post,
- :title => "MyString",
- :content => "MyString"
- ))
- end
-
- it "renders the edit post form" do
- render
-
- # Run the generator again with the --webrat flag if you want to use webrat matchers
- assert_select "form", :action => posts_path(@post), :method => "post" do
- assert_select "input#post_title", :name => "post[title]"
- assert_select "input#post_content", :name => "post[content]"
- end
- end
-end
@@ -1,23 +0,0 @@
-require 'spec_helper'
-
-describe "posts/index" do
- before(:each) do
- assign(:posts, [
- stub_model(Post,
- :title => "Title",
- :content => "Content"
- ),
- stub_model(Post,
- :title => "Title",
- :content => "Content"
- )
- ])
- end
-
- it "renders a list of posts" do
- render
- # Run the generator again with the --webrat flag if you want to use webrat matchers
- assert_select "tr>td", :text => "Title".to_s, :count => 2
- assert_select "tr>td", :text => "Content".to_s, :count => 2
- end
-end
@@ -1,20 +0,0 @@
-require 'spec_helper'
-
-describe "posts/new" do
- before(:each) do
- assign(:post, stub_model(Post,
- :title => "MyString",
- :content => "MyString"
- ).as_new_record)
- end
-
- it "renders new post form" do
- render
-
- # Run the generator again with the --webrat flag if you want to use webrat matchers
- assert_select "form", :action => posts_path, :method => "post" do
- assert_select "input#post_title", :name => "post[title]"
- assert_select "input#post_content", :name => "post[content]"
- end
- end
-end
Oops, something went wrong. Retry.

0 comments on commit e732c9e

Please sign in to comment.