Created
April 6, 2012 09:03
-
-
Save aponsin/2318307 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "updating matching categories on project save", :focus do | |
let(:project) { Factory.build :project } | |
before(:each) do | |
@old_matching_categories = project.matching_categories | |
end | |
it "should update the matching categories after updating the category and saving the project" do | |
project.category = "C01" | |
project.save :validate => false # saving without validation because we know the project is not complete, does not matter for that test | |
binding.pry | |
project.category should eq "C01" | |
project.matching_categories should_not eq @old_matching_categories | |
project.should_receive(:build_matching_categories).once | |
end | |
it "should not update matching categories by just saving the project without changing the category" do | |
project.name = "factory_project_updated" | |
project.save :validate => false # saving without validation because we know the project is not complete, does not matter for that test | |
project.matching_categories should eq @old_matching_categories | |
project.should_not_receive(:build_matching_categories).once | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment