Skip to content

Commit

Permalink
updating rspec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulat committed Jul 28, 2015
1 parent 6d8f7a6 commit 4e03e3d
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 60 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ group :development, :test do
gem 'factory_girl_rails', "~> 1.1"
gem 'rspec', "~> 2.6"
gem 'rspec-rails', "~> 2.6"
gem 'rspec-its'
gem 'simplecov', :require => false
end
11 changes: 1 addition & 10 deletions spec/controllers/accounts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Plutus
routes { Plutus::Engine.routes }

def mock_account(stubs={})
@mock_account ||= mock_model(Account, stubs)
@mock_account ||= FactoryGirl.create(:asset)
end

describe "GET index" do
Expand All @@ -15,14 +15,5 @@ def mock_account(stubs={})
assigns[:accounts].should == [mock_account]
end
end

describe "GET show" do
it "assigns the requested account as @account" do
Account.stub(:find).with("37").and_return(mock_account)
get :show, :id => "37"
assigns[:account].should equal(mock_account)
end
end

end
end
12 changes: 2 additions & 10 deletions spec/controllers/entries_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@ module Plutus
routes { Plutus::Engine.routes }

def mock_entry(stubs={})
@mock_entry ||= mock_model(Entry, stubs)
@mock_entry ||= FactoryGirl.create(:entry_with_credit_and_debit)
end

describe "GET index" do
it "assigns all entries as @entries" do
Entry.stub(:all).and_return([mock_entry])
Entry.stub_chain(:limit, :order).and_return([mock_entry])
get :index
assigns[:entries].should == [mock_entry]
end
end

describe "GET show" do
it "assigns the requested entry as @entry" do
Entry.stub(:find).with("37").and_return(mock_entry)
get :show, :id => "37"
assigns[:entry].should equal(mock_entry)
end
end
end
end
20 changes: 0 additions & 20 deletions spec/routing/accounts_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ module Plutus
it "recognizes and generates #index" do
{ :get => "/accounts" }.should route_to(:controller => "plutus/accounts", :action => "index")
end

it "recognizes and generates #show" do
{ :get => "/accounts/1" }.should route_to(:controller => "plutus/accounts", :action => "show", :id => "1")
end

it "recognizes and generates #edit" do
{ :get => "/accounts/1/edit" }.should_not be_routable
end

it "recognizes and generates #create" do
{ :post => "/accounts" }.should_not be_routable
end

it "recognizes and generates #update" do
{ :put => "/accounts/1" }.should_not be_routable
end

it "recognizes and generates #destroy" do
{ :delete => "/accounts/1" }.should_not be_routable
end
end
end
end
20 changes: 0 additions & 20 deletions spec/routing/entries_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,6 @@ module Plutus
it "recognizes and generates #index" do
{ :get => "/entries" }.should route_to(:controller => "plutus/entries", :action => "index")
end

it "recognizes and generates #show" do
{ :get => "/entries/1" }.should route_to(:controller => "plutus/entries", :action => "show", :id => "1")
end

it "recognizes and generates #edit" do
{ :get => "/entries/1/edit" }.should_not be_routable
end

it "recognizes and generates #create" do
{ :post => "/entries" }.should_not be_routable
end

it "recognizes and generates #update" do
{ :put => "/entries/1" }.should_not be_routable
end

it "recognizes and generates #destroy" do
{ :delete => "/entries/1" }.should_not be_routable
end
end
end
end
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

RSpec.configure do |config|
config.use_transactional_fixtures = true
config.infer_spec_type_from_file_location!
end

FactoryGirlHelpers.reload()

0 comments on commit 4e03e3d

Please sign in to comment.