Skip to content

Commit

Permalink
Reformatting the mapping spec, refs socialcast#23
Browse files Browse the repository at this point in the history
  • Loading branch information
BRMatt committed Dec 4, 2011
1 parent d5cc747 commit 2fc252b
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions spec/lib/devise/oauth2_providable/mapping_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end
end

describe "devise_scope" do
describe "#devise_scope" do
let (:devise_scope) { stub() }
it "returns the devise mapping object" do
Devise.mappings.should_receive(:[]).with(:user).and_return(devise_scope)
Expand All @@ -32,7 +32,7 @@
end
end

describe "path_prefix" do
describe "#path_prefix" do
context "is specified" do
subject { mapping = mapping_class.new(:users, {:path_prefix => "member"}) }

Expand All @@ -42,24 +42,30 @@
end
end

context "when custom controllers are specified" do
it "the custom ones are used instead of defaults" do
controllers = {:authorizations => "authorizations", :tokens => "tokens"}
describe "#controllers" do
context "when custom controllers are specified" do
context "and all the defaults are overridden" do
it "the custom ones are used instead of defaults" do
controllers = {:authorizations => "authorizations", :tokens => "tokens"}

mapping = mapping_class.new(:users, {:controllers => controllers})
mapping = mapping_class.new(:users, {:controllers => controllers})

mapping.controllers.should eql(controllers)
end
mapping.controllers.should eql(controllers)
end
end

it "the custom ones should be merged with defaults" do
controllers = {:authorizations => "authorizations"}
context "and only some of the defaults are overridden" do
it "the custom ones should be merged with defaults" do
controllers = {:authorizations => "authorizations"}

mapping = mapping_class.new(:users, {:controllers => controllers})
mapping = mapping_class.new(:users, {:controllers => controllers})

mapping.controllers.should eql({
:authorizations => "authorizations",
:tokens => "devise/oauth2_providable/tokens"
})
mapping.controllers.should eql({
:authorizations => "authorizations",
:tokens => "devise/oauth2_providable/tokens"
})
end
end
end
end
end
Expand Down

0 comments on commit 2fc252b

Please sign in to comment.