Skip to content

Commit

Permalink
Refactored specs to make more sense and removed duplicate description…
Browse files Browse the repository at this point in the history
…s, also refactored system_merge & merge to display the diffs in the correct order.
  • Loading branch information
baphled committed Apr 20, 2010
1 parent d894236 commit a07a558
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions spec/controllers/features_controller_spec.rb
Expand Up @@ -121,8 +121,7 @@ def mock_feature(stubs={})
end

it "should display the changes" do
@feature.stub(:diff).and_return nil
@feature.should_receive(:diff)
@feature.should_receive(:diff_reverse)
get :merge, {:feature => @feature}
end
end
Expand Down Expand Up @@ -220,6 +219,7 @@ def mock_feature(stubs={})
describe "GET, system_sync" do
before(:each) do
@feature = mock_model(Feature,:title=>"A new feature").as_null_object
@feature.stub!(:path).and_return "#{RAILS_ROOT}/features/plain/tag_cloud.feature"
Feature.stub!(:find).and_return @feature
end

Expand All @@ -239,8 +239,8 @@ def mock_feature(stubs={})
@feature.stub!(:is_diff?).and_return true
end

it "should make a call to diff_reverse" do
@feature.should_receive(:diff_reverse)
it "should make a call to diff" do
@feature.should_receive(:diff)
get :system_merge, {:feature => @feature, :dry_run => true}
end

Expand All @@ -264,20 +264,7 @@ def mock_feature(stubs={})
response.should redirect_to feature_path(@feature)
end
end
end

describe "GET, system_sync" do
before(:each) do
@feature = mock_model(Feature).as_null_object
@feature.stub!(:path).and_return "#{RAILS_ROOT}/features/plain/tag_cloud.feature"
Feature.stub!(:find).and_return @feature
end

it "should redirect to the feature" do
get :system_sync, {:feature => @feature}
response.should redirect_to feature_path(@feature)
end


context "feature does not need updating" do
before(:each) do
@feature.stub!(:is_diff?).and_return false
Expand Down

0 comments on commit a07a558

Please sign in to comment.