Skip to content

Commit

Permalink
Use theming factory in updated specs
Browse files Browse the repository at this point in the history
  • Loading branch information
aviav committed May 30, 2017
1 parent efb03b7 commit 936ea61
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions spec/models/pageflow/home_button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ module Pageflow
describe '#url' do
it 'returns home_url of revision' do
revision = Revision.new(home_url: 'http://example.com')
theming = Theming.new(account: create(:account))
theming = create(:theming)
home_button = HomeButton.new(revision, theming)

expect(home_button.url).to eq('http://example.com')
end

it 'falls back to cname of theming if theming has home_url' do
revision = Revision.new(home_url: '')
theming = Theming.new(cname: 'pageflow.example.com',
home_url: 'http://example.com',
account: create(:account))
theming = create(:theming,
cname: 'pageflow.example.com',
home_url: 'http://example.com')
home_button = HomeButton.new(revision, theming)

expect(home_button.url).to eq(host: 'pageflow.example.com', controller: 'entries', action: 'index')
Expand All @@ -28,7 +28,7 @@ module Pageflow
config.themes.register(:with_home_button)
end
revision = Revision.new(home_url: 'http://example.com', home_button_enabled: true)
theming = Theming.new(theme_name: 'with_home_button', account: create(:account))
theming = create(:theming, theme_name: 'with_home_button')
home_button = HomeButton.new(revision, theming)

expect(home_button).to be_enabled
Expand All @@ -39,10 +39,10 @@ module Pageflow
config.themes.register(:with_home_button)
end
revision = Revision.new(home_url: '', home_button_enabled: true)
theming = Theming.new(theme_name: 'with_home_button',
home_url: 'http://example.com',
cname: 'pageflow.exmaple.com',
account: create(:account))
theming = create(:theming,
theme_name: 'with_home_button',
home_url: 'http://example.com',
cname: 'pageflow.exmaple.com')
home_button = HomeButton.new(revision, theming)

expect(home_button).to be_enabled
Expand All @@ -53,7 +53,7 @@ module Pageflow
config.themes.register(:with_home_button)
end
revision = Revision.new(home_url: 'http://example.com', home_button_enabled: false)
theming = Theming.new(theme_name: 'with_home_button', account: create(:account))
theming = create(:theming, theme_name: 'with_home_button')
home_button = HomeButton.new(revision, theming)

expect(home_button).not_to be_enabled
Expand All @@ -64,7 +64,7 @@ module Pageflow
config.themes.register(:with_home_button)
end
revision = Revision.new(home_button_enabled: true)
theming = Theming.new(theme_name: 'with_home_button', account: create(:account))
theming = create(:theming, theme_name: 'with_home_button')
home_button = HomeButton.new(revision, theming)

expect(home_button).not_to be_enabled
Expand All @@ -75,7 +75,7 @@ module Pageflow
config.themes.register(:no_home_button, no_home_button: true)
end
revision = Revision.new(home_url: 'http://example.com', home_button_enabled: true)
theming = Theming.new(theme_name: 'no_home_button', account: create(:account))
theming = create(:theming, theme_name: 'no_home_button')
home_button = HomeButton.new(revision, theming)

expect(home_button).not_to be_enabled
Expand Down
12 changes: 6 additions & 6 deletions spec/models/pageflow/overview_button_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Pageflow
config.themes.register(:with_overview_button)
end
revision = Revision.new(overview_button_enabled: true)
theming = Theming.new(theme_name: 'with_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'with_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button).to be_enabled
Expand All @@ -19,7 +19,7 @@ module Pageflow
config.themes.register(:with_overview_button)
end
revision = Revision.new(overview_button_enabled: false)
theming = Theming.new(theme_name: 'with_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'with_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button).not_to be_enabled
Expand All @@ -30,7 +30,7 @@ module Pageflow
config.themes.register(:no_overview_button, no_overview_button: true)
end
revision = Revision.new(overview_button_enabled: true)
theming = Theming.new(theme_name: 'no_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'no_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button).not_to be_enabled
Expand All @@ -43,7 +43,7 @@ module Pageflow
config.themes.register(:with_overview_button)
end
revision = Revision.new(overview_button_enabled: true)
theming = Theming.new(theme_name: 'with_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'with_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button.enabled_value).to eq(true)
Expand All @@ -54,7 +54,7 @@ module Pageflow
config.themes.register(:with_overview_button)
end
revision = Revision.new(overview_button_enabled: false)
theming = Theming.new(theme_name: 'with_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'with_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button.enabled_value).to eq(false)
Expand All @@ -65,7 +65,7 @@ module Pageflow
config.themes.register(:no_overview_button, no_overview_button: true)
end
revision = Revision.new(overview_button_enabled: true)
theming = Theming.new(theme_name: 'no_overview_button', account: create(:account))
theming = create(:theming, theme_name: 'no_overview_button')
overview_button = OverviewButton.new(revision, theming)

expect(overview_button.enabled_value).to eq(true)
Expand Down

0 comments on commit 936ea61

Please sign in to comment.